@tscircuit/3d-viewer 0.0.565 → 0.0.567
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +741 -422
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14432,8 +14432,8 @@ var require_browser = __commonJS({
|
|
|
14432
14432
|
});
|
|
14433
14433
|
|
|
14434
14434
|
// src/CadViewer.tsx
|
|
14435
|
-
import { useState as
|
|
14436
|
-
import * as
|
|
14435
|
+
import { useState as useState37, useCallback as useCallback23, useRef as useRef28, useEffect as useEffect47 } from "react";
|
|
14436
|
+
import * as THREE44 from "three";
|
|
14437
14437
|
|
|
14438
14438
|
// src/CadViewerJscad.tsx
|
|
14439
14439
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
@@ -32321,7 +32321,7 @@ import * as THREE20 from "three";
|
|
|
32321
32321
|
// package.json
|
|
32322
32322
|
var package_default = {
|
|
32323
32323
|
name: "@tscircuit/3d-viewer",
|
|
32324
|
-
version: "0.0.
|
|
32324
|
+
version: "0.0.566",
|
|
32325
32325
|
main: "./dist/index.js",
|
|
32326
32326
|
module: "./dist/index.js",
|
|
32327
32327
|
type: "module",
|
|
@@ -32351,7 +32351,7 @@ var package_default = {
|
|
|
32351
32351
|
"@jscad/regl-renderer": "^2.6.12",
|
|
32352
32352
|
"@jscad/stl-serializer": "^2.1.20",
|
|
32353
32353
|
"circuit-json": "^0.0.421",
|
|
32354
|
-
"circuit-to-canvas": "^0.0.
|
|
32354
|
+
"circuit-to-canvas": "^0.0.110",
|
|
32355
32355
|
"react-hot-toast": "^2.6.0",
|
|
32356
32356
|
three: "^0.165.0",
|
|
32357
32357
|
"three-stdlib": "^2.36.0",
|
|
@@ -33544,10 +33544,6 @@ var boardMaterialColors = {
|
|
|
33544
33544
|
fr1: colors.fr1Tan,
|
|
33545
33545
|
fr4: colors.fr4Tan
|
|
33546
33546
|
};
|
|
33547
|
-
var tracesMaterialColors = {
|
|
33548
|
-
fr1: colors.fr1TracesWithMaskCopper,
|
|
33549
|
-
fr4: colors.fr4TracesWithoutMaskTan
|
|
33550
|
-
};
|
|
33551
33547
|
var soldermaskColors = {
|
|
33552
33548
|
fr1: colors.fr1SolderMaskGreen,
|
|
33553
33549
|
fr4: colors.fr4SolderMaskGreen
|
|
@@ -33629,15 +33625,6 @@ var createSimplifiedBoardGeom = (circuitJson) => {
|
|
|
33629
33625
|
const material = boardMaterialColors[materialName] ?? colors.fr4Tan;
|
|
33630
33626
|
return [(0, import_colors.colorize)(material, boardGeom)];
|
|
33631
33627
|
};
|
|
33632
|
-
var createBoardGeomFromCircuitJson = (circuitJson, opts = {}) => {
|
|
33633
|
-
console.warn(
|
|
33634
|
-
"createBoardGeomFromCircuitJson is deprecated. Use BoardGeomBuilder or createSimplifiedBoardGeom."
|
|
33635
|
-
);
|
|
33636
|
-
if (opts.simplifiedBoard) {
|
|
33637
|
-
return createSimplifiedBoardGeom(circuitJson);
|
|
33638
|
-
}
|
|
33639
|
-
return createSimplifiedBoardGeom(circuitJson);
|
|
33640
|
-
};
|
|
33641
33628
|
|
|
33642
33629
|
// src/BoardGeomBuilder.ts
|
|
33643
33630
|
var import_colors3 = __toESM(require_colors(), 1);
|
|
@@ -35163,7 +35150,7 @@ import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
|
35163
35150
|
import { useEffect as useEffect24, useMemo as useMemo19 } from "react";
|
|
35164
35151
|
|
|
35165
35152
|
// src/textures/create-combined-board-textures.ts
|
|
35166
|
-
import * as
|
|
35153
|
+
import * as THREE34 from "three";
|
|
35167
35154
|
|
|
35168
35155
|
// node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
|
|
35169
35156
|
var getBoundsFromPoints = (points) => {
|
|
@@ -35268,7 +35255,7 @@ function createPadTextureForLayer({
|
|
|
35268
35255
|
drill: transparent,
|
|
35269
35256
|
boardOutline: transparent,
|
|
35270
35257
|
substrate: transparent,
|
|
35271
|
-
keepout: transparent,
|
|
35258
|
+
keepout: { top: transparent, bottom: transparent },
|
|
35272
35259
|
fabricationNote: transparent,
|
|
35273
35260
|
courtyard: { top: transparent, bottom: transparent },
|
|
35274
35261
|
silkscreen: { top: transparent, bottom: transparent },
|
|
@@ -35474,7 +35461,7 @@ function createTraceTextureForLayer({
|
|
|
35474
35461
|
drill: transparent,
|
|
35475
35462
|
boardOutline: transparent,
|
|
35476
35463
|
substrate: transparent,
|
|
35477
|
-
keepout: transparent,
|
|
35464
|
+
keepout: { top: transparent, bottom: transparent },
|
|
35478
35465
|
fabricationNote: transparent,
|
|
35479
35466
|
courtyard: { top: transparent, bottom: transparent },
|
|
35480
35467
|
silkscreen: { top: transparent, bottom: transparent },
|
|
@@ -35706,7 +35693,7 @@ function createCopperPourTextureForLayer({
|
|
|
35706
35693
|
drill: transparent,
|
|
35707
35694
|
boardOutline: transparent,
|
|
35708
35695
|
substrate: transparent,
|
|
35709
|
-
keepout: transparent,
|
|
35696
|
+
keepout: { top: transparent, bottom: transparent },
|
|
35710
35697
|
fabricationNote: transparent,
|
|
35711
35698
|
courtyard: { top: transparent, bottom: transparent },
|
|
35712
35699
|
silkscreen: { top: transparent, bottom: transparent },
|
|
@@ -35881,7 +35868,7 @@ var drawFabricationNoteLayer = ({
|
|
|
35881
35868
|
drill: TRANSPARENT,
|
|
35882
35869
|
boardOutline: TRANSPARENT,
|
|
35883
35870
|
substrate: TRANSPARENT,
|
|
35884
|
-
keepout: TRANSPARENT,
|
|
35871
|
+
keepout: { top: TRANSPARENT, bottom: TRANSPARENT },
|
|
35885
35872
|
courtyard: {
|
|
35886
35873
|
top: TRANSPARENT,
|
|
35887
35874
|
bottom: TRANSPARENT
|
|
@@ -35997,12 +35984,11 @@ function createFabricationNoteTextureForLayer({
|
|
|
35997
35984
|
return texture;
|
|
35998
35985
|
}
|
|
35999
35986
|
|
|
36000
|
-
// src/textures/create-
|
|
35987
|
+
// src/textures/create-keepout-texture-for-layer.ts
|
|
36001
35988
|
import * as THREE29 from "three";
|
|
36002
35989
|
|
|
36003
|
-
// src/textures/
|
|
35990
|
+
// src/textures/keepout/keepout-drawing.ts
|
|
36004
35991
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer6 } from "circuit-to-canvas";
|
|
36005
|
-
var TRANSPARENT2 = "rgba(0,0,0,0)";
|
|
36006
35992
|
var setDrawerBounds3 = (drawer, bounds) => {
|
|
36007
35993
|
drawer.setCameraBounds({
|
|
36008
35994
|
minX: bounds.minX,
|
|
@@ -36011,6 +35997,92 @@ var setDrawerBounds3 = (drawer, bounds) => {
|
|
|
36011
35997
|
maxY: bounds.maxY
|
|
36012
35998
|
});
|
|
36013
35999
|
};
|
|
36000
|
+
var drawKeepoutLayer = ({
|
|
36001
|
+
ctx,
|
|
36002
|
+
layer,
|
|
36003
|
+
bounds,
|
|
36004
|
+
elements,
|
|
36005
|
+
keepoutColor
|
|
36006
|
+
}) => {
|
|
36007
|
+
const renderLayer = layer === "top" ? "top_copper" : "bottom_copper";
|
|
36008
|
+
const drawer = new CircuitToCanvasDrawer6(ctx);
|
|
36009
|
+
drawer.configure({
|
|
36010
|
+
colorOverrides: {
|
|
36011
|
+
keepout: {
|
|
36012
|
+
top: keepoutColor,
|
|
36013
|
+
bottom: keepoutColor
|
|
36014
|
+
}
|
|
36015
|
+
}
|
|
36016
|
+
});
|
|
36017
|
+
setDrawerBounds3(drawer, bounds);
|
|
36018
|
+
drawer.drawElements(elements, {
|
|
36019
|
+
layers: [renderLayer],
|
|
36020
|
+
drawSoldermask: false,
|
|
36021
|
+
drawSoldermaskTop: false,
|
|
36022
|
+
drawSoldermaskBottom: false
|
|
36023
|
+
});
|
|
36024
|
+
};
|
|
36025
|
+
|
|
36026
|
+
// src/textures/create-keepout-texture-for-layer.ts
|
|
36027
|
+
var isKeepoutOnLayer = (element, layer) => {
|
|
36028
|
+
if (element.type !== "pcb_keepout") return false;
|
|
36029
|
+
if (!("layers" in element) || !Array.isArray(element.layers)) return true;
|
|
36030
|
+
return element.layers.includes(layer);
|
|
36031
|
+
};
|
|
36032
|
+
function createKeepoutTextureForLayer({
|
|
36033
|
+
layer,
|
|
36034
|
+
circuitJson,
|
|
36035
|
+
boardData,
|
|
36036
|
+
traceTextureResolution = TRACE_TEXTURE_RESOLUTION,
|
|
36037
|
+
keepoutColor = layer === "bottom" ? "#4b72d2" : "#d24b4b"
|
|
36038
|
+
}) {
|
|
36039
|
+
const elements = circuitJson.filter(
|
|
36040
|
+
(element) => isKeepoutOnLayer(element, layer)
|
|
36041
|
+
);
|
|
36042
|
+
if (elements.length === 0) return null;
|
|
36043
|
+
const bounds = calculateOutlineBounds(boardData);
|
|
36044
|
+
const canvasWidth = Math.floor(bounds.width * traceTextureResolution);
|
|
36045
|
+
const canvasHeight = Math.floor(bounds.height * traceTextureResolution);
|
|
36046
|
+
if (canvasWidth <= 0 || canvasHeight <= 0) return null;
|
|
36047
|
+
const canvas = document.createElement("canvas");
|
|
36048
|
+
canvas.width = canvasWidth;
|
|
36049
|
+
canvas.height = canvasHeight;
|
|
36050
|
+
const ctx = canvas.getContext("2d");
|
|
36051
|
+
if (!ctx) return null;
|
|
36052
|
+
if (layer === "bottom") {
|
|
36053
|
+
ctx.translate(0, canvasHeight);
|
|
36054
|
+
ctx.scale(1, -1);
|
|
36055
|
+
}
|
|
36056
|
+
drawKeepoutLayer({
|
|
36057
|
+
ctx,
|
|
36058
|
+
layer,
|
|
36059
|
+
bounds,
|
|
36060
|
+
elements,
|
|
36061
|
+
keepoutColor
|
|
36062
|
+
});
|
|
36063
|
+
const texture = new THREE29.CanvasTexture(canvas);
|
|
36064
|
+
texture.generateMipmaps = true;
|
|
36065
|
+
texture.minFilter = THREE29.LinearMipmapLinearFilter;
|
|
36066
|
+
texture.magFilter = THREE29.LinearFilter;
|
|
36067
|
+
texture.anisotropy = 16;
|
|
36068
|
+
texture.needsUpdate = true;
|
|
36069
|
+
return texture;
|
|
36070
|
+
}
|
|
36071
|
+
|
|
36072
|
+
// src/textures/create-pcb-note-texture-for-layer.ts
|
|
36073
|
+
import * as THREE30 from "three";
|
|
36074
|
+
|
|
36075
|
+
// src/textures/pcb-note/pcb-note-drawing.ts
|
|
36076
|
+
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer7 } from "circuit-to-canvas";
|
|
36077
|
+
var TRANSPARENT2 = "rgba(0,0,0,0)";
|
|
36078
|
+
var setDrawerBounds4 = (drawer, bounds) => {
|
|
36079
|
+
drawer.setCameraBounds({
|
|
36080
|
+
minX: bounds.minX,
|
|
36081
|
+
maxX: bounds.maxX,
|
|
36082
|
+
minY: bounds.minY,
|
|
36083
|
+
maxY: bounds.maxY
|
|
36084
|
+
});
|
|
36085
|
+
};
|
|
36014
36086
|
var normalizePcbNoteElement = (element) => {
|
|
36015
36087
|
if (element.type === "pcb_note_line") {
|
|
36016
36088
|
return {
|
|
@@ -36080,7 +36152,7 @@ var drawPcbNoteLayer = ({
|
|
|
36080
36152
|
elements
|
|
36081
36153
|
}) => {
|
|
36082
36154
|
const normalizedElements = elements.map(normalizePcbNoteElement);
|
|
36083
|
-
const drawer = new
|
|
36155
|
+
const drawer = new CircuitToCanvasDrawer7(ctx);
|
|
36084
36156
|
drawer.configure({
|
|
36085
36157
|
colorOverrides: {
|
|
36086
36158
|
copper: {
|
|
@@ -36097,7 +36169,7 @@ var drawPcbNoteLayer = ({
|
|
|
36097
36169
|
drill: TRANSPARENT2,
|
|
36098
36170
|
boardOutline: TRANSPARENT2,
|
|
36099
36171
|
substrate: TRANSPARENT2,
|
|
36100
|
-
keepout: TRANSPARENT2,
|
|
36172
|
+
keepout: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
|
|
36101
36173
|
courtyard: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
|
|
36102
36174
|
soldermask: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
|
|
36103
36175
|
soldermaskWithCopperUnderneath: {
|
|
@@ -36112,7 +36184,7 @@ var drawPcbNoteLayer = ({
|
|
|
36112
36184
|
fabricationNote: TRANSPARENT2
|
|
36113
36185
|
}
|
|
36114
36186
|
});
|
|
36115
|
-
|
|
36187
|
+
setDrawerBounds4(drawer, bounds);
|
|
36116
36188
|
drawer.drawElements(normalizedElements);
|
|
36117
36189
|
};
|
|
36118
36190
|
|
|
@@ -36149,23 +36221,23 @@ function createPcbNoteTextureForLayer({
|
|
|
36149
36221
|
bounds,
|
|
36150
36222
|
elements
|
|
36151
36223
|
});
|
|
36152
|
-
const texture = new
|
|
36224
|
+
const texture = new THREE30.CanvasTexture(canvas);
|
|
36153
36225
|
texture.generateMipmaps = true;
|
|
36154
|
-
texture.minFilter =
|
|
36155
|
-
texture.magFilter =
|
|
36226
|
+
texture.minFilter = THREE30.LinearMipmapLinearFilter;
|
|
36227
|
+
texture.magFilter = THREE30.LinearFilter;
|
|
36156
36228
|
texture.anisotropy = 16;
|
|
36157
36229
|
texture.needsUpdate = true;
|
|
36158
36230
|
return texture;
|
|
36159
36231
|
}
|
|
36160
36232
|
|
|
36161
36233
|
// src/textures/create-silkscreen-texture-for-layer.ts
|
|
36162
|
-
import * as
|
|
36234
|
+
import * as THREE31 from "three";
|
|
36163
36235
|
|
|
36164
36236
|
// src/textures/silkscreen/silkscreen-drawing.ts
|
|
36165
|
-
import { CircuitToCanvasDrawer as
|
|
36237
|
+
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer8 } from "circuit-to-canvas";
|
|
36166
36238
|
var FABRICATION_NOTE_COLOR2 = "rgb(255,243,204)";
|
|
36167
36239
|
var TRANSPARENT3 = "rgba(0,0,0,0)";
|
|
36168
|
-
var
|
|
36240
|
+
var setDrawerBounds5 = (drawer, bounds) => {
|
|
36169
36241
|
drawer.setCameraBounds({
|
|
36170
36242
|
minX: bounds.minX,
|
|
36171
36243
|
maxX: bounds.maxX,
|
|
@@ -36181,7 +36253,7 @@ var drawSilkscreenLayer = ({
|
|
|
36181
36253
|
silkscreenColor
|
|
36182
36254
|
}) => {
|
|
36183
36255
|
const renderLayer = layer === "top" ? "top_silkscreen" : "bottom_silkscreen";
|
|
36184
|
-
const drawer = new
|
|
36256
|
+
const drawer = new CircuitToCanvasDrawer8(ctx);
|
|
36185
36257
|
drawer.configure({
|
|
36186
36258
|
colorOverrides: {
|
|
36187
36259
|
copper: {
|
|
@@ -36201,7 +36273,7 @@ var drawSilkscreenLayer = ({
|
|
|
36201
36273
|
drill: TRANSPARENT3,
|
|
36202
36274
|
boardOutline: TRANSPARENT3,
|
|
36203
36275
|
substrate: TRANSPARENT3,
|
|
36204
|
-
keepout: TRANSPARENT3,
|
|
36276
|
+
keepout: { top: TRANSPARENT3, bottom: TRANSPARENT3 },
|
|
36205
36277
|
courtyard: {
|
|
36206
36278
|
top: TRANSPARENT3,
|
|
36207
36279
|
bottom: TRANSPARENT3
|
|
@@ -36225,7 +36297,7 @@ var drawSilkscreenLayer = ({
|
|
|
36225
36297
|
fabricationNote: FABRICATION_NOTE_COLOR2
|
|
36226
36298
|
}
|
|
36227
36299
|
});
|
|
36228
|
-
|
|
36300
|
+
setDrawerBounds5(drawer, bounds);
|
|
36229
36301
|
drawer.drawElements(elements, {
|
|
36230
36302
|
layers: [renderLayer]
|
|
36231
36303
|
});
|
|
@@ -36268,20 +36340,20 @@ function createSilkscreenTextureForLayer({
|
|
|
36268
36340
|
elements,
|
|
36269
36341
|
silkscreenColor
|
|
36270
36342
|
});
|
|
36271
|
-
const texture = new
|
|
36343
|
+
const texture = new THREE31.CanvasTexture(canvas);
|
|
36272
36344
|
texture.generateMipmaps = true;
|
|
36273
|
-
texture.minFilter =
|
|
36274
|
-
texture.magFilter =
|
|
36345
|
+
texture.minFilter = THREE31.LinearMipmapLinearFilter;
|
|
36346
|
+
texture.magFilter = THREE31.LinearFilter;
|
|
36275
36347
|
texture.anisotropy = 16;
|
|
36276
36348
|
texture.needsUpdate = true;
|
|
36277
36349
|
return texture;
|
|
36278
36350
|
}
|
|
36279
36351
|
|
|
36280
36352
|
// src/textures/create-soldermask-texture-for-layer.ts
|
|
36281
|
-
import * as
|
|
36353
|
+
import * as THREE32 from "three";
|
|
36282
36354
|
|
|
36283
36355
|
// src/textures/soldermask/soldermask-drawing.ts
|
|
36284
|
-
import { CircuitToCanvasDrawer as
|
|
36356
|
+
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer9 } from "circuit-to-canvas";
|
|
36285
36357
|
var toRgb2 = (colorArr) => {
|
|
36286
36358
|
const [r = 0, g = 0, b = 0] = colorArr;
|
|
36287
36359
|
return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
|
|
@@ -36300,7 +36372,7 @@ var getSoldermaskPalette = (material) => {
|
|
|
36300
36372
|
transparent: "rgba(0,0,0,0)"
|
|
36301
36373
|
};
|
|
36302
36374
|
};
|
|
36303
|
-
var
|
|
36375
|
+
var setDrawerBounds6 = (drawer, bounds) => {
|
|
36304
36376
|
drawer.setCameraBounds({
|
|
36305
36377
|
minX: bounds.minX,
|
|
36306
36378
|
maxX: bounds.maxX,
|
|
@@ -36317,7 +36389,7 @@ var drawSoldermaskLayer = ({
|
|
|
36317
36389
|
}) => {
|
|
36318
36390
|
const palette = getSoldermaskPalette(boardMaterial);
|
|
36319
36391
|
const copperRenderLayer = layer === "top" ? "top_copper" : "bottom_copper";
|
|
36320
|
-
const drawer = new
|
|
36392
|
+
const drawer = new CircuitToCanvasDrawer9(ctx);
|
|
36321
36393
|
drawer.configure({
|
|
36322
36394
|
colorOverrides: {
|
|
36323
36395
|
copper: {
|
|
@@ -36333,7 +36405,7 @@ var drawSoldermaskLayer = ({
|
|
|
36333
36405
|
drill: palette.transparent,
|
|
36334
36406
|
boardOutline: palette.transparent,
|
|
36335
36407
|
substrate: palette.transparent,
|
|
36336
|
-
keepout: palette.transparent,
|
|
36408
|
+
keepout: { top: palette.transparent, bottom: palette.transparent },
|
|
36337
36409
|
fabricationNote: palette.transparent,
|
|
36338
36410
|
silkscreen: { top: palette.transparent, bottom: palette.transparent },
|
|
36339
36411
|
courtyard: { top: palette.transparent, bottom: palette.transparent },
|
|
@@ -36348,20 +36420,23 @@ var drawSoldermaskLayer = ({
|
|
|
36348
36420
|
}
|
|
36349
36421
|
}
|
|
36350
36422
|
});
|
|
36351
|
-
|
|
36352
|
-
|
|
36423
|
+
setDrawerBounds6(drawer, bounds);
|
|
36424
|
+
const elementsWithoutKeepouts = elements.filter(
|
|
36425
|
+
(element) => element.type !== "pcb_keepout"
|
|
36426
|
+
);
|
|
36427
|
+
drawer.drawElements(elementsWithoutKeepouts, {
|
|
36353
36428
|
layers: [copperRenderLayer],
|
|
36354
36429
|
drawSoldermask: true,
|
|
36355
36430
|
drawSoldermaskTop: layer === "top",
|
|
36356
36431
|
drawSoldermaskBottom: layer === "bottom"
|
|
36357
36432
|
});
|
|
36358
|
-
const uncoveredPours =
|
|
36433
|
+
const uncoveredPours = elementsWithoutKeepouts.filter(
|
|
36359
36434
|
(e) => e.type === "pcb_copper_pour" && e.layer === layer && e.covered_with_solder_mask === false
|
|
36360
36435
|
);
|
|
36361
36436
|
if (uncoveredPours.length > 0) {
|
|
36362
36437
|
ctx.save();
|
|
36363
36438
|
ctx.globalCompositeOperation = "destination-out";
|
|
36364
|
-
const cutoutDrawer = new
|
|
36439
|
+
const cutoutDrawer = new CircuitToCanvasDrawer9(ctx);
|
|
36365
36440
|
cutoutDrawer.configure({
|
|
36366
36441
|
colorOverrides: {
|
|
36367
36442
|
copper: {
|
|
@@ -36376,7 +36451,7 @@ var drawSoldermaskLayer = ({
|
|
|
36376
36451
|
}
|
|
36377
36452
|
}
|
|
36378
36453
|
});
|
|
36379
|
-
|
|
36454
|
+
setDrawerBounds6(cutoutDrawer, bounds);
|
|
36380
36455
|
cutoutDrawer.drawElements(uncoveredPours, { layers: [copperRenderLayer] });
|
|
36381
36456
|
ctx.restore();
|
|
36382
36457
|
}
|
|
@@ -36410,21 +36485,21 @@ function createSoldermaskTextureForLayer({
|
|
|
36410
36485
|
elements,
|
|
36411
36486
|
boardMaterial: boardData.material
|
|
36412
36487
|
});
|
|
36413
|
-
const texture = new
|
|
36488
|
+
const texture = new THREE32.CanvasTexture(canvas);
|
|
36414
36489
|
texture.generateMipmaps = true;
|
|
36415
|
-
texture.minFilter =
|
|
36416
|
-
texture.magFilter =
|
|
36490
|
+
texture.minFilter = THREE32.LinearMipmapLinearFilter;
|
|
36491
|
+
texture.magFilter = THREE32.LinearFilter;
|
|
36417
36492
|
texture.anisotropy = 16;
|
|
36418
36493
|
texture.needsUpdate = true;
|
|
36419
36494
|
return texture;
|
|
36420
36495
|
}
|
|
36421
36496
|
|
|
36422
36497
|
// src/textures/create-through-hole-texture-for-layer.ts
|
|
36423
|
-
import * as
|
|
36498
|
+
import * as THREE33 from "three";
|
|
36424
36499
|
|
|
36425
36500
|
// src/textures/through-hole/through-hole-drawing.ts
|
|
36426
|
-
import { CircuitToCanvasDrawer as
|
|
36427
|
-
var
|
|
36501
|
+
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer10 } from "circuit-to-canvas";
|
|
36502
|
+
var setDrawerBounds7 = (drawer, bounds) => {
|
|
36428
36503
|
drawer.setCameraBounds({
|
|
36429
36504
|
minX: bounds.minX,
|
|
36430
36505
|
maxX: bounds.maxX,
|
|
@@ -36441,7 +36516,7 @@ var drawThroughHoleLayer = ({
|
|
|
36441
36516
|
}) => {
|
|
36442
36517
|
const renderLayer = layer === "top" ? "top_copper" : "bottom_copper";
|
|
36443
36518
|
const transparent = "rgba(0,0,0,0)";
|
|
36444
|
-
const drawer = new
|
|
36519
|
+
const drawer = new CircuitToCanvasDrawer10(ctx);
|
|
36445
36520
|
drawer.configure({
|
|
36446
36521
|
colorOverrides: {
|
|
36447
36522
|
copper: {
|
|
@@ -36457,7 +36532,7 @@ var drawThroughHoleLayer = ({
|
|
|
36457
36532
|
drill: transparent,
|
|
36458
36533
|
boardOutline: transparent,
|
|
36459
36534
|
substrate: transparent,
|
|
36460
|
-
keepout: transparent,
|
|
36535
|
+
keepout: { top: transparent, bottom: transparent },
|
|
36461
36536
|
fabricationNote: transparent,
|
|
36462
36537
|
silkscreen: { top: transparent, bottom: transparent },
|
|
36463
36538
|
courtyard: { top: transparent, bottom: transparent },
|
|
@@ -36472,7 +36547,7 @@ var drawThroughHoleLayer = ({
|
|
|
36472
36547
|
}
|
|
36473
36548
|
}
|
|
36474
36549
|
});
|
|
36475
|
-
|
|
36550
|
+
setDrawerBounds7(drawer, bounds);
|
|
36476
36551
|
drawer.drawElements(elements, {
|
|
36477
36552
|
layers: [renderLayer]
|
|
36478
36553
|
});
|
|
@@ -36513,10 +36588,10 @@ function createThroughHoleTextureForLayer({
|
|
|
36513
36588
|
elements,
|
|
36514
36589
|
copperColor
|
|
36515
36590
|
});
|
|
36516
|
-
const texture = new
|
|
36591
|
+
const texture = new THREE33.CanvasTexture(canvas);
|
|
36517
36592
|
texture.generateMipmaps = true;
|
|
36518
|
-
texture.minFilter =
|
|
36519
|
-
texture.magFilter =
|
|
36593
|
+
texture.minFilter = THREE33.LinearMipmapLinearFilter;
|
|
36594
|
+
texture.magFilter = THREE33.LinearFilter;
|
|
36520
36595
|
texture.anisotropy = 16;
|
|
36521
36596
|
texture.needsUpdate = true;
|
|
36522
36597
|
return texture;
|
|
@@ -36554,10 +36629,10 @@ var createCombinedTexture = ({
|
|
|
36554
36629
|
const image = texture.image;
|
|
36555
36630
|
ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
|
|
36556
36631
|
});
|
|
36557
|
-
const combinedTexture = new
|
|
36632
|
+
const combinedTexture = new THREE34.CanvasTexture(canvas);
|
|
36558
36633
|
combinedTexture.generateMipmaps = false;
|
|
36559
|
-
combinedTexture.minFilter =
|
|
36560
|
-
combinedTexture.magFilter =
|
|
36634
|
+
combinedTexture.minFilter = THREE34.LinearFilter;
|
|
36635
|
+
combinedTexture.magFilter = THREE34.LinearFilter;
|
|
36561
36636
|
combinedTexture.premultiplyAlpha = true;
|
|
36562
36637
|
combinedTexture.anisotropy = 16;
|
|
36563
36638
|
combinedTexture.needsUpdate = true;
|
|
@@ -36644,6 +36719,12 @@ function createCombinedBoardTextures({
|
|
|
36644
36719
|
panelData: boardData,
|
|
36645
36720
|
traceTextureResolution
|
|
36646
36721
|
}) : null;
|
|
36722
|
+
const keepoutTexture = createKeepoutTextureForLayer({
|
|
36723
|
+
layer,
|
|
36724
|
+
circuitJson,
|
|
36725
|
+
boardData,
|
|
36726
|
+
traceTextureResolution
|
|
36727
|
+
});
|
|
36647
36728
|
return createCombinedTexture({
|
|
36648
36729
|
textures: [
|
|
36649
36730
|
copperPourTexture,
|
|
@@ -36655,7 +36736,8 @@ function createCombinedBoardTextures({
|
|
|
36655
36736
|
silkscreenTexture,
|
|
36656
36737
|
fabricationNoteTexture,
|
|
36657
36738
|
pcbNoteTexture,
|
|
36658
|
-
panelOutlineTexture
|
|
36739
|
+
panelOutlineTexture,
|
|
36740
|
+
keepoutTexture
|
|
36659
36741
|
],
|
|
36660
36742
|
boardData,
|
|
36661
36743
|
traceTextureResolution
|
|
@@ -36669,7 +36751,7 @@ function createCombinedBoardTextures({
|
|
|
36669
36751
|
}
|
|
36670
36752
|
|
|
36671
36753
|
// src/textures/create-three-texture-meshes.ts
|
|
36672
|
-
import * as
|
|
36754
|
+
import * as THREE35 from "three";
|
|
36673
36755
|
function createTexturePlane(config, boardData) {
|
|
36674
36756
|
const {
|
|
36675
36757
|
texture,
|
|
@@ -36681,15 +36763,15 @@ function createTexturePlane(config, boardData) {
|
|
|
36681
36763
|
} = config;
|
|
36682
36764
|
if (!texture) return null;
|
|
36683
36765
|
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
36684
|
-
const planeGeom = new
|
|
36766
|
+
const planeGeom = new THREE35.PlaneGeometry(
|
|
36685
36767
|
boardOutlineBounds.width,
|
|
36686
36768
|
boardOutlineBounds.height
|
|
36687
36769
|
);
|
|
36688
|
-
const material = new
|
|
36770
|
+
const material = new THREE35.MeshBasicMaterial({
|
|
36689
36771
|
map: texture,
|
|
36690
36772
|
transparent: true,
|
|
36691
36773
|
alphaTest: 0.08,
|
|
36692
|
-
side:
|
|
36774
|
+
side: THREE35.FrontSide,
|
|
36693
36775
|
depthWrite: true,
|
|
36694
36776
|
polygonOffset: usePolygonOffset,
|
|
36695
36777
|
polygonOffsetFactor: usePolygonOffset ? -4 : 0,
|
|
@@ -36697,7 +36779,7 @@ function createTexturePlane(config, boardData) {
|
|
|
36697
36779
|
polygonOffsetUnits: usePolygonOffset ? -4 : 0,
|
|
36698
36780
|
opacity: isFaux ? FAUX_BOARD_OPACITY : 1
|
|
36699
36781
|
});
|
|
36700
|
-
const mesh = new
|
|
36782
|
+
const mesh = new THREE35.Mesh(planeGeom, material);
|
|
36701
36783
|
mesh.position.set(
|
|
36702
36784
|
boardOutlineBounds.centerX,
|
|
36703
36785
|
boardOutlineBounds.centerY,
|
|
@@ -36742,7 +36824,7 @@ function createTextureMeshes(textures, boardData, pcbThickness, isFaux = false)
|
|
|
36742
36824
|
}
|
|
36743
36825
|
|
|
36744
36826
|
// src/three-components/JscadBoardTextures.tsx
|
|
36745
|
-
import * as
|
|
36827
|
+
import * as THREE36 from "three";
|
|
36746
36828
|
|
|
36747
36829
|
// src/utils/layer-texture-resolution.ts
|
|
36748
36830
|
var DEFAULT_MAX_TEXTURE_PIXELS = 4e6;
|
|
@@ -36838,7 +36920,7 @@ function JscadBoardTextures({
|
|
|
36838
36920
|
const typedMaterial = material;
|
|
36839
36921
|
for (const prop of textureProps) {
|
|
36840
36922
|
const texture = typedMaterial[prop];
|
|
36841
|
-
if (texture && texture instanceof
|
|
36923
|
+
if (texture && texture instanceof THREE36.Texture) {
|
|
36842
36924
|
texture.dispose();
|
|
36843
36925
|
typedMaterial[prop] = null;
|
|
36844
36926
|
}
|
|
@@ -36848,22 +36930,22 @@ function JscadBoardTextures({
|
|
|
36848
36930
|
const createTexturePlane2 = (texture, zOffset, isBottomLayer, name, usePolygonOffset = false, depthWrite = true, renderOrder = 1) => {
|
|
36849
36931
|
if (!texture) return null;
|
|
36850
36932
|
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
36851
|
-
const planeGeom = new
|
|
36933
|
+
const planeGeom = new THREE36.PlaneGeometry(
|
|
36852
36934
|
boardOutlineBounds.width,
|
|
36853
36935
|
boardOutlineBounds.height
|
|
36854
36936
|
);
|
|
36855
|
-
const material = new
|
|
36937
|
+
const material = new THREE36.MeshBasicMaterial({
|
|
36856
36938
|
map: texture,
|
|
36857
36939
|
transparent: true,
|
|
36858
36940
|
alphaTest: 0.08,
|
|
36859
|
-
side:
|
|
36941
|
+
side: THREE36.FrontSide,
|
|
36860
36942
|
depthWrite,
|
|
36861
36943
|
polygonOffset: usePolygonOffset,
|
|
36862
36944
|
polygonOffsetFactor: usePolygonOffset ? -4 : 0,
|
|
36863
36945
|
polygonOffsetUnits: usePolygonOffset ? -4 : 0,
|
|
36864
36946
|
opacity: isFaux ? FAUX_BOARD_OPACITY : 1
|
|
36865
36947
|
});
|
|
36866
|
-
const mesh = new
|
|
36948
|
+
const mesh = new THREE36.Mesh(planeGeom, material);
|
|
36867
36949
|
mesh.position.set(
|
|
36868
36950
|
boardOutlineBounds.centerX,
|
|
36869
36951
|
boardOutlineBounds.centerY,
|
|
@@ -36908,7 +36990,7 @@ function JscadBoardTextures({
|
|
|
36908
36990
|
mesh.geometry.dispose();
|
|
36909
36991
|
if (Array.isArray(mesh.material)) {
|
|
36910
36992
|
mesh.material.forEach((material) => disposeTextureMaterial(material));
|
|
36911
|
-
} else if (mesh.material instanceof
|
|
36993
|
+
} else if (mesh.material instanceof THREE36.Material) {
|
|
36912
36994
|
disposeTextureMaterial(mesh.material);
|
|
36913
36995
|
}
|
|
36914
36996
|
});
|
|
@@ -37141,12 +37223,12 @@ var CadViewerJscad = forwardRef3(
|
|
|
37141
37223
|
// src/CadViewerManifold.tsx
|
|
37142
37224
|
import { su as su17 } from "@tscircuit/circuit-json-util";
|
|
37143
37225
|
import { useEffect as useEffect26, useMemo as useMemo22, useState as useState16 } from "react";
|
|
37144
|
-
import * as
|
|
37226
|
+
import * as THREE43 from "three";
|
|
37145
37227
|
|
|
37146
37228
|
// src/hooks/useManifoldBoardBuilder.ts
|
|
37147
37229
|
import { su as su16 } from "@tscircuit/circuit-json-util";
|
|
37148
37230
|
import { useEffect as useEffect25, useMemo as useMemo21, useRef as useRef9, useState as useState15 } from "react";
|
|
37149
|
-
import * as
|
|
37231
|
+
import * as THREE40 from "three";
|
|
37150
37232
|
|
|
37151
37233
|
// src/utils/manifold/create-manifold-board.ts
|
|
37152
37234
|
var arePointsClockwise2 = (points) => {
|
|
@@ -37495,17 +37577,17 @@ function processNonPlatedHolesForManifold(Manifold, CrossSection, circuitJson, p
|
|
|
37495
37577
|
|
|
37496
37578
|
// src/utils/manifold/process-plated-holes.ts
|
|
37497
37579
|
import { su as su14 } from "@tscircuit/circuit-json-util";
|
|
37498
|
-
import * as
|
|
37580
|
+
import * as THREE38 from "three";
|
|
37499
37581
|
|
|
37500
37582
|
// src/utils/manifold-mesh-to-three-geometry.ts
|
|
37501
|
-
import * as
|
|
37583
|
+
import * as THREE37 from "three";
|
|
37502
37584
|
function manifoldMeshToThreeGeometry(manifoldMesh) {
|
|
37503
|
-
const geometry = new
|
|
37585
|
+
const geometry = new THREE37.BufferGeometry();
|
|
37504
37586
|
geometry.setAttribute(
|
|
37505
37587
|
"position",
|
|
37506
|
-
new
|
|
37588
|
+
new THREE37.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
|
|
37507
37589
|
);
|
|
37508
|
-
geometry.setIndex(new
|
|
37590
|
+
geometry.setIndex(new THREE37.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
|
|
37509
37591
|
if (manifoldMesh.runIndex && manifoldMesh.runIndex.length > 1 && manifoldMesh.runOriginalID) {
|
|
37510
37592
|
for (let i = 0; i < manifoldMesh.runIndex.length - 1; i++) {
|
|
37511
37593
|
const start = manifoldMesh.runIndex[i];
|
|
@@ -37539,7 +37621,7 @@ var createEllipsePoints = (width10, height10, segments) => {
|
|
|
37539
37621
|
}
|
|
37540
37622
|
return points;
|
|
37541
37623
|
};
|
|
37542
|
-
var COPPER_COLOR = new
|
|
37624
|
+
var COPPER_COLOR = new THREE38.Color(...colors.copper);
|
|
37543
37625
|
var PLATED_HOLE_LIP_HEIGHT = 0.05;
|
|
37544
37626
|
var PLATED_HOLE_PAD_THICKNESS = 3e-3;
|
|
37545
37627
|
var PLATED_HOLE_SURFACE_CLEARANCE = 5e-4;
|
|
@@ -38170,7 +38252,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
38170
38252
|
|
|
38171
38253
|
// src/utils/manifold/process-vias.ts
|
|
38172
38254
|
import { su as su15 } from "@tscircuit/circuit-json-util";
|
|
38173
|
-
import * as
|
|
38255
|
+
import * as THREE39 from "three";
|
|
38174
38256
|
|
|
38175
38257
|
// src/utils/via-geoms.ts
|
|
38176
38258
|
function createViaCopper2({
|
|
@@ -38208,7 +38290,7 @@ function createViaCopper2({
|
|
|
38208
38290
|
}
|
|
38209
38291
|
|
|
38210
38292
|
// src/utils/manifold/process-vias.ts
|
|
38211
|
-
var COPPER_COLOR2 = new
|
|
38293
|
+
var COPPER_COLOR2 = new THREE39.Color(...colors.copper);
|
|
38212
38294
|
function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, boardClipVolume) {
|
|
38213
38295
|
const viaBoardDrills = [];
|
|
38214
38296
|
const pcbVias = su15(circuitJson).pcb_via.list();
|
|
@@ -38428,7 +38510,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
38428
38510
|
{
|
|
38429
38511
|
key: "plated-holes-union",
|
|
38430
38512
|
geometry: cutPlatedGeom,
|
|
38431
|
-
color: new
|
|
38513
|
+
color: new THREE40.Color(
|
|
38432
38514
|
colors.copper[0],
|
|
38433
38515
|
colors.copper[1],
|
|
38434
38516
|
colors.copper[2]
|
|
@@ -38458,7 +38540,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
38458
38540
|
const matColorArray = boardMaterialColors[boardData.material] ?? colors.fr4Tan;
|
|
38459
38541
|
currentGeoms.board = {
|
|
38460
38542
|
geometry: finalBoardGeom,
|
|
38461
|
-
color: new
|
|
38543
|
+
color: new THREE40.Color(
|
|
38462
38544
|
matColorArray[0],
|
|
38463
38545
|
matColorArray[1],
|
|
38464
38546
|
matColorArray[2]
|
|
@@ -38503,11 +38585,11 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
38503
38585
|
};
|
|
38504
38586
|
|
|
38505
38587
|
// src/utils/manifold/create-three-geometry-meshes.ts
|
|
38506
|
-
import * as
|
|
38588
|
+
import * as THREE42 from "three";
|
|
38507
38589
|
|
|
38508
38590
|
// src/utils/create-board-material.ts
|
|
38509
|
-
import * as
|
|
38510
|
-
var DEFAULT_SIDE =
|
|
38591
|
+
import * as THREE41 from "three";
|
|
38592
|
+
var DEFAULT_SIDE = THREE41.DoubleSide;
|
|
38511
38593
|
var createBoardMaterial = ({
|
|
38512
38594
|
material,
|
|
38513
38595
|
color,
|
|
@@ -38515,7 +38597,7 @@ var createBoardMaterial = ({
|
|
|
38515
38597
|
isFaux = false
|
|
38516
38598
|
}) => {
|
|
38517
38599
|
if (material === "fr4") {
|
|
38518
|
-
return new
|
|
38600
|
+
return new THREE41.MeshPhysicalMaterial({
|
|
38519
38601
|
color,
|
|
38520
38602
|
side,
|
|
38521
38603
|
metalness: 0,
|
|
@@ -38532,7 +38614,7 @@ var createBoardMaterial = ({
|
|
|
38532
38614
|
polygonOffsetUnits: 1
|
|
38533
38615
|
});
|
|
38534
38616
|
}
|
|
38535
|
-
return new
|
|
38617
|
+
return new THREE41.MeshStandardMaterial({
|
|
38536
38618
|
color,
|
|
38537
38619
|
side,
|
|
38538
38620
|
flatShading: true,
|
|
@@ -38551,12 +38633,12 @@ function createGeometryMeshes(geoms) {
|
|
|
38551
38633
|
const meshes = [];
|
|
38552
38634
|
if (!geoms) return meshes;
|
|
38553
38635
|
if (geoms.board && geoms.board.geometry) {
|
|
38554
|
-
const mesh = new
|
|
38636
|
+
const mesh = new THREE42.Mesh(
|
|
38555
38637
|
geoms.board.geometry,
|
|
38556
38638
|
createBoardMaterial({
|
|
38557
38639
|
material: geoms.board.material,
|
|
38558
38640
|
color: geoms.board.color,
|
|
38559
|
-
side:
|
|
38641
|
+
side: THREE42.DoubleSide,
|
|
38560
38642
|
isFaux: geoms.board.isFaux
|
|
38561
38643
|
})
|
|
38562
38644
|
);
|
|
@@ -38566,11 +38648,11 @@ function createGeometryMeshes(geoms) {
|
|
|
38566
38648
|
const createMeshesFromArray = (geomArray) => {
|
|
38567
38649
|
if (geomArray) {
|
|
38568
38650
|
geomArray.forEach((comp) => {
|
|
38569
|
-
const mesh = new
|
|
38651
|
+
const mesh = new THREE42.Mesh(
|
|
38570
38652
|
comp.geometry,
|
|
38571
|
-
new
|
|
38653
|
+
new THREE42.MeshStandardMaterial({
|
|
38572
38654
|
color: comp.color,
|
|
38573
|
-
side:
|
|
38655
|
+
side: THREE42.DoubleSide,
|
|
38574
38656
|
flatShading: true
|
|
38575
38657
|
// Consistent with board
|
|
38576
38658
|
})
|
|
@@ -38614,7 +38696,7 @@ var BoardMeshes = ({
|
|
|
38614
38696
|
const typedMaterial = material;
|
|
38615
38697
|
for (const prop of textureProps) {
|
|
38616
38698
|
const texture = typedMaterial[prop];
|
|
38617
|
-
if (texture && texture instanceof
|
|
38699
|
+
if (texture && texture instanceof THREE43.Texture) {
|
|
38618
38700
|
texture.dispose();
|
|
38619
38701
|
typedMaterial[prop] = null;
|
|
38620
38702
|
}
|
|
@@ -39257,7 +39339,7 @@ var ToastProvider = ({
|
|
|
39257
39339
|
};
|
|
39258
39340
|
|
|
39259
39341
|
// src/components/ContextMenu.tsx
|
|
39260
|
-
import { useState as
|
|
39342
|
+
import { useState as useState35 } from "react";
|
|
39261
39343
|
|
|
39262
39344
|
// node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
39263
39345
|
import * as React43 from "react";
|
|
@@ -39317,6 +39399,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
39317
39399
|
let defaultContexts = [];
|
|
39318
39400
|
function createContext32(rootComponentName, defaultContext) {
|
|
39319
39401
|
const BaseContext = React13.createContext(defaultContext);
|
|
39402
|
+
BaseContext.displayName = rootComponentName + "Context";
|
|
39320
39403
|
const index2 = defaultContexts.length;
|
|
39321
39404
|
defaultContexts = [...defaultContexts, defaultContext];
|
|
39322
39405
|
const Provider = (props) => {
|
|
@@ -39452,52 +39535,69 @@ import * as ReactDOM2 from "react-dom";
|
|
|
39452
39535
|
|
|
39453
39536
|
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
39454
39537
|
import * as React16 from "react";
|
|
39455
|
-
import { Fragment as Fragment22, jsx as jsx21 } from "react/jsx-runtime";
|
|
39456
39538
|
// @__NO_SIDE_EFFECTS__
|
|
39457
39539
|
function createSlot(ownerName) {
|
|
39458
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
39459
39540
|
const Slot2 = React16.forwardRef((props, forwardedRef) => {
|
|
39460
|
-
|
|
39461
|
-
|
|
39462
|
-
|
|
39463
|
-
|
|
39464
|
-
|
|
39465
|
-
|
|
39466
|
-
|
|
39467
|
-
|
|
39468
|
-
|
|
39469
|
-
|
|
39470
|
-
|
|
39471
|
-
|
|
39472
|
-
|
|
39473
|
-
|
|
39541
|
+
let { children, ...slotProps } = props;
|
|
39542
|
+
let slottableElement = null;
|
|
39543
|
+
let hasSlottable = false;
|
|
39544
|
+
const newChildren = [];
|
|
39545
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
39546
|
+
children = use(children._payload);
|
|
39547
|
+
}
|
|
39548
|
+
React16.Children.forEach(children, (maybeSlottable) => {
|
|
39549
|
+
if (isSlottable(maybeSlottable)) {
|
|
39550
|
+
hasSlottable = true;
|
|
39551
|
+
const slottable = maybeSlottable;
|
|
39552
|
+
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
|
|
39553
|
+
if (isLazyComponent(child) && typeof use === "function") {
|
|
39554
|
+
child = use(child._payload);
|
|
39555
|
+
}
|
|
39556
|
+
slottableElement = getSlottableElementFromSlottable(slottable, child);
|
|
39557
|
+
newChildren.push(slottableElement?.props?.children);
|
|
39558
|
+
} else {
|
|
39559
|
+
newChildren.push(maybeSlottable);
|
|
39560
|
+
}
|
|
39561
|
+
});
|
|
39562
|
+
if (slottableElement) {
|
|
39563
|
+
slottableElement = React16.cloneElement(slottableElement, void 0, newChildren);
|
|
39564
|
+
} else if (
|
|
39565
|
+
// A `Slottable` was found but it didn't resolve to a single element (e.g.
|
|
39566
|
+
// it wrapped multiple elements, text, or a render-prop `child` that
|
|
39567
|
+
// wasn't an element). Don't fall back to treating the `Slottable` wrapper
|
|
39568
|
+
// itself as the slot target — throw a descriptive error below instead.
|
|
39569
|
+
!hasSlottable && React16.Children.count(children) === 1 && React16.isValidElement(children)
|
|
39570
|
+
) {
|
|
39571
|
+
slottableElement = children;
|
|
39572
|
+
}
|
|
39573
|
+
const slottableElementRef = slottableElement ? getElementRef(slottableElement) : void 0;
|
|
39574
|
+
const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
|
|
39575
|
+
if (!slottableElement) {
|
|
39576
|
+
if (children || children === 0) {
|
|
39577
|
+
throw new Error(
|
|
39578
|
+
hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName)
|
|
39579
|
+
);
|
|
39580
|
+
}
|
|
39581
|
+
return children;
|
|
39582
|
+
}
|
|
39583
|
+
const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
|
|
39584
|
+
if (slottableElement.type !== React16.Fragment) {
|
|
39585
|
+
mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
|
|
39474
39586
|
}
|
|
39475
|
-
return
|
|
39587
|
+
return React16.cloneElement(slottableElement, mergedProps);
|
|
39476
39588
|
});
|
|
39477
39589
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
39478
39590
|
return Slot2;
|
|
39479
39591
|
}
|
|
39480
|
-
|
|
39481
|
-
|
|
39482
|
-
|
|
39483
|
-
const
|
|
39484
|
-
if (React16.isValidElement(
|
|
39485
|
-
|
|
39486
|
-
|
|
39487
|
-
|
|
39488
|
-
|
|
39489
|
-
}
|
|
39490
|
-
return React16.cloneElement(children, props2);
|
|
39491
|
-
}
|
|
39492
|
-
return React16.Children.count(children) > 1 ? React16.Children.only(null) : null;
|
|
39493
|
-
});
|
|
39494
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
39495
|
-
return SlotClone;
|
|
39496
|
-
}
|
|
39497
|
-
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
39498
|
-
function isSlottable(child) {
|
|
39499
|
-
return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
39500
|
-
}
|
|
39592
|
+
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol.for("radix.slottable");
|
|
39593
|
+
var getSlottableElementFromSlottable = (slottable, child) => {
|
|
39594
|
+
if ("child" in slottable.props) {
|
|
39595
|
+
const child2 = slottable.props.child;
|
|
39596
|
+
if (!React16.isValidElement(child2)) return null;
|
|
39597
|
+
return React16.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
39598
|
+
}
|
|
39599
|
+
return React16.isValidElement(child) ? child : null;
|
|
39600
|
+
};
|
|
39501
39601
|
function mergeProps(slotProps, childProps) {
|
|
39502
39602
|
const overrideProps = { ...childProps };
|
|
39503
39603
|
for (const propName in childProps) {
|
|
@@ -39535,9 +39635,26 @@ function getElementRef(element) {
|
|
|
39535
39635
|
}
|
|
39536
39636
|
return element.props.ref || element.ref;
|
|
39537
39637
|
}
|
|
39638
|
+
function isSlottable(child) {
|
|
39639
|
+
return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
39640
|
+
}
|
|
39641
|
+
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
39642
|
+
function isLazyComponent(element) {
|
|
39643
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
39644
|
+
}
|
|
39645
|
+
function isPromiseLike(value) {
|
|
39646
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
39647
|
+
}
|
|
39648
|
+
var createSlotError = (ownerName) => {
|
|
39649
|
+
return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
|
|
39650
|
+
};
|
|
39651
|
+
var createSlottableError = (ownerName) => {
|
|
39652
|
+
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
39653
|
+
};
|
|
39654
|
+
var use = React16[" use ".trim().toString()];
|
|
39538
39655
|
|
|
39539
39656
|
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
39540
|
-
import { jsx as
|
|
39657
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
39541
39658
|
var NODES = [
|
|
39542
39659
|
"a",
|
|
39543
39660
|
"button",
|
|
@@ -39565,7 +39682,7 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
39565
39682
|
if (typeof window !== "undefined") {
|
|
39566
39683
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
39567
39684
|
}
|
|
39568
|
-
return /* @__PURE__ */
|
|
39685
|
+
return /* @__PURE__ */ jsx21(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
39569
39686
|
});
|
|
39570
39687
|
Node2.displayName = `Primitive.${node}`;
|
|
39571
39688
|
return { ...primitive, [node]: Node2 };
|
|
@@ -39578,10 +39695,10 @@ function dispatchDiscreteCustomEvent(target, event) {
|
|
|
39578
39695
|
import * as React42 from "react";
|
|
39579
39696
|
|
|
39580
39697
|
// node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
39581
|
-
import React18 from "react";
|
|
39698
|
+
import * as React18 from "react";
|
|
39699
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
39700
|
+
import * as React23 from "react";
|
|
39582
39701
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
39583
|
-
import React23 from "react";
|
|
39584
|
-
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
39585
39702
|
function createCollection(name) {
|
|
39586
39703
|
const PROVIDER_NAME = name + "CollectionProvider";
|
|
39587
39704
|
const [createCollectionContext, createCollectionScope3] = createContextScope(PROVIDER_NAME);
|
|
@@ -39593,7 +39710,7 @@ function createCollection(name) {
|
|
|
39593
39710
|
const { scope, children } = props;
|
|
39594
39711
|
const ref = React18.useRef(null);
|
|
39595
39712
|
const itemMap = React18.useRef(/* @__PURE__ */ new Map()).current;
|
|
39596
|
-
return /* @__PURE__ */
|
|
39713
|
+
return /* @__PURE__ */ jsx22(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
39597
39714
|
};
|
|
39598
39715
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
39599
39716
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
@@ -39603,7 +39720,7 @@ function createCollection(name) {
|
|
|
39603
39720
|
const { scope, children } = props;
|
|
39604
39721
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
39605
39722
|
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
39606
|
-
return /* @__PURE__ */
|
|
39723
|
+
return /* @__PURE__ */ jsx22(CollectionSlotImpl, { ref: composedRefs, children });
|
|
39607
39724
|
}
|
|
39608
39725
|
);
|
|
39609
39726
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
@@ -39620,7 +39737,7 @@ function createCollection(name) {
|
|
|
39620
39737
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
39621
39738
|
return () => void context.itemMap.delete(ref);
|
|
39622
39739
|
});
|
|
39623
|
-
return /* @__PURE__ */
|
|
39740
|
+
return /* @__PURE__ */ jsx22(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
39624
39741
|
}
|
|
39625
39742
|
);
|
|
39626
39743
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
@@ -39647,7 +39764,7 @@ function createCollection(name) {
|
|
|
39647
39764
|
|
|
39648
39765
|
// node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
39649
39766
|
import * as React19 from "react";
|
|
39650
|
-
import { jsx as
|
|
39767
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
39651
39768
|
var DirectionContext = React19.createContext(void 0);
|
|
39652
39769
|
function useDirection(localDir) {
|
|
39653
39770
|
const globalDir = React19.useContext(DirectionContext);
|
|
@@ -39664,7 +39781,7 @@ function useCallbackRef(callback) {
|
|
|
39664
39781
|
React20.useEffect(() => {
|
|
39665
39782
|
callbackRef.current = callback;
|
|
39666
39783
|
});
|
|
39667
|
-
return React20.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
39784
|
+
return React20.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
|
|
39668
39785
|
}
|
|
39669
39786
|
|
|
39670
39787
|
// node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
|
|
@@ -39683,7 +39800,7 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
39683
39800
|
}
|
|
39684
39801
|
|
|
39685
39802
|
// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
39686
|
-
import { jsx as
|
|
39803
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
39687
39804
|
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
39688
39805
|
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
39689
39806
|
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
@@ -39692,12 +39809,19 @@ var originalBodyPointerEvents;
|
|
|
39692
39809
|
var DismissableLayerContext = React24.createContext({
|
|
39693
39810
|
layers: /* @__PURE__ */ new Set(),
|
|
39694
39811
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
39695
|
-
branches: /* @__PURE__ */ new Set()
|
|
39812
|
+
branches: /* @__PURE__ */ new Set(),
|
|
39813
|
+
// Outside elements that belong to a layer's own dismiss affordance (eg, a
|
|
39814
|
+
// dialog overlay). Pressing them should dismiss the layer regardless of
|
|
39815
|
+
// whether or not they stop propagation.
|
|
39816
|
+
//
|
|
39817
|
+
// See https://github.com/radix-ui/primitives/issues/3346
|
|
39818
|
+
dismissableSurfaces: /* @__PURE__ */ new Set()
|
|
39696
39819
|
});
|
|
39697
39820
|
var DismissableLayer = React24.forwardRef(
|
|
39698
39821
|
(props, forwardedRef) => {
|
|
39699
39822
|
const {
|
|
39700
39823
|
disableOutsidePointerEvents = false,
|
|
39824
|
+
deferPointerDownOutside = false,
|
|
39701
39825
|
onEscapeKeyDown,
|
|
39702
39826
|
onPointerDownOutside,
|
|
39703
39827
|
onFocusOutside,
|
|
@@ -39716,15 +39840,32 @@ var DismissableLayer = React24.forwardRef(
|
|
|
39716
39840
|
const index2 = node ? layers.indexOf(node) : -1;
|
|
39717
39841
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
39718
39842
|
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
39719
|
-
const
|
|
39720
|
-
|
|
39721
|
-
|
|
39722
|
-
|
|
39723
|
-
|
|
39724
|
-
|
|
39725
|
-
|
|
39726
|
-
|
|
39843
|
+
const isDeferredPointerDownOutsideRef = React24.useRef(false);
|
|
39844
|
+
const pointerDownOutside = usePointerDownOutside(
|
|
39845
|
+
(event) => {
|
|
39846
|
+
const target = event.target;
|
|
39847
|
+
if (!(target instanceof Node)) {
|
|
39848
|
+
return;
|
|
39849
|
+
}
|
|
39850
|
+
const isPointerDownOnBranch = [...context.branches].some(
|
|
39851
|
+
(branch) => branch.contains(target)
|
|
39852
|
+
);
|
|
39853
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
39854
|
+
onPointerDownOutside?.(event);
|
|
39855
|
+
onInteractOutside?.(event);
|
|
39856
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
39857
|
+
},
|
|
39858
|
+
{
|
|
39859
|
+
ownerDocument,
|
|
39860
|
+
deferPointerDownOutside,
|
|
39861
|
+
isDeferredPointerDownOutsideRef,
|
|
39862
|
+
dismissableSurfaces: context.dismissableSurfaces
|
|
39863
|
+
}
|
|
39864
|
+
);
|
|
39727
39865
|
const focusOutside = useFocusOutside((event) => {
|
|
39866
|
+
if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) {
|
|
39867
|
+
return;
|
|
39868
|
+
}
|
|
39728
39869
|
const target = event.target;
|
|
39729
39870
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
39730
39871
|
if (isFocusInBranch) return;
|
|
@@ -39753,8 +39894,11 @@ var DismissableLayer = React24.forwardRef(
|
|
|
39753
39894
|
context.layers.add(node);
|
|
39754
39895
|
dispatchUpdate();
|
|
39755
39896
|
return () => {
|
|
39756
|
-
if (disableOutsidePointerEvents
|
|
39757
|
-
|
|
39897
|
+
if (disableOutsidePointerEvents) {
|
|
39898
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
39899
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
39900
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
39901
|
+
}
|
|
39758
39902
|
}
|
|
39759
39903
|
};
|
|
39760
39904
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
@@ -39771,7 +39915,7 @@ var DismissableLayer = React24.forwardRef(
|
|
|
39771
39915
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
39772
39916
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
39773
39917
|
}, []);
|
|
39774
|
-
return /* @__PURE__ */
|
|
39918
|
+
return /* @__PURE__ */ jsx25(
|
|
39775
39919
|
Primitive.div,
|
|
39776
39920
|
{
|
|
39777
39921
|
...layerProps,
|
|
@@ -39805,39 +39949,98 @@ var DismissableLayerBranch = React24.forwardRef((props, forwardedRef) => {
|
|
|
39805
39949
|
};
|
|
39806
39950
|
}
|
|
39807
39951
|
}, [context.branches]);
|
|
39808
|
-
return /* @__PURE__ */
|
|
39952
|
+
return /* @__PURE__ */ jsx25(Primitive.div, { ...props, ref: composedRefs });
|
|
39809
39953
|
});
|
|
39810
39954
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
39811
|
-
function usePointerDownOutside(onPointerDownOutside,
|
|
39955
|
+
function usePointerDownOutside(onPointerDownOutside, args) {
|
|
39956
|
+
const {
|
|
39957
|
+
ownerDocument = globalThis?.document,
|
|
39958
|
+
deferPointerDownOutside = false,
|
|
39959
|
+
isDeferredPointerDownOutsideRef,
|
|
39960
|
+
dismissableSurfaces
|
|
39961
|
+
} = args;
|
|
39812
39962
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
39813
39963
|
const isPointerInsideReactTreeRef = React24.useRef(false);
|
|
39964
|
+
const isPointerDownOutsideRef = React24.useRef(false);
|
|
39965
|
+
const interceptedOutsideInteractionEventsRef = React24.useRef(/* @__PURE__ */ new Map());
|
|
39814
39966
|
const handleClickRef = React24.useRef(() => {
|
|
39815
39967
|
});
|
|
39816
39968
|
React24.useEffect(() => {
|
|
39969
|
+
function resetOutsideInteraction() {
|
|
39970
|
+
isPointerDownOutsideRef.current = false;
|
|
39971
|
+
isDeferredPointerDownOutsideRef.current = false;
|
|
39972
|
+
interceptedOutsideInteractionEventsRef.current.clear();
|
|
39973
|
+
}
|
|
39974
|
+
function isOutsideInteractionIntercepted() {
|
|
39975
|
+
return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);
|
|
39976
|
+
}
|
|
39977
|
+
function handleInteractionCapture(event) {
|
|
39978
|
+
if (!isPointerDownOutsideRef.current) {
|
|
39979
|
+
return;
|
|
39980
|
+
}
|
|
39981
|
+
const target = event.target;
|
|
39982
|
+
const isDismissableSurface = target instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target));
|
|
39983
|
+
if (!isDismissableSurface) {
|
|
39984
|
+
interceptedOutsideInteractionEventsRef.current.set(event.type, true);
|
|
39985
|
+
}
|
|
39986
|
+
if (event.type === "click") {
|
|
39987
|
+
window.setTimeout(() => {
|
|
39988
|
+
if (isPointerDownOutsideRef.current) {
|
|
39989
|
+
handleClickRef.current();
|
|
39990
|
+
}
|
|
39991
|
+
}, 0);
|
|
39992
|
+
}
|
|
39993
|
+
}
|
|
39994
|
+
function handleInteractionBubble(event) {
|
|
39995
|
+
if (isPointerDownOutsideRef.current) {
|
|
39996
|
+
interceptedOutsideInteractionEventsRef.current.set(event.type, false);
|
|
39997
|
+
}
|
|
39998
|
+
}
|
|
39817
39999
|
const handlePointerDown = (event) => {
|
|
39818
40000
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
39819
40001
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
39820
|
-
|
|
39821
|
-
|
|
39822
|
-
|
|
39823
|
-
|
|
39824
|
-
|
|
39825
|
-
|
|
40002
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
40003
|
+
const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted();
|
|
40004
|
+
resetOutsideInteraction();
|
|
40005
|
+
if (!wasOutsideInteractionIntercepted) {
|
|
40006
|
+
handleAndDispatchCustomEvent(
|
|
40007
|
+
POINTER_DOWN_OUTSIDE,
|
|
40008
|
+
handlePointerDownOutside,
|
|
40009
|
+
eventDetail,
|
|
40010
|
+
{ discrete: true }
|
|
40011
|
+
);
|
|
40012
|
+
}
|
|
39826
40013
|
};
|
|
39827
40014
|
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
39828
40015
|
const eventDetail = { originalEvent: event };
|
|
39829
|
-
|
|
40016
|
+
isPointerDownOutsideRef.current = true;
|
|
40017
|
+
isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;
|
|
40018
|
+
interceptedOutsideInteractionEventsRef.current.clear();
|
|
40019
|
+
if (!deferPointerDownOutside || event.button !== 0) {
|
|
40020
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
40021
|
+
} else {
|
|
39830
40022
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
39831
40023
|
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
39832
40024
|
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
39833
|
-
} else {
|
|
39834
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
39835
40025
|
}
|
|
39836
40026
|
} else {
|
|
39837
40027
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
40028
|
+
resetOutsideInteraction();
|
|
39838
40029
|
}
|
|
39839
40030
|
isPointerInsideReactTreeRef.current = false;
|
|
39840
40031
|
};
|
|
40032
|
+
const outsideInteractionEvents = [
|
|
40033
|
+
"pointerup",
|
|
40034
|
+
"mousedown",
|
|
40035
|
+
"mouseup",
|
|
40036
|
+
"touchstart",
|
|
40037
|
+
"touchend",
|
|
40038
|
+
"click"
|
|
40039
|
+
];
|
|
40040
|
+
for (const eventName of outsideInteractionEvents) {
|
|
40041
|
+
ownerDocument.addEventListener(eventName, handleInteractionCapture, true);
|
|
40042
|
+
ownerDocument.addEventListener(eventName, handleInteractionBubble);
|
|
40043
|
+
}
|
|
39841
40044
|
const timerId = window.setTimeout(() => {
|
|
39842
40045
|
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
39843
40046
|
}, 0);
|
|
@@ -39845,8 +40048,18 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
|
|
|
39845
40048
|
window.clearTimeout(timerId);
|
|
39846
40049
|
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
39847
40050
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
40051
|
+
for (const eventName of outsideInteractionEvents) {
|
|
40052
|
+
ownerDocument.removeEventListener(eventName, handleInteractionCapture, true);
|
|
40053
|
+
ownerDocument.removeEventListener(eventName, handleInteractionBubble);
|
|
40054
|
+
}
|
|
39848
40055
|
};
|
|
39849
|
-
}, [
|
|
40056
|
+
}, [
|
|
40057
|
+
ownerDocument,
|
|
40058
|
+
handlePointerDownOutside,
|
|
40059
|
+
deferPointerDownOutside,
|
|
40060
|
+
isDeferredPointerDownOutsideRef,
|
|
40061
|
+
dismissableSurfaces
|
|
40062
|
+
]);
|
|
39850
40063
|
return {
|
|
39851
40064
|
// ensures we check React component tree (not just DOM tree)
|
|
39852
40065
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
@@ -39890,17 +40103,27 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
39890
40103
|
// node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
39891
40104
|
import * as React25 from "react";
|
|
39892
40105
|
var count = 0;
|
|
40106
|
+
var guards = null;
|
|
39893
40107
|
function useFocusGuards() {
|
|
39894
40108
|
React25.useEffect(() => {
|
|
39895
|
-
|
|
39896
|
-
|
|
39897
|
-
|
|
40109
|
+
if (!guards) {
|
|
40110
|
+
guards = { start: createFocusGuard(), end: createFocusGuard() };
|
|
40111
|
+
}
|
|
40112
|
+
const { start, end } = guards;
|
|
40113
|
+
if (document.body.firstElementChild !== start) {
|
|
40114
|
+
document.body.insertAdjacentElement("afterbegin", start);
|
|
40115
|
+
}
|
|
40116
|
+
if (document.body.lastElementChild !== end) {
|
|
40117
|
+
document.body.insertAdjacentElement("beforeend", end);
|
|
40118
|
+
}
|
|
39898
40119
|
count++;
|
|
39899
40120
|
return () => {
|
|
39900
40121
|
if (count === 1) {
|
|
39901
|
-
|
|
40122
|
+
guards?.start.remove();
|
|
40123
|
+
guards?.end.remove();
|
|
40124
|
+
guards = null;
|
|
39902
40125
|
}
|
|
39903
|
-
count
|
|
40126
|
+
count = Math.max(0, count - 1);
|
|
39904
40127
|
};
|
|
39905
40128
|
}, []);
|
|
39906
40129
|
}
|
|
@@ -39917,7 +40140,7 @@ function createFocusGuard() {
|
|
|
39917
40140
|
|
|
39918
40141
|
// node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
39919
40142
|
import * as React26 from "react";
|
|
39920
|
-
import { jsx as
|
|
40143
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
39921
40144
|
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
39922
40145
|
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
39923
40146
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
@@ -40036,7 +40259,7 @@ var FocusScope = React26.forwardRef((props, forwardedRef) => {
|
|
|
40036
40259
|
},
|
|
40037
40260
|
[loop, trapped, focusScope.paused]
|
|
40038
40261
|
);
|
|
40039
|
-
return /* @__PURE__ */
|
|
40262
|
+
return /* @__PURE__ */ jsx26(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
40040
40263
|
});
|
|
40041
40264
|
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
40042
40265
|
function focusFirst(candidates, { select = false } = {}) {
|
|
@@ -42064,11 +42287,11 @@ var arrow3 = (options, deps) => {
|
|
|
42064
42287
|
|
|
42065
42288
|
// node_modules/@radix-ui/react-arrow/dist/index.mjs
|
|
42066
42289
|
import * as React29 from "react";
|
|
42067
|
-
import { jsx as
|
|
42290
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
42068
42291
|
var NAME = "Arrow";
|
|
42069
42292
|
var Arrow = React29.forwardRef((props, forwardedRef) => {
|
|
42070
42293
|
const { children, width: width10 = 10, height: height10 = 5, ...arrowProps } = props;
|
|
42071
|
-
return /* @__PURE__ */
|
|
42294
|
+
return /* @__PURE__ */ jsx27(
|
|
42072
42295
|
Primitive.svg,
|
|
42073
42296
|
{
|
|
42074
42297
|
...arrowProps,
|
|
@@ -42077,7 +42300,7 @@ var Arrow = React29.forwardRef((props, forwardedRef) => {
|
|
|
42077
42300
|
height: height10,
|
|
42078
42301
|
viewBox: "0 0 30 10",
|
|
42079
42302
|
preserveAspectRatio: "none",
|
|
42080
|
-
children: props.asChild ? children : /* @__PURE__ */
|
|
42303
|
+
children: props.asChild ? children : /* @__PURE__ */ jsx27("polygon", { points: "0,0 30,0 15,10" })
|
|
42081
42304
|
}
|
|
42082
42305
|
);
|
|
42083
42306
|
});
|
|
@@ -42122,14 +42345,25 @@ function useSize(element) {
|
|
|
42122
42345
|
}
|
|
42123
42346
|
|
|
42124
42347
|
// node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
42125
|
-
import { jsx as
|
|
42348
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
42126
42349
|
var POPPER_NAME = "Popper";
|
|
42127
42350
|
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
42128
42351
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
42129
42352
|
var Popper = (props) => {
|
|
42130
42353
|
const { __scopePopper, children } = props;
|
|
42131
42354
|
const [anchor, setAnchor] = React31.useState(null);
|
|
42132
|
-
|
|
42355
|
+
const [placementState, setPlacementState] = React31.useState(void 0);
|
|
42356
|
+
return /* @__PURE__ */ jsx28(
|
|
42357
|
+
PopperProvider,
|
|
42358
|
+
{
|
|
42359
|
+
scope: __scopePopper,
|
|
42360
|
+
anchor,
|
|
42361
|
+
onAnchorChange: setAnchor,
|
|
42362
|
+
placementState,
|
|
42363
|
+
setPlacementState,
|
|
42364
|
+
children
|
|
42365
|
+
}
|
|
42366
|
+
);
|
|
42133
42367
|
};
|
|
42134
42368
|
Popper.displayName = POPPER_NAME;
|
|
42135
42369
|
var ANCHOR_NAME = "PopperAnchor";
|
|
@@ -42138,16 +42372,40 @@ var PopperAnchor = React31.forwardRef(
|
|
|
42138
42372
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
42139
42373
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
42140
42374
|
const ref = React31.useRef(null);
|
|
42141
|
-
const
|
|
42375
|
+
const onAnchorChange = context.onAnchorChange;
|
|
42376
|
+
const callbackRef = React31.useCallback(
|
|
42377
|
+
(node) => {
|
|
42378
|
+
ref.current = node;
|
|
42379
|
+
if (node) {
|
|
42380
|
+
onAnchorChange(node);
|
|
42381
|
+
}
|
|
42382
|
+
},
|
|
42383
|
+
[onAnchorChange]
|
|
42384
|
+
);
|
|
42385
|
+
const composedRefs = useComposedRefs(forwardedRef, callbackRef);
|
|
42142
42386
|
const anchorRef = React31.useRef(null);
|
|
42143
42387
|
React31.useEffect(() => {
|
|
42388
|
+
if (!virtualRef) {
|
|
42389
|
+
return;
|
|
42390
|
+
}
|
|
42144
42391
|
const previousAnchor = anchorRef.current;
|
|
42145
|
-
anchorRef.current = virtualRef
|
|
42392
|
+
anchorRef.current = virtualRef.current;
|
|
42146
42393
|
if (previousAnchor !== anchorRef.current) {
|
|
42147
|
-
|
|
42394
|
+
onAnchorChange(anchorRef.current);
|
|
42148
42395
|
}
|
|
42149
42396
|
});
|
|
42150
|
-
|
|
42397
|
+
const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState);
|
|
42398
|
+
const placedSide = sideAndAlign?.[0];
|
|
42399
|
+
const placedAlign = sideAndAlign?.[1];
|
|
42400
|
+
return virtualRef ? null : /* @__PURE__ */ jsx28(
|
|
42401
|
+
Primitive.div,
|
|
42402
|
+
{
|
|
42403
|
+
"data-radix-popper-side": placedSide,
|
|
42404
|
+
"data-radix-popper-align": placedAlign,
|
|
42405
|
+
...anchorProps,
|
|
42406
|
+
ref: composedRefs
|
|
42407
|
+
}
|
|
42408
|
+
);
|
|
42151
42409
|
}
|
|
42152
42410
|
);
|
|
42153
42411
|
PopperAnchor.displayName = ANCHOR_NAME;
|
|
@@ -42223,9 +42481,27 @@ var PopperContent = React31.forwardRef(
|
|
|
42223
42481
|
}),
|
|
42224
42482
|
arrow4 && arrow3({ element: arrow4, padding: arrowPadding }),
|
|
42225
42483
|
transformOrigin({ arrowWidth, arrowHeight }),
|
|
42226
|
-
hideWhenDetached && hide3({
|
|
42484
|
+
hideWhenDetached && hide3({
|
|
42485
|
+
strategy: "referenceHidden",
|
|
42486
|
+
...detectOverflowOptions,
|
|
42487
|
+
// `hide` detects whether the anchor (reference) is clipped, so when
|
|
42488
|
+
// no explicit `collisionBoundary` is set we fall back to Floating
|
|
42489
|
+
// UI's default clipping ancestors (e.g. a scrollable menu). This
|
|
42490
|
+
// lets an occluded submenu hide once its anchor scrolls out of view
|
|
42491
|
+
// (#3237). The collision/size middlewares deliberately keep the
|
|
42492
|
+
// viewport-based default to avoid clamping content rendered inside
|
|
42493
|
+
// transformed or overflow-clipping portal containers.
|
|
42494
|
+
boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : void 0
|
|
42495
|
+
})
|
|
42227
42496
|
]
|
|
42228
42497
|
});
|
|
42498
|
+
const setPlacementState = context.setPlacementState;
|
|
42499
|
+
useLayoutEffect2(() => {
|
|
42500
|
+
setPlacementState(placement);
|
|
42501
|
+
return () => {
|
|
42502
|
+
setPlacementState(void 0);
|
|
42503
|
+
};
|
|
42504
|
+
}, [placement, setPlacementState]);
|
|
42229
42505
|
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
42230
42506
|
const handlePlaced = useCallbackRef(onPlaced);
|
|
42231
42507
|
useLayoutEffect2(() => {
|
|
@@ -42240,7 +42516,7 @@ var PopperContent = React31.forwardRef(
|
|
|
42240
42516
|
useLayoutEffect2(() => {
|
|
42241
42517
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
42242
42518
|
}, [content]);
|
|
42243
|
-
return /* @__PURE__ */
|
|
42519
|
+
return /* @__PURE__ */ jsx28(
|
|
42244
42520
|
"div",
|
|
42245
42521
|
{
|
|
42246
42522
|
ref: refs.setFloating,
|
|
@@ -42251,7 +42527,7 @@ var PopperContent = React31.forwardRef(
|
|
|
42251
42527
|
// keep off the page when measuring
|
|
42252
42528
|
minWidth: "max-content",
|
|
42253
42529
|
zIndex: contentZIndex,
|
|
42254
|
-
|
|
42530
|
+
"--radix-popper-transform-origin": [
|
|
42255
42531
|
middlewareData.transformOrigin?.x,
|
|
42256
42532
|
middlewareData.transformOrigin?.y
|
|
42257
42533
|
].join(" "),
|
|
@@ -42264,16 +42540,17 @@ var PopperContent = React31.forwardRef(
|
|
|
42264
42540
|
}
|
|
42265
42541
|
},
|
|
42266
42542
|
dir: props.dir,
|
|
42267
|
-
children: /* @__PURE__ */
|
|
42543
|
+
children: /* @__PURE__ */ jsx28(
|
|
42268
42544
|
PopperContentProvider,
|
|
42269
42545
|
{
|
|
42270
42546
|
scope: __scopePopper,
|
|
42271
42547
|
placedSide,
|
|
42548
|
+
placedAlign,
|
|
42272
42549
|
onArrowChange: setArrow,
|
|
42273
42550
|
arrowX,
|
|
42274
42551
|
arrowY,
|
|
42275
42552
|
shouldHideArrow: cannotCenterArrow,
|
|
42276
|
-
children: /* @__PURE__ */
|
|
42553
|
+
children: /* @__PURE__ */ jsx28(
|
|
42277
42554
|
Primitive.div,
|
|
42278
42555
|
{
|
|
42279
42556
|
"data-side": placedSide,
|
|
@@ -42310,7 +42587,7 @@ var PopperArrow = React31.forwardRef(function PopperArrow2(props, forwardedRef)
|
|
|
42310
42587
|
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
42311
42588
|
// doesn't report size as we'd expect on SVG elements.
|
|
42312
42589
|
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
42313
|
-
/* @__PURE__ */
|
|
42590
|
+
/* @__PURE__ */ jsx28(
|
|
42314
42591
|
"span",
|
|
42315
42592
|
{
|
|
42316
42593
|
ref: contentContext.onArrowChange,
|
|
@@ -42333,7 +42610,7 @@ var PopperArrow = React31.forwardRef(function PopperArrow2(props, forwardedRef)
|
|
|
42333
42610
|
}[contentContext.placedSide],
|
|
42334
42611
|
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
42335
42612
|
},
|
|
42336
|
-
children: /* @__PURE__ */
|
|
42613
|
+
children: /* @__PURE__ */ jsx28(
|
|
42337
42614
|
Root,
|
|
42338
42615
|
{
|
|
42339
42616
|
...arrowProps,
|
|
@@ -42395,15 +42672,15 @@ var Arrow2 = PopperArrow;
|
|
|
42395
42672
|
|
|
42396
42673
|
// node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
42397
42674
|
import * as React32 from "react";
|
|
42398
|
-
import ReactDOM4 from "react-dom";
|
|
42399
|
-
import { jsx as
|
|
42675
|
+
import * as ReactDOM4 from "react-dom";
|
|
42676
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
42400
42677
|
var PORTAL_NAME = "Portal";
|
|
42401
42678
|
var Portal = React32.forwardRef((props, forwardedRef) => {
|
|
42402
42679
|
const { container: containerProp, ...portalProps } = props;
|
|
42403
42680
|
const [mounted, setMounted] = React32.useState(false);
|
|
42404
42681
|
useLayoutEffect2(() => setMounted(true), []);
|
|
42405
42682
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
42406
|
-
return container ? ReactDOM4.createPortal(/* @__PURE__ */
|
|
42683
|
+
return container ? ReactDOM4.createPortal(/* @__PURE__ */ jsx29(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
42407
42684
|
});
|
|
42408
42685
|
Portal.displayName = PORTAL_NAME;
|
|
42409
42686
|
|
|
@@ -42420,7 +42697,7 @@ var Presence = (props) => {
|
|
|
42420
42697
|
const { present, children } = props;
|
|
42421
42698
|
const presence = usePresence(present);
|
|
42422
42699
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React210.Children.only(children);
|
|
42423
|
-
const ref =
|
|
42700
|
+
const ref = useStableComposedRefs(presence.ref, getElementRef2(child));
|
|
42424
42701
|
const forceMount = typeof children === "function";
|
|
42425
42702
|
return forceMount || presence.isPresent ? React210.cloneElement(child, { ref }) : null;
|
|
42426
42703
|
};
|
|
@@ -42516,6 +42793,40 @@ function usePresence(present) {
|
|
|
42516
42793
|
}, [])
|
|
42517
42794
|
};
|
|
42518
42795
|
}
|
|
42796
|
+
function setRef2(ref, value) {
|
|
42797
|
+
if (typeof ref === "function") {
|
|
42798
|
+
return ref(value);
|
|
42799
|
+
} else if (ref !== null && ref !== void 0) {
|
|
42800
|
+
ref.current = value;
|
|
42801
|
+
}
|
|
42802
|
+
}
|
|
42803
|
+
function useStableComposedRefs(...refs) {
|
|
42804
|
+
const refsRef = React210.useRef(refs);
|
|
42805
|
+
refsRef.current = refs;
|
|
42806
|
+
return React210.useCallback((node) => {
|
|
42807
|
+
const currentRefs = refsRef.current;
|
|
42808
|
+
let hasCleanup = false;
|
|
42809
|
+
const cleanups = currentRefs.map((ref) => {
|
|
42810
|
+
const cleanup = setRef2(ref, node);
|
|
42811
|
+
if (!hasCleanup && typeof cleanup === "function") {
|
|
42812
|
+
hasCleanup = true;
|
|
42813
|
+
}
|
|
42814
|
+
return cleanup;
|
|
42815
|
+
});
|
|
42816
|
+
if (hasCleanup) {
|
|
42817
|
+
return () => {
|
|
42818
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
42819
|
+
const cleanup = cleanups[i];
|
|
42820
|
+
if (typeof cleanup === "function") {
|
|
42821
|
+
cleanup();
|
|
42822
|
+
} else {
|
|
42823
|
+
setRef2(currentRefs[i], null);
|
|
42824
|
+
}
|
|
42825
|
+
}
|
|
42826
|
+
};
|
|
42827
|
+
}
|
|
42828
|
+
}, []);
|
|
42829
|
+
}
|
|
42519
42830
|
function getAnimationName(styles) {
|
|
42520
42831
|
return styles?.animationName || "none";
|
|
42521
42832
|
}
|
|
@@ -42535,7 +42846,7 @@ function getElementRef2(element) {
|
|
|
42535
42846
|
|
|
42536
42847
|
// node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
42537
42848
|
import * as React34 from "react";
|
|
42538
|
-
import { jsx as
|
|
42849
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
42539
42850
|
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
42540
42851
|
var EVENT_OPTIONS2 = { bubbles: false, cancelable: true };
|
|
42541
42852
|
var GROUP_NAME = "RovingFocusGroup";
|
|
@@ -42547,7 +42858,7 @@ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContext
|
|
|
42547
42858
|
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
42548
42859
|
var RovingFocusGroup = React34.forwardRef(
|
|
42549
42860
|
(props, forwardedRef) => {
|
|
42550
|
-
return /* @__PURE__ */
|
|
42861
|
+
return /* @__PURE__ */ jsx30(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx30(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx30(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
42551
42862
|
}
|
|
42552
42863
|
);
|
|
42553
42864
|
RovingFocusGroup.displayName = GROUP_NAME;
|
|
@@ -42585,7 +42896,7 @@ var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
42585
42896
|
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
42586
42897
|
}
|
|
42587
42898
|
}, [handleEntryFocus]);
|
|
42588
|
-
return /* @__PURE__ */
|
|
42899
|
+
return /* @__PURE__ */ jsx30(
|
|
42589
42900
|
RovingFocusProvider,
|
|
42590
42901
|
{
|
|
42591
42902
|
scope: __scopeRovingFocusGroup,
|
|
@@ -42606,7 +42917,7 @@ var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
42606
42917
|
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
42607
42918
|
[]
|
|
42608
42919
|
),
|
|
42609
|
-
children: /* @__PURE__ */
|
|
42920
|
+
children: /* @__PURE__ */ jsx30(
|
|
42610
42921
|
Primitive.div,
|
|
42611
42922
|
{
|
|
42612
42923
|
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
@@ -42664,14 +42975,14 @@ var RovingFocusGroupItem = React34.forwardRef(
|
|
|
42664
42975
|
return () => onFocusableItemRemove();
|
|
42665
42976
|
}
|
|
42666
42977
|
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
42667
|
-
return /* @__PURE__ */
|
|
42978
|
+
return /* @__PURE__ */ jsx30(
|
|
42668
42979
|
Collection.ItemSlot,
|
|
42669
42980
|
{
|
|
42670
42981
|
scope: __scopeRovingFocusGroup,
|
|
42671
42982
|
id,
|
|
42672
42983
|
focusable,
|
|
42673
42984
|
active,
|
|
42674
|
-
children: /* @__PURE__ */
|
|
42985
|
+
children: /* @__PURE__ */ jsx30(
|
|
42675
42986
|
Primitive.span,
|
|
42676
42987
|
{
|
|
42677
42988
|
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
@@ -42922,9 +43233,9 @@ function assignRef(ref, value) {
|
|
|
42922
43233
|
}
|
|
42923
43234
|
|
|
42924
43235
|
// node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
42925
|
-
import { useState as
|
|
43236
|
+
import { useState as useState30 } from "react";
|
|
42926
43237
|
function useCallbackRef2(initialValue, callback) {
|
|
42927
|
-
var ref =
|
|
43238
|
+
var ref = useState30(function() {
|
|
42928
43239
|
return {
|
|
42929
43240
|
// value
|
|
42930
43241
|
value: initialValue,
|
|
@@ -43588,7 +43899,7 @@ ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
|
43588
43899
|
var Combination_default = ReactRemoveScroll;
|
|
43589
43900
|
|
|
43590
43901
|
// node_modules/@radix-ui/react-menu/dist/index.mjs
|
|
43591
|
-
import { jsx as
|
|
43902
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
43592
43903
|
var SELECTION_KEYS = ["Enter", " "];
|
|
43593
43904
|
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
43594
43905
|
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
@@ -43633,7 +43944,15 @@ var Menu = (props) => {
|
|
|
43633
43944
|
document.removeEventListener("pointermove", handlePointer, { capture: true });
|
|
43634
43945
|
};
|
|
43635
43946
|
}, []);
|
|
43636
|
-
|
|
43947
|
+
React42.useEffect(() => {
|
|
43948
|
+
if (!open) {
|
|
43949
|
+
return;
|
|
43950
|
+
}
|
|
43951
|
+
const handleBlur = () => handleOpenChange(false);
|
|
43952
|
+
window.addEventListener("blur", handleBlur);
|
|
43953
|
+
return () => window.removeEventListener("blur", handleBlur);
|
|
43954
|
+
}, [open, handleOpenChange]);
|
|
43955
|
+
return /* @__PURE__ */ jsx31(Root2, { ...popperScope, children: /* @__PURE__ */ jsx31(
|
|
43637
43956
|
MenuProvider,
|
|
43638
43957
|
{
|
|
43639
43958
|
scope: __scopeMenu,
|
|
@@ -43641,7 +43960,7 @@ var Menu = (props) => {
|
|
|
43641
43960
|
onOpenChange: handleOpenChange,
|
|
43642
43961
|
content,
|
|
43643
43962
|
onContentChange: setContent,
|
|
43644
|
-
children: /* @__PURE__ */
|
|
43963
|
+
children: /* @__PURE__ */ jsx31(
|
|
43645
43964
|
MenuRootProvider,
|
|
43646
43965
|
{
|
|
43647
43966
|
scope: __scopeMenu,
|
|
@@ -43661,7 +43980,7 @@ var MenuAnchor = React42.forwardRef(
|
|
|
43661
43980
|
(props, forwardedRef) => {
|
|
43662
43981
|
const { __scopeMenu, ...anchorProps } = props;
|
|
43663
43982
|
const popperScope = usePopperScope(__scopeMenu);
|
|
43664
|
-
return /* @__PURE__ */
|
|
43983
|
+
return /* @__PURE__ */ jsx31(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
43665
43984
|
}
|
|
43666
43985
|
);
|
|
43667
43986
|
MenuAnchor.displayName = ANCHOR_NAME2;
|
|
@@ -43672,7 +43991,7 @@ var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME2, {
|
|
|
43672
43991
|
var MenuPortal = (props) => {
|
|
43673
43992
|
const { __scopeMenu, forceMount, children, container } = props;
|
|
43674
43993
|
const context = useMenuContext(PORTAL_NAME2, __scopeMenu);
|
|
43675
|
-
return /* @__PURE__ */
|
|
43994
|
+
return /* @__PURE__ */ jsx31(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsx31(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx31(Portal, { asChild: true, container, children }) }) });
|
|
43676
43995
|
};
|
|
43677
43996
|
MenuPortal.displayName = PORTAL_NAME2;
|
|
43678
43997
|
var CONTENT_NAME2 = "MenuContent";
|
|
@@ -43683,7 +44002,7 @@ var MenuContent = React42.forwardRef(
|
|
|
43683
44002
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
43684
44003
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
43685
44004
|
const rootContext = useMenuRootContext(CONTENT_NAME2, props.__scopeMenu);
|
|
43686
|
-
return /* @__PURE__ */
|
|
44005
|
+
return /* @__PURE__ */ jsx31(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx31(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx31(Collection2.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx31(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx31(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
|
|
43687
44006
|
}
|
|
43688
44007
|
);
|
|
43689
44008
|
var MenuRootContentModal = React42.forwardRef(
|
|
@@ -43695,7 +44014,7 @@ var MenuRootContentModal = React42.forwardRef(
|
|
|
43695
44014
|
const content = ref.current;
|
|
43696
44015
|
if (content) return hideOthers(content);
|
|
43697
44016
|
}, []);
|
|
43698
|
-
return /* @__PURE__ */
|
|
44017
|
+
return /* @__PURE__ */ jsx31(
|
|
43699
44018
|
MenuContentImpl,
|
|
43700
44019
|
{
|
|
43701
44020
|
...props,
|
|
@@ -43715,7 +44034,7 @@ var MenuRootContentModal = React42.forwardRef(
|
|
|
43715
44034
|
);
|
|
43716
44035
|
var MenuRootContentNonModal = React42.forwardRef((props, forwardedRef) => {
|
|
43717
44036
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
43718
|
-
return /* @__PURE__ */
|
|
44037
|
+
return /* @__PURE__ */ jsx31(
|
|
43719
44038
|
MenuContentImpl,
|
|
43720
44039
|
{
|
|
43721
44040
|
...props,
|
|
@@ -43787,7 +44106,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43787
44106
|
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
43788
44107
|
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
43789
44108
|
}, []);
|
|
43790
|
-
return /* @__PURE__ */
|
|
44109
|
+
return /* @__PURE__ */ jsx31(
|
|
43791
44110
|
MenuContentProvider,
|
|
43792
44111
|
{
|
|
43793
44112
|
scope: __scopeMenu,
|
|
@@ -43816,7 +44135,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43816
44135
|
onPointerGraceIntentChange: React42.useCallback((intent) => {
|
|
43817
44136
|
pointerGraceIntentRef.current = intent;
|
|
43818
44137
|
}, []),
|
|
43819
|
-
children: /* @__PURE__ */
|
|
44138
|
+
children: /* @__PURE__ */ jsx31(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx31(
|
|
43820
44139
|
FocusScope,
|
|
43821
44140
|
{
|
|
43822
44141
|
asChild: true,
|
|
@@ -43826,7 +44145,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43826
44145
|
contentRef.current?.focus({ preventScroll: true });
|
|
43827
44146
|
}),
|
|
43828
44147
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
43829
|
-
children: /* @__PURE__ */
|
|
44148
|
+
children: /* @__PURE__ */ jsx31(
|
|
43830
44149
|
DismissableLayer,
|
|
43831
44150
|
{
|
|
43832
44151
|
asChild: true,
|
|
@@ -43836,7 +44155,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43836
44155
|
onFocusOutside,
|
|
43837
44156
|
onInteractOutside,
|
|
43838
44157
|
onDismiss,
|
|
43839
|
-
children: /* @__PURE__ */
|
|
44158
|
+
children: /* @__PURE__ */ jsx31(
|
|
43840
44159
|
Root3,
|
|
43841
44160
|
{
|
|
43842
44161
|
asChild: true,
|
|
@@ -43850,7 +44169,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43850
44169
|
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
43851
44170
|
}),
|
|
43852
44171
|
preventScrollOnEntryFocus: true,
|
|
43853
|
-
children: /* @__PURE__ */
|
|
44172
|
+
children: /* @__PURE__ */ jsx31(
|
|
43854
44173
|
Content,
|
|
43855
44174
|
{
|
|
43856
44175
|
role: "menu",
|
|
@@ -43915,7 +44234,7 @@ var GROUP_NAME2 = "MenuGroup";
|
|
|
43915
44234
|
var MenuGroup = React42.forwardRef(
|
|
43916
44235
|
(props, forwardedRef) => {
|
|
43917
44236
|
const { __scopeMenu, ...groupProps } = props;
|
|
43918
|
-
return /* @__PURE__ */
|
|
44237
|
+
return /* @__PURE__ */ jsx31(Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
43919
44238
|
}
|
|
43920
44239
|
);
|
|
43921
44240
|
MenuGroup.displayName = GROUP_NAME2;
|
|
@@ -43923,7 +44242,7 @@ var LABEL_NAME = "MenuLabel";
|
|
|
43923
44242
|
var MenuLabel = React42.forwardRef(
|
|
43924
44243
|
(props, forwardedRef) => {
|
|
43925
44244
|
const { __scopeMenu, ...labelProps } = props;
|
|
43926
|
-
return /* @__PURE__ */
|
|
44245
|
+
return /* @__PURE__ */ jsx31(Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
43927
44246
|
}
|
|
43928
44247
|
);
|
|
43929
44248
|
MenuLabel.displayName = LABEL_NAME;
|
|
@@ -43950,7 +44269,7 @@ var MenuItem = React42.forwardRef(
|
|
|
43950
44269
|
}
|
|
43951
44270
|
}
|
|
43952
44271
|
};
|
|
43953
|
-
return /* @__PURE__ */
|
|
44272
|
+
return /* @__PURE__ */ jsx31(
|
|
43954
44273
|
MenuItemImpl,
|
|
43955
44274
|
{
|
|
43956
44275
|
...itemProps,
|
|
@@ -43992,13 +44311,13 @@ var MenuItemImpl = React42.forwardRef(
|
|
|
43992
44311
|
setTextContent((menuItem.textContent ?? "").trim());
|
|
43993
44312
|
}
|
|
43994
44313
|
}, [itemProps.children]);
|
|
43995
|
-
return /* @__PURE__ */
|
|
44314
|
+
return /* @__PURE__ */ jsx31(
|
|
43996
44315
|
Collection2.ItemSlot,
|
|
43997
44316
|
{
|
|
43998
44317
|
scope: __scopeMenu,
|
|
43999
44318
|
disabled,
|
|
44000
44319
|
textValue: textValue ?? textContent,
|
|
44001
|
-
children: /* @__PURE__ */
|
|
44320
|
+
children: /* @__PURE__ */ jsx31(Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx31(
|
|
44002
44321
|
Primitive.div,
|
|
44003
44322
|
{
|
|
44004
44323
|
role: "menuitem",
|
|
@@ -44037,7 +44356,7 @@ var CHECKBOX_ITEM_NAME = "MenuCheckboxItem";
|
|
|
44037
44356
|
var MenuCheckboxItem = React42.forwardRef(
|
|
44038
44357
|
(props, forwardedRef) => {
|
|
44039
44358
|
const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
|
|
44040
|
-
return /* @__PURE__ */
|
|
44359
|
+
return /* @__PURE__ */ jsx31(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx31(
|
|
44041
44360
|
MenuItem,
|
|
44042
44361
|
{
|
|
44043
44362
|
role: "menuitemcheckbox",
|
|
@@ -44065,7 +44384,7 @@ var MenuRadioGroup = React42.forwardRef(
|
|
|
44065
44384
|
(props, forwardedRef) => {
|
|
44066
44385
|
const { value, onValueChange, ...groupProps } = props;
|
|
44067
44386
|
const handleValueChange = useCallbackRef(onValueChange);
|
|
44068
|
-
return /* @__PURE__ */
|
|
44387
|
+
return /* @__PURE__ */ jsx31(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ jsx31(MenuGroup, { ...groupProps, ref: forwardedRef }) });
|
|
44069
44388
|
}
|
|
44070
44389
|
);
|
|
44071
44390
|
MenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
@@ -44075,7 +44394,7 @@ var MenuRadioItem = React42.forwardRef(
|
|
|
44075
44394
|
const { value, ...radioItemProps } = props;
|
|
44076
44395
|
const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);
|
|
44077
44396
|
const checked = value === context.value;
|
|
44078
|
-
return /* @__PURE__ */
|
|
44397
|
+
return /* @__PURE__ */ jsx31(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx31(
|
|
44079
44398
|
MenuItem,
|
|
44080
44399
|
{
|
|
44081
44400
|
role: "menuitemradio",
|
|
@@ -44102,11 +44421,11 @@ var MenuItemIndicator = React42.forwardRef(
|
|
|
44102
44421
|
(props, forwardedRef) => {
|
|
44103
44422
|
const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;
|
|
44104
44423
|
const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);
|
|
44105
|
-
return /* @__PURE__ */
|
|
44424
|
+
return /* @__PURE__ */ jsx31(
|
|
44106
44425
|
Presence,
|
|
44107
44426
|
{
|
|
44108
44427
|
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
|
|
44109
|
-
children: /* @__PURE__ */
|
|
44428
|
+
children: /* @__PURE__ */ jsx31(
|
|
44110
44429
|
Primitive.span,
|
|
44111
44430
|
{
|
|
44112
44431
|
...itemIndicatorProps,
|
|
@@ -44123,7 +44442,7 @@ var SEPARATOR_NAME = "MenuSeparator";
|
|
|
44123
44442
|
var MenuSeparator = React42.forwardRef(
|
|
44124
44443
|
(props, forwardedRef) => {
|
|
44125
44444
|
const { __scopeMenu, ...separatorProps } = props;
|
|
44126
|
-
return /* @__PURE__ */
|
|
44445
|
+
return /* @__PURE__ */ jsx31(
|
|
44127
44446
|
Primitive.div,
|
|
44128
44447
|
{
|
|
44129
44448
|
role: "separator",
|
|
@@ -44140,7 +44459,7 @@ var MenuArrow = React42.forwardRef(
|
|
|
44140
44459
|
(props, forwardedRef) => {
|
|
44141
44460
|
const { __scopeMenu, ...arrowProps } = props;
|
|
44142
44461
|
const popperScope = usePopperScope(__scopeMenu);
|
|
44143
|
-
return /* @__PURE__ */
|
|
44462
|
+
return /* @__PURE__ */ jsx31(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
44144
44463
|
}
|
|
44145
44464
|
);
|
|
44146
44465
|
MenuArrow.displayName = ARROW_NAME2;
|
|
@@ -44157,7 +44476,7 @@ var MenuSub = (props) => {
|
|
|
44157
44476
|
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
44158
44477
|
return () => handleOpenChange(false);
|
|
44159
44478
|
}, [parentMenuContext.open, handleOpenChange]);
|
|
44160
|
-
return /* @__PURE__ */
|
|
44479
|
+
return /* @__PURE__ */ jsx31(Root2, { ...popperScope, children: /* @__PURE__ */ jsx31(
|
|
44161
44480
|
MenuProvider,
|
|
44162
44481
|
{
|
|
44163
44482
|
scope: __scopeMenu,
|
|
@@ -44165,7 +44484,7 @@ var MenuSub = (props) => {
|
|
|
44165
44484
|
onOpenChange: handleOpenChange,
|
|
44166
44485
|
content,
|
|
44167
44486
|
onContentChange: setContent,
|
|
44168
|
-
children: /* @__PURE__ */
|
|
44487
|
+
children: /* @__PURE__ */ jsx31(
|
|
44169
44488
|
MenuSubProvider,
|
|
44170
44489
|
{
|
|
44171
44490
|
scope: __scopeMenu,
|
|
@@ -44202,13 +44521,13 @@ var MenuSubTrigger = React42.forwardRef(
|
|
|
44202
44521
|
onPointerGraceIntentChange(null);
|
|
44203
44522
|
};
|
|
44204
44523
|
}, [pointerGraceTimerRef, onPointerGraceIntentChange]);
|
|
44205
|
-
return /* @__PURE__ */
|
|
44524
|
+
return /* @__PURE__ */ jsx31(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsx31(
|
|
44206
44525
|
MenuItemImpl,
|
|
44207
44526
|
{
|
|
44208
44527
|
id: subContext.triggerId,
|
|
44209
44528
|
"aria-haspopup": "menu",
|
|
44210
44529
|
"aria-expanded": context.open,
|
|
44211
|
-
"aria-controls": subContext.contentId,
|
|
44530
|
+
"aria-controls": context.open ? subContext.contentId : void 0,
|
|
44212
44531
|
"data-state": getOpenState(context.open),
|
|
44213
44532
|
...props,
|
|
44214
44533
|
ref: composeRefs(forwardedRef, subContext.onTriggerChange),
|
|
@@ -44285,20 +44604,20 @@ var SUB_CONTENT_NAME = "MenuSubContent";
|
|
|
44285
44604
|
var MenuSubContent = React42.forwardRef(
|
|
44286
44605
|
(props, forwardedRef) => {
|
|
44287
44606
|
const portalContext = usePortalContext(CONTENT_NAME2, props.__scopeMenu);
|
|
44288
|
-
const { forceMount = portalContext.forceMount, ...subContentProps } = props;
|
|
44607
|
+
const { forceMount = portalContext.forceMount, align = "start", ...subContentProps } = props;
|
|
44289
44608
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
44290
44609
|
const rootContext = useMenuRootContext(CONTENT_NAME2, props.__scopeMenu);
|
|
44291
44610
|
const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);
|
|
44292
44611
|
const ref = React42.useRef(null);
|
|
44293
44612
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
44294
|
-
return /* @__PURE__ */
|
|
44613
|
+
return /* @__PURE__ */ jsx31(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx31(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx31(Collection2.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx31(
|
|
44295
44614
|
MenuContentImpl,
|
|
44296
44615
|
{
|
|
44297
44616
|
id: subContext.contentId,
|
|
44298
44617
|
"aria-labelledby": subContext.triggerId,
|
|
44299
44618
|
...subContentProps,
|
|
44300
44619
|
ref: composedRefs,
|
|
44301
|
-
align
|
|
44620
|
+
align,
|
|
44302
44621
|
side: rootContext.dir === "rtl" ? "left" : "right",
|
|
44303
44622
|
disableOutsidePointerEvents: false,
|
|
44304
44623
|
disableOutsideScroll: false,
|
|
@@ -44402,7 +44721,7 @@ var SubTrigger = MenuSubTrigger;
|
|
|
44402
44721
|
var SubContent = MenuSubContent;
|
|
44403
44722
|
|
|
44404
44723
|
// node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
44405
|
-
import { jsx as
|
|
44724
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
44406
44725
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
44407
44726
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(
|
|
44408
44727
|
DROPDOWN_MENU_NAME,
|
|
@@ -44428,7 +44747,7 @@ var DropdownMenu = (props) => {
|
|
|
44428
44747
|
onChange: onOpenChange,
|
|
44429
44748
|
caller: DROPDOWN_MENU_NAME
|
|
44430
44749
|
});
|
|
44431
|
-
return /* @__PURE__ */
|
|
44750
|
+
return /* @__PURE__ */ jsx32(
|
|
44432
44751
|
DropdownMenuProvider,
|
|
44433
44752
|
{
|
|
44434
44753
|
scope: __scopeDropdownMenu,
|
|
@@ -44439,7 +44758,7 @@ var DropdownMenu = (props) => {
|
|
|
44439
44758
|
onOpenChange: setOpen,
|
|
44440
44759
|
onOpenToggle: React43.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
44441
44760
|
modal,
|
|
44442
|
-
children: /* @__PURE__ */
|
|
44761
|
+
children: /* @__PURE__ */ jsx32(Root32, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
|
|
44443
44762
|
}
|
|
44444
44763
|
);
|
|
44445
44764
|
};
|
|
@@ -44450,7 +44769,7 @@ var DropdownMenuTrigger = React43.forwardRef(
|
|
|
44450
44769
|
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
44451
44770
|
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
44452
44771
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44453
|
-
return /* @__PURE__ */
|
|
44772
|
+
return /* @__PURE__ */ jsx32(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx32(
|
|
44454
44773
|
Primitive.button,
|
|
44455
44774
|
{
|
|
44456
44775
|
type: "button",
|
|
@@ -44484,7 +44803,7 @@ var PORTAL_NAME3 = "DropdownMenuPortal";
|
|
|
44484
44803
|
var DropdownMenuPortal = (props) => {
|
|
44485
44804
|
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
44486
44805
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44487
|
-
return /* @__PURE__ */
|
|
44806
|
+
return /* @__PURE__ */ jsx32(Portal2, { ...menuScope, ...portalProps });
|
|
44488
44807
|
};
|
|
44489
44808
|
DropdownMenuPortal.displayName = PORTAL_NAME3;
|
|
44490
44809
|
var CONTENT_NAME3 = "DropdownMenuContent";
|
|
@@ -44494,7 +44813,7 @@ var DropdownMenuContent = React43.forwardRef(
|
|
|
44494
44813
|
const context = useDropdownMenuContext(CONTENT_NAME3, __scopeDropdownMenu);
|
|
44495
44814
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44496
44815
|
const hasInteractedOutsideRef = React43.useRef(false);
|
|
44497
|
-
return /* @__PURE__ */
|
|
44816
|
+
return /* @__PURE__ */ jsx32(
|
|
44498
44817
|
Content2,
|
|
44499
44818
|
{
|
|
44500
44819
|
id: context.contentId,
|
|
@@ -44534,7 +44853,7 @@ var DropdownMenuGroup = React43.forwardRef(
|
|
|
44534
44853
|
(props, forwardedRef) => {
|
|
44535
44854
|
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
44536
44855
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44537
|
-
return /* @__PURE__ */
|
|
44856
|
+
return /* @__PURE__ */ jsx32(Group6, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
44538
44857
|
}
|
|
44539
44858
|
);
|
|
44540
44859
|
DropdownMenuGroup.displayName = GROUP_NAME3;
|
|
@@ -44543,7 +44862,7 @@ var DropdownMenuLabel = React43.forwardRef(
|
|
|
44543
44862
|
(props, forwardedRef) => {
|
|
44544
44863
|
const { __scopeDropdownMenu, ...labelProps } = props;
|
|
44545
44864
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44546
|
-
return /* @__PURE__ */
|
|
44865
|
+
return /* @__PURE__ */ jsx32(Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
44547
44866
|
}
|
|
44548
44867
|
);
|
|
44549
44868
|
DropdownMenuLabel.displayName = LABEL_NAME2;
|
|
@@ -44552,7 +44871,7 @@ var DropdownMenuItem = React43.forwardRef(
|
|
|
44552
44871
|
(props, forwardedRef) => {
|
|
44553
44872
|
const { __scopeDropdownMenu, ...itemProps } = props;
|
|
44554
44873
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44555
|
-
return /* @__PURE__ */
|
|
44874
|
+
return /* @__PURE__ */ jsx32(Item2, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
44556
44875
|
}
|
|
44557
44876
|
);
|
|
44558
44877
|
DropdownMenuItem.displayName = ITEM_NAME3;
|
|
@@ -44560,35 +44879,35 @@ var CHECKBOX_ITEM_NAME2 = "DropdownMenuCheckboxItem";
|
|
|
44560
44879
|
var DropdownMenuCheckboxItem = React43.forwardRef((props, forwardedRef) => {
|
|
44561
44880
|
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
|
44562
44881
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44563
|
-
return /* @__PURE__ */
|
|
44882
|
+
return /* @__PURE__ */ jsx32(CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
44564
44883
|
});
|
|
44565
44884
|
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME2;
|
|
44566
44885
|
var RADIO_GROUP_NAME2 = "DropdownMenuRadioGroup";
|
|
44567
44886
|
var DropdownMenuRadioGroup = React43.forwardRef((props, forwardedRef) => {
|
|
44568
44887
|
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
44569
44888
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44570
|
-
return /* @__PURE__ */
|
|
44889
|
+
return /* @__PURE__ */ jsx32(RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
44571
44890
|
});
|
|
44572
44891
|
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME2;
|
|
44573
44892
|
var RADIO_ITEM_NAME2 = "DropdownMenuRadioItem";
|
|
44574
44893
|
var DropdownMenuRadioItem = React43.forwardRef((props, forwardedRef) => {
|
|
44575
44894
|
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
44576
44895
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44577
|
-
return /* @__PURE__ */
|
|
44896
|
+
return /* @__PURE__ */ jsx32(RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
44578
44897
|
});
|
|
44579
44898
|
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME2;
|
|
44580
44899
|
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
44581
44900
|
var DropdownMenuItemIndicator = React43.forwardRef((props, forwardedRef) => {
|
|
44582
44901
|
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
44583
44902
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44584
|
-
return /* @__PURE__ */
|
|
44903
|
+
return /* @__PURE__ */ jsx32(ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
44585
44904
|
});
|
|
44586
44905
|
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
44587
44906
|
var SEPARATOR_NAME2 = "DropdownMenuSeparator";
|
|
44588
44907
|
var DropdownMenuSeparator = React43.forwardRef((props, forwardedRef) => {
|
|
44589
44908
|
const { __scopeDropdownMenu, ...separatorProps } = props;
|
|
44590
44909
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44591
|
-
return /* @__PURE__ */
|
|
44910
|
+
return /* @__PURE__ */ jsx32(Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
44592
44911
|
});
|
|
44593
44912
|
DropdownMenuSeparator.displayName = SEPARATOR_NAME2;
|
|
44594
44913
|
var ARROW_NAME3 = "DropdownMenuArrow";
|
|
@@ -44596,7 +44915,7 @@ var DropdownMenuArrow = React43.forwardRef(
|
|
|
44596
44915
|
(props, forwardedRef) => {
|
|
44597
44916
|
const { __scopeDropdownMenu, ...arrowProps } = props;
|
|
44598
44917
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44599
|
-
return /* @__PURE__ */
|
|
44918
|
+
return /* @__PURE__ */ jsx32(Arrow22, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
44600
44919
|
}
|
|
44601
44920
|
);
|
|
44602
44921
|
DropdownMenuArrow.displayName = ARROW_NAME3;
|
|
@@ -44609,20 +44928,20 @@ var DropdownMenuSub = (props) => {
|
|
|
44609
44928
|
onChange: onOpenChange,
|
|
44610
44929
|
caller: "DropdownMenuSub"
|
|
44611
44930
|
});
|
|
44612
|
-
return /* @__PURE__ */
|
|
44931
|
+
return /* @__PURE__ */ jsx32(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
44613
44932
|
};
|
|
44614
44933
|
var SUB_TRIGGER_NAME2 = "DropdownMenuSubTrigger";
|
|
44615
44934
|
var DropdownMenuSubTrigger = React43.forwardRef((props, forwardedRef) => {
|
|
44616
44935
|
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
44617
44936
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44618
|
-
return /* @__PURE__ */
|
|
44937
|
+
return /* @__PURE__ */ jsx32(SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
|
|
44619
44938
|
});
|
|
44620
44939
|
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME2;
|
|
44621
44940
|
var SUB_CONTENT_NAME2 = "DropdownMenuSubContent";
|
|
44622
44941
|
var DropdownMenuSubContent = React43.forwardRef((props, forwardedRef) => {
|
|
44623
44942
|
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
44624
44943
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44625
|
-
return /* @__PURE__ */
|
|
44944
|
+
return /* @__PURE__ */ jsx32(
|
|
44626
44945
|
SubContent,
|
|
44627
44946
|
{
|
|
44628
44947
|
...menuScope,
|
|
@@ -44654,11 +44973,11 @@ var SubTrigger2 = DropdownMenuSubTrigger;
|
|
|
44654
44973
|
var SubContent2 = DropdownMenuSubContent;
|
|
44655
44974
|
|
|
44656
44975
|
// src/components/AppearanceMenu.tsx
|
|
44657
|
-
import { useState as
|
|
44976
|
+
import { useState as useState34 } from "react";
|
|
44658
44977
|
|
|
44659
44978
|
// src/components/Icons.tsx
|
|
44660
|
-
import { jsx as
|
|
44661
|
-
var CheckIcon = () => /* @__PURE__ */
|
|
44979
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
44980
|
+
var CheckIcon = () => /* @__PURE__ */ jsx33(
|
|
44662
44981
|
"svg",
|
|
44663
44982
|
{
|
|
44664
44983
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -44670,10 +44989,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx34(
|
|
|
44670
44989
|
strokeWidth: "2",
|
|
44671
44990
|
strokeLinecap: "round",
|
|
44672
44991
|
strokeLinejoin: "round",
|
|
44673
|
-
children: /* @__PURE__ */
|
|
44992
|
+
children: /* @__PURE__ */ jsx33("path", { d: "M20 6 9 17l-5-5" })
|
|
44674
44993
|
}
|
|
44675
44994
|
);
|
|
44676
|
-
var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */
|
|
44995
|
+
var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx33(
|
|
44677
44996
|
"svg",
|
|
44678
44997
|
{
|
|
44679
44998
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -44690,10 +45009,10 @@ var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx34(
|
|
|
44690
45009
|
transform: isOpen ? "rotate(90deg)" : "rotate(0deg)",
|
|
44691
45010
|
opacity: 0.6
|
|
44692
45011
|
},
|
|
44693
|
-
children: /* @__PURE__ */
|
|
45012
|
+
children: /* @__PURE__ */ jsx33("path", { d: "m9 18 6-6-6-6" })
|
|
44694
45013
|
}
|
|
44695
45014
|
);
|
|
44696
|
-
var DotIcon = () => /* @__PURE__ */
|
|
45015
|
+
var DotIcon = () => /* @__PURE__ */ jsx33(
|
|
44697
45016
|
"svg",
|
|
44698
45017
|
{
|
|
44699
45018
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -44706,12 +45025,12 @@ var DotIcon = () => /* @__PURE__ */ jsx34(
|
|
|
44706
45025
|
strokeLinecap: "round",
|
|
44707
45026
|
strokeLinejoin: "round",
|
|
44708
45027
|
className: "lucide lucide-dot-icon lucide-dot",
|
|
44709
|
-
children: /* @__PURE__ */
|
|
45028
|
+
children: /* @__PURE__ */ jsx33("circle", { cx: "12.1", cy: "12.1", r: "4.5", fill: "white" })
|
|
44710
45029
|
}
|
|
44711
45030
|
);
|
|
44712
45031
|
|
|
44713
45032
|
// src/components/AppearanceMenu.tsx
|
|
44714
|
-
import { Fragment as Fragment11, jsx as
|
|
45033
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
44715
45034
|
var itemStyles = {
|
|
44716
45035
|
padding: "6px 8px",
|
|
44717
45036
|
borderRadius: 6,
|
|
@@ -44760,10 +45079,10 @@ var iconContainerStyles = {
|
|
|
44760
45079
|
};
|
|
44761
45080
|
var AppearanceMenu = () => {
|
|
44762
45081
|
const { visibility, setLayerVisibility } = useLayerVisibility();
|
|
44763
|
-
const [appearanceSubOpen, setAppearanceSubOpen] =
|
|
44764
|
-
const [hoveredItem, setHoveredItem] =
|
|
45082
|
+
const [appearanceSubOpen, setAppearanceSubOpen] = useState34(false);
|
|
45083
|
+
const [hoveredItem, setHoveredItem] = useState34(null);
|
|
44765
45084
|
return /* @__PURE__ */ jsxs8(Fragment11, { children: [
|
|
44766
|
-
/* @__PURE__ */
|
|
45085
|
+
/* @__PURE__ */ jsx34(Separator2, { style: separatorStyles }),
|
|
44767
45086
|
/* @__PURE__ */ jsxs8(Sub2, { onOpenChange: setAppearanceSubOpen, children: [
|
|
44768
45087
|
/* @__PURE__ */ jsxs8(
|
|
44769
45088
|
SubTrigger2,
|
|
@@ -44777,8 +45096,8 @@ var AppearanceMenu = () => {
|
|
|
44777
45096
|
onMouseLeave: () => setHoveredItem(null),
|
|
44778
45097
|
onTouchStart: () => setHoveredItem("appearance"),
|
|
44779
45098
|
children: [
|
|
44780
|
-
/* @__PURE__ */
|
|
44781
|
-
/* @__PURE__ */
|
|
45099
|
+
/* @__PURE__ */ jsx34("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Appearance" }),
|
|
45100
|
+
/* @__PURE__ */ jsx34(
|
|
44782
45101
|
"div",
|
|
44783
45102
|
{
|
|
44784
45103
|
style: {
|
|
@@ -44787,13 +45106,13 @@ var AppearanceMenu = () => {
|
|
|
44787
45106
|
alignItems: "flex-end",
|
|
44788
45107
|
marginBottom: "-5px"
|
|
44789
45108
|
},
|
|
44790
|
-
children: /* @__PURE__ */
|
|
45109
|
+
children: /* @__PURE__ */ jsx34(ChevronRightIcon, { isOpen: appearanceSubOpen })
|
|
44791
45110
|
}
|
|
44792
45111
|
)
|
|
44793
45112
|
]
|
|
44794
45113
|
}
|
|
44795
45114
|
),
|
|
44796
|
-
/* @__PURE__ */
|
|
45115
|
+
/* @__PURE__ */ jsx34(Portal22, { children: /* @__PURE__ */ jsxs8(
|
|
44797
45116
|
SubContent2,
|
|
44798
45117
|
{
|
|
44799
45118
|
style: { ...contentStyles, marginLeft: -2 },
|
|
@@ -44816,8 +45135,8 @@ var AppearanceMenu = () => {
|
|
|
44816
45135
|
onMouseLeave: () => setHoveredItem(null),
|
|
44817
45136
|
onTouchStart: () => setHoveredItem("boardBody"),
|
|
44818
45137
|
children: [
|
|
44819
|
-
/* @__PURE__ */
|
|
44820
|
-
/* @__PURE__ */
|
|
45138
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.boardBody && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45139
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Board Body" })
|
|
44821
45140
|
]
|
|
44822
45141
|
}
|
|
44823
45142
|
),
|
|
@@ -44837,8 +45156,8 @@ var AppearanceMenu = () => {
|
|
|
44837
45156
|
onMouseLeave: () => setHoveredItem(null),
|
|
44838
45157
|
onTouchStart: () => setHoveredItem("topCopper"),
|
|
44839
45158
|
children: [
|
|
44840
|
-
/* @__PURE__ */
|
|
44841
|
-
/* @__PURE__ */
|
|
45159
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topCopper && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45160
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Copper" })
|
|
44842
45161
|
]
|
|
44843
45162
|
}
|
|
44844
45163
|
),
|
|
@@ -44858,8 +45177,8 @@ var AppearanceMenu = () => {
|
|
|
44858
45177
|
onMouseLeave: () => setHoveredItem(null),
|
|
44859
45178
|
onTouchStart: () => setHoveredItem("bottomCopper"),
|
|
44860
45179
|
children: [
|
|
44861
|
-
/* @__PURE__ */
|
|
44862
|
-
/* @__PURE__ */
|
|
45180
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomCopper && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45181
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Copper" })
|
|
44863
45182
|
]
|
|
44864
45183
|
}
|
|
44865
45184
|
),
|
|
@@ -44879,8 +45198,8 @@ var AppearanceMenu = () => {
|
|
|
44879
45198
|
onMouseLeave: () => setHoveredItem(null),
|
|
44880
45199
|
onTouchStart: () => setHoveredItem("topSilkscreen"),
|
|
44881
45200
|
children: [
|
|
44882
|
-
/* @__PURE__ */
|
|
44883
|
-
/* @__PURE__ */
|
|
45201
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topSilkscreen && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45202
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Silkscreen" })
|
|
44884
45203
|
]
|
|
44885
45204
|
}
|
|
44886
45205
|
),
|
|
@@ -44903,8 +45222,8 @@ var AppearanceMenu = () => {
|
|
|
44903
45222
|
onMouseLeave: () => setHoveredItem(null),
|
|
44904
45223
|
onTouchStart: () => setHoveredItem("bottomSilkscreen"),
|
|
44905
45224
|
children: [
|
|
44906
|
-
/* @__PURE__ */
|
|
44907
|
-
/* @__PURE__ */
|
|
45225
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomSilkscreen && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45226
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Silkscreen" })
|
|
44908
45227
|
]
|
|
44909
45228
|
}
|
|
44910
45229
|
),
|
|
@@ -44924,8 +45243,8 @@ var AppearanceMenu = () => {
|
|
|
44924
45243
|
onMouseLeave: () => setHoveredItem(null),
|
|
44925
45244
|
onTouchStart: () => setHoveredItem("topMask"),
|
|
44926
45245
|
children: [
|
|
44927
|
-
/* @__PURE__ */
|
|
44928
|
-
/* @__PURE__ */
|
|
45246
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topMask && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45247
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Soldermask" })
|
|
44929
45248
|
]
|
|
44930
45249
|
}
|
|
44931
45250
|
),
|
|
@@ -44945,8 +45264,8 @@ var AppearanceMenu = () => {
|
|
|
44945
45264
|
onMouseLeave: () => setHoveredItem(null),
|
|
44946
45265
|
onTouchStart: () => setHoveredItem("bottomMask"),
|
|
44947
45266
|
children: [
|
|
44948
|
-
/* @__PURE__ */
|
|
44949
|
-
/* @__PURE__ */
|
|
45267
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomMask && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45268
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Soldermask" })
|
|
44950
45269
|
]
|
|
44951
45270
|
}
|
|
44952
45271
|
),
|
|
@@ -44966,8 +45285,8 @@ var AppearanceMenu = () => {
|
|
|
44966
45285
|
onMouseLeave: () => setHoveredItem(null),
|
|
44967
45286
|
onTouchStart: () => setHoveredItem("pcbNotes"),
|
|
44968
45287
|
children: [
|
|
44969
|
-
/* @__PURE__ */
|
|
44970
|
-
/* @__PURE__ */
|
|
45288
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.pcbNotes && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45289
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "PCB Notes" })
|
|
44971
45290
|
]
|
|
44972
45291
|
}
|
|
44973
45292
|
),
|
|
@@ -44987,8 +45306,8 @@ var AppearanceMenu = () => {
|
|
|
44987
45306
|
onMouseLeave: () => setHoveredItem(null),
|
|
44988
45307
|
onTouchStart: () => setHoveredItem("smtModels"),
|
|
44989
45308
|
children: [
|
|
44990
|
-
/* @__PURE__ */
|
|
44991
|
-
/* @__PURE__ */
|
|
45309
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.smtModels && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45310
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Surface Mount Components" })
|
|
44992
45311
|
]
|
|
44993
45312
|
}
|
|
44994
45313
|
),
|
|
@@ -45011,8 +45330,8 @@ var AppearanceMenu = () => {
|
|
|
45011
45330
|
onMouseLeave: () => setHoveredItem(null),
|
|
45012
45331
|
onTouchStart: () => setHoveredItem("throughHoleModels"),
|
|
45013
45332
|
children: [
|
|
45014
|
-
/* @__PURE__ */
|
|
45015
|
-
/* @__PURE__ */
|
|
45333
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.throughHoleModels && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45334
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Through-Hole Components" })
|
|
45016
45335
|
]
|
|
45017
45336
|
}
|
|
45018
45337
|
)
|
|
@@ -45024,7 +45343,7 @@ var AppearanceMenu = () => {
|
|
|
45024
45343
|
};
|
|
45025
45344
|
|
|
45026
45345
|
// src/components/ContextMenu.tsx
|
|
45027
|
-
import { jsx as
|
|
45346
|
+
import { jsx as jsx35, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
45028
45347
|
var cameraOptions = [
|
|
45029
45348
|
"Custom",
|
|
45030
45349
|
"Top Center Angled",
|
|
@@ -45106,9 +45425,9 @@ var ContextMenu = ({
|
|
|
45106
45425
|
onOpenKeyboardShortcuts
|
|
45107
45426
|
}) => {
|
|
45108
45427
|
const { cameraType, setCameraType } = useCameraController();
|
|
45109
|
-
const [cameraSubOpen, setCameraSubOpen] =
|
|
45110
|
-
const [hoveredItem, setHoveredItem] =
|
|
45111
|
-
return /* @__PURE__ */
|
|
45428
|
+
const [cameraSubOpen, setCameraSubOpen] = useState35(false);
|
|
45429
|
+
const [hoveredItem, setHoveredItem] = useState35(null);
|
|
45430
|
+
return /* @__PURE__ */ jsx35(
|
|
45112
45431
|
"div",
|
|
45113
45432
|
{
|
|
45114
45433
|
ref: menuRef,
|
|
@@ -45120,8 +45439,8 @@ var ContextMenu = ({
|
|
|
45120
45439
|
height: 0
|
|
45121
45440
|
},
|
|
45122
45441
|
children: /* @__PURE__ */ jsxs9(Root22, { open: true, modal: false, children: [
|
|
45123
|
-
/* @__PURE__ */
|
|
45124
|
-
/* @__PURE__ */
|
|
45442
|
+
/* @__PURE__ */ jsx35(Trigger, { asChild: true, children: /* @__PURE__ */ jsx35("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
|
|
45443
|
+
/* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsxs9(
|
|
45125
45444
|
Content22,
|
|
45126
45445
|
{
|
|
45127
45446
|
style: contentStyles2,
|
|
@@ -45143,7 +45462,7 @@ var ContextMenu = ({
|
|
|
45143
45462
|
onMouseLeave: () => setHoveredItem(null),
|
|
45144
45463
|
onTouchStart: () => setHoveredItem("camera"),
|
|
45145
45464
|
children: [
|
|
45146
|
-
/* @__PURE__ */
|
|
45465
|
+
/* @__PURE__ */ jsx35(
|
|
45147
45466
|
"span",
|
|
45148
45467
|
{
|
|
45149
45468
|
style: { flex: 1, display: "flex", alignItems: "center" },
|
|
@@ -45160,15 +45479,15 @@ var ContextMenu = ({
|
|
|
45160
45479
|
marginLeft: "auto"
|
|
45161
45480
|
},
|
|
45162
45481
|
children: [
|
|
45163
|
-
/* @__PURE__ */
|
|
45164
|
-
/* @__PURE__ */
|
|
45482
|
+
/* @__PURE__ */ jsx35("span", { style: { opacity: 0.55, fontSize: 13 }, children: cameraPreset }),
|
|
45483
|
+
/* @__PURE__ */ jsx35(ChevronRightIcon, { isOpen: cameraSubOpen })
|
|
45165
45484
|
]
|
|
45166
45485
|
}
|
|
45167
45486
|
)
|
|
45168
45487
|
]
|
|
45169
45488
|
}
|
|
45170
45489
|
),
|
|
45171
|
-
/* @__PURE__ */
|
|
45490
|
+
/* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsx35(
|
|
45172
45491
|
SubContent2,
|
|
45173
45492
|
{
|
|
45174
45493
|
style: { ...contentStyles2, marginLeft: -2 },
|
|
@@ -45190,8 +45509,8 @@ var ContextMenu = ({
|
|
|
45190
45509
|
onMouseLeave: () => setHoveredItem(null),
|
|
45191
45510
|
onTouchStart: () => setHoveredItem(option),
|
|
45192
45511
|
children: [
|
|
45193
|
-
/* @__PURE__ */
|
|
45194
|
-
/* @__PURE__ */
|
|
45512
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: cameraPreset === option && /* @__PURE__ */ jsx35(DotIcon, {}) }),
|
|
45513
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: option })
|
|
45195
45514
|
]
|
|
45196
45515
|
},
|
|
45197
45516
|
option
|
|
@@ -45215,8 +45534,8 @@ var ContextMenu = ({
|
|
|
45215
45534
|
onMouseLeave: () => setHoveredItem(null),
|
|
45216
45535
|
onTouchStart: () => setHoveredItem("autorotate"),
|
|
45217
45536
|
children: [
|
|
45218
|
-
/* @__PURE__ */
|
|
45219
|
-
/* @__PURE__ */
|
|
45537
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: autoRotate && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
45538
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Auto rotate" })
|
|
45220
45539
|
]
|
|
45221
45540
|
}
|
|
45222
45541
|
),
|
|
@@ -45238,14 +45557,14 @@ var ContextMenu = ({
|
|
|
45238
45557
|
onMouseLeave: () => setHoveredItem(null),
|
|
45239
45558
|
onTouchStart: () => setHoveredItem("cameratype"),
|
|
45240
45559
|
children: [
|
|
45241
|
-
/* @__PURE__ */
|
|
45242
|
-
/* @__PURE__ */
|
|
45560
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: cameraType === "orthographic" && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
45561
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Orthographic Camera" })
|
|
45243
45562
|
]
|
|
45244
45563
|
}
|
|
45245
45564
|
),
|
|
45246
|
-
/* @__PURE__ */
|
|
45247
|
-
/* @__PURE__ */
|
|
45248
|
-
/* @__PURE__ */
|
|
45565
|
+
/* @__PURE__ */ jsx35(AppearanceMenu, {}),
|
|
45566
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
|
|
45567
|
+
/* @__PURE__ */ jsx35(
|
|
45249
45568
|
Item22,
|
|
45250
45569
|
{
|
|
45251
45570
|
style: {
|
|
@@ -45257,10 +45576,10 @@ var ContextMenu = ({
|
|
|
45257
45576
|
onMouseEnter: () => setHoveredItem("download"),
|
|
45258
45577
|
onMouseLeave: () => setHoveredItem(null),
|
|
45259
45578
|
onTouchStart: () => setHoveredItem("download"),
|
|
45260
|
-
children: /* @__PURE__ */
|
|
45579
|
+
children: /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Download GLTF" })
|
|
45261
45580
|
}
|
|
45262
45581
|
),
|
|
45263
|
-
/* @__PURE__ */
|
|
45582
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
|
|
45264
45583
|
/* @__PURE__ */ jsxs9(
|
|
45265
45584
|
Item22,
|
|
45266
45585
|
{
|
|
@@ -45283,7 +45602,7 @@ var ContextMenu = ({
|
|
|
45283
45602
|
engine === "jscad" ? "Manifold" : "JSCAD",
|
|
45284
45603
|
" Engine"
|
|
45285
45604
|
] }),
|
|
45286
|
-
/* @__PURE__ */
|
|
45605
|
+
/* @__PURE__ */ jsx35(
|
|
45287
45606
|
"div",
|
|
45288
45607
|
{
|
|
45289
45608
|
style: {
|
|
@@ -45297,7 +45616,7 @@ var ContextMenu = ({
|
|
|
45297
45616
|
]
|
|
45298
45617
|
}
|
|
45299
45618
|
),
|
|
45300
|
-
/* @__PURE__ */
|
|
45619
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
|
|
45301
45620
|
/* @__PURE__ */ jsxs9(
|
|
45302
45621
|
Item22,
|
|
45303
45622
|
{
|
|
@@ -45311,8 +45630,8 @@ var ContextMenu = ({
|
|
|
45311
45630
|
onMouseLeave: () => setHoveredItem(null),
|
|
45312
45631
|
onTouchStart: () => setHoveredItem("shortcuts"),
|
|
45313
45632
|
children: [
|
|
45314
|
-
/* @__PURE__ */
|
|
45315
|
-
/* @__PURE__ */
|
|
45633
|
+
/* @__PURE__ */ jsx35("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Keyboard Shortcuts" }),
|
|
45634
|
+
/* @__PURE__ */ jsx35(
|
|
45316
45635
|
"div",
|
|
45317
45636
|
{
|
|
45318
45637
|
style: {
|
|
@@ -45326,8 +45645,8 @@ var ContextMenu = ({
|
|
|
45326
45645
|
]
|
|
45327
45646
|
}
|
|
45328
45647
|
),
|
|
45329
|
-
/* @__PURE__ */
|
|
45330
|
-
/* @__PURE__ */
|
|
45648
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
|
|
45649
|
+
/* @__PURE__ */ jsx35(
|
|
45331
45650
|
"div",
|
|
45332
45651
|
{
|
|
45333
45652
|
style: {
|
|
@@ -45365,16 +45684,16 @@ var ContextMenu = ({
|
|
|
45365
45684
|
};
|
|
45366
45685
|
|
|
45367
45686
|
// src/components/KeyboardShortcutsDialog.tsx
|
|
45368
|
-
import { useEffect as
|
|
45369
|
-
import { jsx as
|
|
45687
|
+
import { useEffect as useEffect46, useMemo as useMemo29, useRef as useRef27, useState as useState36 } from "react";
|
|
45688
|
+
import { jsx as jsx36, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
45370
45689
|
var KeyboardShortcutsDialog = ({
|
|
45371
45690
|
open,
|
|
45372
45691
|
onClose
|
|
45373
45692
|
}) => {
|
|
45374
|
-
const [query, setQuery] =
|
|
45375
|
-
const inputRef =
|
|
45693
|
+
const [query, setQuery] = useState36("");
|
|
45694
|
+
const inputRef = useRef27(null);
|
|
45376
45695
|
const hotkeys = useHotkeyRegistry();
|
|
45377
|
-
|
|
45696
|
+
useEffect46(() => {
|
|
45378
45697
|
if (!open) return void 0;
|
|
45379
45698
|
const handleKeyDown = (event) => {
|
|
45380
45699
|
if (event.key === "Escape") {
|
|
@@ -45385,7 +45704,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45385
45704
|
window.addEventListener("keydown", handleKeyDown);
|
|
45386
45705
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
45387
45706
|
}, [open, onClose]);
|
|
45388
|
-
|
|
45707
|
+
useEffect46(() => {
|
|
45389
45708
|
if (open) {
|
|
45390
45709
|
setTimeout(() => {
|
|
45391
45710
|
inputRef.current?.focus();
|
|
@@ -45405,7 +45724,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45405
45724
|
if (!open) {
|
|
45406
45725
|
return null;
|
|
45407
45726
|
}
|
|
45408
|
-
return /* @__PURE__ */
|
|
45727
|
+
return /* @__PURE__ */ jsx36(
|
|
45409
45728
|
"div",
|
|
45410
45729
|
{
|
|
45411
45730
|
role: "dialog",
|
|
@@ -45445,7 +45764,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45445
45764
|
},
|
|
45446
45765
|
children: [
|
|
45447
45766
|
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
|
|
45448
|
-
/* @__PURE__ */
|
|
45767
|
+
/* @__PURE__ */ jsx36(
|
|
45449
45768
|
"h2",
|
|
45450
45769
|
{
|
|
45451
45770
|
style: {
|
|
@@ -45457,7 +45776,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45457
45776
|
children: "Keyboard Shortcuts"
|
|
45458
45777
|
}
|
|
45459
45778
|
),
|
|
45460
|
-
/* @__PURE__ */
|
|
45779
|
+
/* @__PURE__ */ jsx36(
|
|
45461
45780
|
"button",
|
|
45462
45781
|
{
|
|
45463
45782
|
type: "button",
|
|
@@ -45473,7 +45792,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45473
45792
|
}
|
|
45474
45793
|
)
|
|
45475
45794
|
] }),
|
|
45476
|
-
/* @__PURE__ */
|
|
45795
|
+
/* @__PURE__ */ jsx36(
|
|
45477
45796
|
"input",
|
|
45478
45797
|
{
|
|
45479
45798
|
ref: inputRef,
|
|
@@ -45496,7 +45815,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45496
45815
|
]
|
|
45497
45816
|
}
|
|
45498
45817
|
),
|
|
45499
|
-
/* @__PURE__ */
|
|
45818
|
+
/* @__PURE__ */ jsx36("div", { style: { overflowY: "auto" }, children: /* @__PURE__ */ jsxs10(
|
|
45500
45819
|
"table",
|
|
45501
45820
|
{
|
|
45502
45821
|
style: {
|
|
@@ -45505,11 +45824,11 @@ var KeyboardShortcutsDialog = ({
|
|
|
45505
45824
|
fontSize: "0.95rem"
|
|
45506
45825
|
},
|
|
45507
45826
|
children: [
|
|
45508
|
-
/* @__PURE__ */
|
|
45509
|
-
/* @__PURE__ */
|
|
45510
|
-
/* @__PURE__ */
|
|
45827
|
+
/* @__PURE__ */ jsx36("thead", { children: /* @__PURE__ */ jsxs10("tr", { style: { textAlign: "left", color: "#a1a1b5" }, children: [
|
|
45828
|
+
/* @__PURE__ */ jsx36("th", { style: { padding: "12px 24px", width: "25%" }, children: "Key" }),
|
|
45829
|
+
/* @__PURE__ */ jsx36("th", { style: { padding: "12px 24px" }, children: "Description" })
|
|
45511
45830
|
] }) }),
|
|
45512
|
-
/* @__PURE__ */
|
|
45831
|
+
/* @__PURE__ */ jsx36("tbody", { children: filteredHotkeys.length === 0 ? /* @__PURE__ */ jsx36("tr", { children: /* @__PURE__ */ jsx36(
|
|
45513
45832
|
"td",
|
|
45514
45833
|
{
|
|
45515
45834
|
colSpan: 2,
|
|
@@ -45521,7 +45840,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45521
45840
|
{
|
|
45522
45841
|
style: { borderTop: "1px solid rgba(255, 255, 255, 0.05)" },
|
|
45523
45842
|
children: [
|
|
45524
|
-
/* @__PURE__ */
|
|
45843
|
+
/* @__PURE__ */ jsx36("td", { style: { padding: "12px 24px" }, children: /* @__PURE__ */ jsx36(
|
|
45525
45844
|
"span",
|
|
45526
45845
|
{
|
|
45527
45846
|
style: {
|
|
@@ -45539,7 +45858,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45539
45858
|
children: hotkey.shortcut
|
|
45540
45859
|
}
|
|
45541
45860
|
) }),
|
|
45542
|
-
/* @__PURE__ */
|
|
45861
|
+
/* @__PURE__ */ jsx36("td", { style: { padding: "12px 24px" }, children: hotkey.description })
|
|
45543
45862
|
]
|
|
45544
45863
|
},
|
|
45545
45864
|
hotkey.id
|
|
@@ -45555,8 +45874,8 @@ var KeyboardShortcutsDialog = ({
|
|
|
45555
45874
|
};
|
|
45556
45875
|
|
|
45557
45876
|
// src/CadViewer.tsx
|
|
45558
|
-
import { jsx as
|
|
45559
|
-
var DEFAULT_TARGET = new
|
|
45877
|
+
import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
45878
|
+
var DEFAULT_TARGET = new THREE44.Vector3(0, 0, 0);
|
|
45560
45879
|
var INITIAL_CAMERA_POSITION = [5, -5, 5];
|
|
45561
45880
|
var readStoredCameraType = () => {
|
|
45562
45881
|
if (typeof window === "undefined") return void 0;
|
|
@@ -45564,25 +45883,25 @@ var readStoredCameraType = () => {
|
|
|
45564
45883
|
return stored === "orthographic" || stored === "perspective" ? stored : void 0;
|
|
45565
45884
|
};
|
|
45566
45885
|
var CadViewerInner = (props) => {
|
|
45567
|
-
const [engine, setEngine] =
|
|
45886
|
+
const [engine, setEngine] = useState37(() => {
|
|
45568
45887
|
const stored = window.localStorage.getItem("cadViewerEngine");
|
|
45569
45888
|
return stored === "jscad" || stored === "manifold" ? stored : "manifold";
|
|
45570
45889
|
});
|
|
45571
|
-
const containerRef =
|
|
45572
|
-
const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] =
|
|
45573
|
-
const [autoRotate, setAutoRotate] =
|
|
45890
|
+
const containerRef = useRef28(null);
|
|
45891
|
+
const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] = useState37(false);
|
|
45892
|
+
const [autoRotate, setAutoRotate] = useState37(() => {
|
|
45574
45893
|
const stored = window.localStorage.getItem("cadViewerAutoRotate");
|
|
45575
45894
|
return stored === "false" ? false : true;
|
|
45576
45895
|
});
|
|
45577
|
-
const [autoRotateUserToggled, setAutoRotateUserToggled] =
|
|
45896
|
+
const [autoRotateUserToggled, setAutoRotateUserToggled] = useState37(() => {
|
|
45578
45897
|
const stored = window.localStorage.getItem("cadViewerAutoRotateUserToggled");
|
|
45579
45898
|
return stored === "true";
|
|
45580
45899
|
});
|
|
45581
|
-
const [cameraPreset, setCameraPreset] =
|
|
45900
|
+
const [cameraPreset, setCameraPreset] = useState37("Custom");
|
|
45582
45901
|
const { cameraType, setCameraType } = useCameraController();
|
|
45583
45902
|
const { visibility, setLayerVisibility } = useLayerVisibility();
|
|
45584
45903
|
const { showToast } = useToast();
|
|
45585
|
-
const cameraControllerRef =
|
|
45904
|
+
const cameraControllerRef = useRef28(null);
|
|
45586
45905
|
const externalCameraControllerReady = props.onCameraControllerReady;
|
|
45587
45906
|
const {
|
|
45588
45907
|
menuVisible,
|
|
@@ -45591,12 +45910,12 @@ var CadViewerInner = (props) => {
|
|
|
45591
45910
|
contextMenuEventHandlers,
|
|
45592
45911
|
setMenuVisible
|
|
45593
45912
|
} = useContextMenu({ containerRef });
|
|
45594
|
-
const autoRotateUserToggledRef =
|
|
45913
|
+
const autoRotateUserToggledRef = useRef28(autoRotateUserToggled);
|
|
45595
45914
|
autoRotateUserToggledRef.current = autoRotateUserToggled;
|
|
45596
|
-
const isAnimatingRef =
|
|
45597
|
-
const lastPresetSelectTime =
|
|
45915
|
+
const isAnimatingRef = useRef28(false);
|
|
45916
|
+
const lastPresetSelectTime = useRef28(0);
|
|
45598
45917
|
const PRESET_COOLDOWN = 1e3;
|
|
45599
|
-
const handleUserInteraction =
|
|
45918
|
+
const handleUserInteraction = useCallback23(() => {
|
|
45600
45919
|
if (isAnimatingRef.current || Date.now() - lastPresetSelectTime.current < PRESET_COOLDOWN) {
|
|
45601
45920
|
return;
|
|
45602
45921
|
}
|
|
@@ -45607,15 +45926,15 @@ var CadViewerInner = (props) => {
|
|
|
45607
45926
|
setCameraPreset("Custom");
|
|
45608
45927
|
}
|
|
45609
45928
|
}, [menuVisible]);
|
|
45610
|
-
const toggleAutoRotate =
|
|
45929
|
+
const toggleAutoRotate = useCallback23(() => {
|
|
45611
45930
|
setAutoRotate((prev) => !prev);
|
|
45612
45931
|
setAutoRotateUserToggled(true);
|
|
45613
45932
|
}, []);
|
|
45614
45933
|
const downloadGltf = useGlobalDownloadGltf();
|
|
45615
|
-
const closeMenu =
|
|
45934
|
+
const closeMenu = useCallback23(() => {
|
|
45616
45935
|
setMenuVisible(false);
|
|
45617
45936
|
}, [setMenuVisible]);
|
|
45618
|
-
const handleCameraControllerReady =
|
|
45937
|
+
const handleCameraControllerReady = useCallback23(
|
|
45619
45938
|
(controller) => {
|
|
45620
45939
|
cameraControllerRef.current = controller;
|
|
45621
45940
|
externalCameraControllerReady?.(controller);
|
|
@@ -45689,24 +46008,24 @@ var CadViewerInner = (props) => {
|
|
|
45689
46008
|
description: "Toggle translucent components"
|
|
45690
46009
|
}
|
|
45691
46010
|
);
|
|
45692
|
-
|
|
46011
|
+
useEffect47(() => {
|
|
45693
46012
|
if (containerRef.current) {
|
|
45694
46013
|
registerHotkeyViewer(containerRef.current);
|
|
45695
46014
|
}
|
|
45696
46015
|
}, []);
|
|
45697
|
-
|
|
46016
|
+
useEffect47(() => {
|
|
45698
46017
|
window.localStorage.setItem("cadViewerEngine", engine);
|
|
45699
46018
|
}, [engine]);
|
|
45700
|
-
|
|
46019
|
+
useEffect47(() => {
|
|
45701
46020
|
window.localStorage.setItem("cadViewerAutoRotate", String(autoRotate));
|
|
45702
46021
|
}, [autoRotate]);
|
|
45703
|
-
|
|
46022
|
+
useEffect47(() => {
|
|
45704
46023
|
window.localStorage.setItem(
|
|
45705
46024
|
"cadViewerAutoRotateUserToggled",
|
|
45706
46025
|
String(autoRotateUserToggled)
|
|
45707
46026
|
);
|
|
45708
46027
|
}, [autoRotateUserToggled]);
|
|
45709
|
-
|
|
46028
|
+
useEffect47(() => {
|
|
45710
46029
|
window.localStorage.setItem("cadViewerCameraType", cameraType);
|
|
45711
46030
|
}, [cameraType]);
|
|
45712
46031
|
const viewerKey = props.circuitJson ? JSON.stringify(props.circuitJson) : void 0;
|
|
@@ -45726,7 +46045,7 @@ var CadViewerInner = (props) => {
|
|
|
45726
46045
|
},
|
|
45727
46046
|
...contextMenuEventHandlers,
|
|
45728
46047
|
children: [
|
|
45729
|
-
engine === "jscad" ? /* @__PURE__ */
|
|
46048
|
+
engine === "jscad" ? /* @__PURE__ */ jsx37(
|
|
45730
46049
|
CadViewerJscad,
|
|
45731
46050
|
{
|
|
45732
46051
|
...props,
|
|
@@ -45735,7 +46054,7 @@ var CadViewerInner = (props) => {
|
|
|
45735
46054
|
onUserInteraction: handleUserInteraction,
|
|
45736
46055
|
onCameraControllerReady: handleCameraControllerReady
|
|
45737
46056
|
}
|
|
45738
|
-
) : /* @__PURE__ */
|
|
46057
|
+
) : /* @__PURE__ */ jsx37(
|
|
45739
46058
|
CadViewerManifold_default,
|
|
45740
46059
|
{
|
|
45741
46060
|
...props,
|
|
@@ -45762,11 +46081,11 @@ var CadViewerInner = (props) => {
|
|
|
45762
46081
|
},
|
|
45763
46082
|
children: [
|
|
45764
46083
|
"Engine: ",
|
|
45765
|
-
/* @__PURE__ */
|
|
46084
|
+
/* @__PURE__ */ jsx37("b", { children: engine === "jscad" ? "JSCAD" : "Manifold" })
|
|
45766
46085
|
]
|
|
45767
46086
|
}
|
|
45768
46087
|
),
|
|
45769
|
-
menuVisible && /* @__PURE__ */
|
|
46088
|
+
menuVisible && /* @__PURE__ */ jsx37(
|
|
45770
46089
|
ContextMenu,
|
|
45771
46090
|
{
|
|
45772
46091
|
menuRef,
|
|
@@ -45793,7 +46112,7 @@ var CadViewerInner = (props) => {
|
|
|
45793
46112
|
}
|
|
45794
46113
|
}
|
|
45795
46114
|
),
|
|
45796
|
-
/* @__PURE__ */
|
|
46115
|
+
/* @__PURE__ */ jsx37(
|
|
45797
46116
|
KeyboardShortcutsDialog,
|
|
45798
46117
|
{
|
|
45799
46118
|
open: isKeyboardShortcutsDialogOpen,
|
|
@@ -45806,13 +46125,13 @@ var CadViewerInner = (props) => {
|
|
|
45806
46125
|
);
|
|
45807
46126
|
};
|
|
45808
46127
|
var CadViewer = (props) => {
|
|
45809
|
-
return /* @__PURE__ */
|
|
46128
|
+
return /* @__PURE__ */ jsx37(
|
|
45810
46129
|
CameraControllerProvider,
|
|
45811
46130
|
{
|
|
45812
46131
|
defaultTarget: DEFAULT_TARGET,
|
|
45813
46132
|
initialCameraPosition: INITIAL_CAMERA_POSITION,
|
|
45814
46133
|
initialCameraType: readStoredCameraType(),
|
|
45815
|
-
children: /* @__PURE__ */
|
|
46134
|
+
children: /* @__PURE__ */ jsx37(LayerVisibilityProvider, { children: /* @__PURE__ */ jsx37(ToastProvider, { children: /* @__PURE__ */ jsx37(CadViewerInner, { ...props }) }) })
|
|
45816
46135
|
}
|
|
45817
46136
|
);
|
|
45818
46137
|
};
|
|
@@ -45820,11 +46139,11 @@ var CadViewer = (props) => {
|
|
|
45820
46139
|
// src/convert-circuit-json-to-3d-svg.ts
|
|
45821
46140
|
var import_debug = __toESM(require_browser(), 1);
|
|
45822
46141
|
import { su as su18 } from "@tscircuit/circuit-json-util";
|
|
45823
|
-
import * as
|
|
46142
|
+
import * as THREE48 from "three";
|
|
45824
46143
|
import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
|
|
45825
46144
|
|
|
45826
46145
|
// src/utils/create-geometry-from-polygons.ts
|
|
45827
|
-
import * as
|
|
46146
|
+
import * as THREE45 from "three";
|
|
45828
46147
|
import { BufferGeometry as BufferGeometry4, Float32BufferAttribute as Float32BufferAttribute3 } from "three";
|
|
45829
46148
|
function createGeometryFromPolygons(polygons) {
|
|
45830
46149
|
const geometry = new BufferGeometry4();
|
|
@@ -45838,12 +46157,12 @@ function createGeometryFromPolygons(polygons) {
|
|
|
45838
46157
|
...polygon2.vertices[i + 1]
|
|
45839
46158
|
// Third vertex
|
|
45840
46159
|
);
|
|
45841
|
-
const v1 = new
|
|
45842
|
-
const v2 = new
|
|
45843
|
-
const v3 = new
|
|
45844
|
-
const normal = new
|
|
45845
|
-
new
|
|
45846
|
-
new
|
|
46160
|
+
const v1 = new THREE45.Vector3(...polygon2.vertices[0]);
|
|
46161
|
+
const v2 = new THREE45.Vector3(...polygon2.vertices[i]);
|
|
46162
|
+
const v3 = new THREE45.Vector3(...polygon2.vertices[i + 1]);
|
|
46163
|
+
const normal = new THREE45.Vector3().crossVectors(
|
|
46164
|
+
new THREE45.Vector3().subVectors(v2, v1),
|
|
46165
|
+
new THREE45.Vector3().subVectors(v3, v1)
|
|
45847
46166
|
).normalize();
|
|
45848
46167
|
normals.push(
|
|
45849
46168
|
normal.x,
|
|
@@ -45867,10 +46186,10 @@ function createGeometryFromPolygons(polygons) {
|
|
|
45867
46186
|
var import_modeling2 = __toESM(require_src(), 1);
|
|
45868
46187
|
var import_jscad_planner2 = __toESM(require_dist(), 1);
|
|
45869
46188
|
var jscadModeling2 = __toESM(require_src(), 1);
|
|
45870
|
-
import * as
|
|
46189
|
+
import * as THREE47 from "three";
|
|
45871
46190
|
|
|
45872
46191
|
// src/utils/load-model.ts
|
|
45873
|
-
import * as
|
|
46192
|
+
import * as THREE46 from "three";
|
|
45874
46193
|
import { GLTFLoader as GLTFLoader2 } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
45875
46194
|
import { OBJLoader as OBJLoader2 } from "three/examples/jsm/loaders/OBJLoader.js";
|
|
45876
46195
|
import { STLLoader as STLLoader2 } from "three/examples/jsm/loaders/STLLoader.js";
|
|
@@ -45878,12 +46197,12 @@ async function load3DModel(url) {
|
|
|
45878
46197
|
if (url.endsWith(".stl")) {
|
|
45879
46198
|
const loader = new STLLoader2();
|
|
45880
46199
|
const geometry = await loader.loadAsync(url);
|
|
45881
|
-
const material = new
|
|
46200
|
+
const material = new THREE46.MeshStandardMaterial({
|
|
45882
46201
|
color: 8947848,
|
|
45883
46202
|
metalness: 0.5,
|
|
45884
46203
|
roughness: 0.5
|
|
45885
46204
|
});
|
|
45886
|
-
return new
|
|
46205
|
+
return new THREE46.Mesh(geometry, material);
|
|
45887
46206
|
}
|
|
45888
46207
|
if (url.endsWith(".obj")) {
|
|
45889
46208
|
const loader = new OBJLoader2();
|
|
@@ -45916,9 +46235,9 @@ async function renderComponent(component, scene) {
|
|
|
45916
46235
|
}
|
|
45917
46236
|
if (component.rotation) {
|
|
45918
46237
|
model.rotation.set(
|
|
45919
|
-
|
|
45920
|
-
|
|
45921
|
-
|
|
46238
|
+
THREE47.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
46239
|
+
THREE47.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
46240
|
+
THREE47.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
45922
46241
|
);
|
|
45923
46242
|
}
|
|
45924
46243
|
scene.add(model);
|
|
@@ -45932,13 +46251,13 @@ async function renderComponent(component, scene) {
|
|
|
45932
46251
|
);
|
|
45933
46252
|
if (jscadObject && (jscadObject.polygons || jscadObject.sides)) {
|
|
45934
46253
|
const threeGeom = convertCSGToThreeGeom(jscadObject);
|
|
45935
|
-
const material2 = new
|
|
46254
|
+
const material2 = new THREE47.MeshStandardMaterial({
|
|
45936
46255
|
color: 8947848,
|
|
45937
46256
|
metalness: 0.5,
|
|
45938
46257
|
roughness: 0.5,
|
|
45939
|
-
side:
|
|
46258
|
+
side: THREE47.DoubleSide
|
|
45940
46259
|
});
|
|
45941
|
-
const mesh2 = new
|
|
46260
|
+
const mesh2 = new THREE47.Mesh(threeGeom, material2);
|
|
45942
46261
|
if (component.position) {
|
|
45943
46262
|
mesh2.position.set(
|
|
45944
46263
|
component.position.x ?? 0,
|
|
@@ -45948,9 +46267,9 @@ async function renderComponent(component, scene) {
|
|
|
45948
46267
|
}
|
|
45949
46268
|
if (component.rotation) {
|
|
45950
46269
|
mesh2.rotation.set(
|
|
45951
|
-
|
|
45952
|
-
|
|
45953
|
-
|
|
46270
|
+
THREE47.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
46271
|
+
THREE47.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
46272
|
+
THREE47.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
45954
46273
|
);
|
|
45955
46274
|
}
|
|
45956
46275
|
scene.add(mesh2);
|
|
@@ -45967,17 +46286,17 @@ async function renderComponent(component, scene) {
|
|
|
45967
46286
|
if (!geom || !geom.polygons && !geom.sides) {
|
|
45968
46287
|
continue;
|
|
45969
46288
|
}
|
|
45970
|
-
const color = new
|
|
46289
|
+
const color = new THREE47.Color(geomInfo.color);
|
|
45971
46290
|
color.convertLinearToSRGB();
|
|
45972
46291
|
const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
|
|
45973
46292
|
const threeGeom = convertCSGToThreeGeom(geomWithColor);
|
|
45974
|
-
const material2 = new
|
|
46293
|
+
const material2 = new THREE47.MeshStandardMaterial({
|
|
45975
46294
|
vertexColors: true,
|
|
45976
46295
|
metalness: 0.2,
|
|
45977
46296
|
roughness: 0.8,
|
|
45978
|
-
side:
|
|
46297
|
+
side: THREE47.DoubleSide
|
|
45979
46298
|
});
|
|
45980
|
-
const mesh2 = new
|
|
46299
|
+
const mesh2 = new THREE47.Mesh(threeGeom, material2);
|
|
45981
46300
|
if (component.position) {
|
|
45982
46301
|
mesh2.position.set(
|
|
45983
46302
|
component.position.x ?? 0,
|
|
@@ -45987,22 +46306,22 @@ async function renderComponent(component, scene) {
|
|
|
45987
46306
|
}
|
|
45988
46307
|
if (component.rotation) {
|
|
45989
46308
|
mesh2.rotation.set(
|
|
45990
|
-
|
|
45991
|
-
|
|
45992
|
-
|
|
46309
|
+
THREE47.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
46310
|
+
THREE47.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
46311
|
+
THREE47.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
45993
46312
|
);
|
|
45994
46313
|
}
|
|
45995
46314
|
scene.add(mesh2);
|
|
45996
46315
|
}
|
|
45997
46316
|
return;
|
|
45998
46317
|
}
|
|
45999
|
-
const geometry = new
|
|
46000
|
-
const material = new
|
|
46318
|
+
const geometry = new THREE47.BoxGeometry(0.5, 0.5, 0.5);
|
|
46319
|
+
const material = new THREE47.MeshStandardMaterial({
|
|
46001
46320
|
color: 16711680,
|
|
46002
46321
|
transparent: true,
|
|
46003
46322
|
opacity: 0.25
|
|
46004
46323
|
});
|
|
46005
|
-
const mesh = new
|
|
46324
|
+
const mesh = new THREE47.Mesh(geometry, material);
|
|
46006
46325
|
if (component.position) {
|
|
46007
46326
|
mesh.position.set(
|
|
46008
46327
|
component.position.x ?? 0,
|
|
@@ -46023,11 +46342,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46023
46342
|
padding = 20,
|
|
46024
46343
|
zoom = 1.5
|
|
46025
46344
|
} = options;
|
|
46026
|
-
const scene = new
|
|
46345
|
+
const scene = new THREE48.Scene();
|
|
46027
46346
|
const renderer = new SVGRenderer();
|
|
46028
46347
|
renderer.setSize(width10, height10);
|
|
46029
|
-
renderer.setClearColor(new
|
|
46030
|
-
const camera = new
|
|
46348
|
+
renderer.setClearColor(new THREE48.Color(backgroundColor), 1);
|
|
46349
|
+
const camera = new THREE48.OrthographicCamera();
|
|
46031
46350
|
const aspect = width10 / height10;
|
|
46032
46351
|
const frustumSize = 100;
|
|
46033
46352
|
const halfFrustumSize = frustumSize / 2 / zoom;
|
|
@@ -46041,11 +46360,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46041
46360
|
camera.position.set(position.x, position.y, position.z);
|
|
46042
46361
|
camera.up.set(0, 1, 0);
|
|
46043
46362
|
const lookAt = options.camera?.lookAt ?? { x: 0, y: 0, z: 0 };
|
|
46044
|
-
camera.lookAt(new
|
|
46363
|
+
camera.lookAt(new THREE48.Vector3(lookAt.x, lookAt.y, lookAt.z));
|
|
46045
46364
|
camera.updateProjectionMatrix();
|
|
46046
|
-
const ambientLight = new
|
|
46365
|
+
const ambientLight = new THREE48.AmbientLight(16777215, Math.PI / 2);
|
|
46047
46366
|
scene.add(ambientLight);
|
|
46048
|
-
const pointLight = new
|
|
46367
|
+
const pointLight = new THREE48.PointLight(16777215, Math.PI / 4);
|
|
46049
46368
|
pointLight.position.set(-10, -10, 10);
|
|
46050
46369
|
scene.add(pointLight);
|
|
46051
46370
|
const components = su18(circuitJson).cad_component.list();
|
|
@@ -46053,10 +46372,10 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46053
46372
|
await renderComponent(component, scene);
|
|
46054
46373
|
}
|
|
46055
46374
|
const boardData = su18(circuitJson).pcb_board.list()[0];
|
|
46056
|
-
const boardGeom =
|
|
46375
|
+
const boardGeom = createSimplifiedBoardGeom(circuitJson);
|
|
46057
46376
|
if (boardGeom) {
|
|
46058
46377
|
const solderMaskColor = colors.fr4SolderMaskGreen;
|
|
46059
|
-
const baseColor = new
|
|
46378
|
+
const baseColor = new THREE48.Color(
|
|
46060
46379
|
solderMaskColor[0],
|
|
46061
46380
|
solderMaskColor[1],
|
|
46062
46381
|
solderMaskColor[2]
|
|
@@ -46068,28 +46387,28 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46068
46387
|
const material = createBoardMaterial({
|
|
46069
46388
|
material: boardData?.material,
|
|
46070
46389
|
color: baseColor,
|
|
46071
|
-
side:
|
|
46390
|
+
side: THREE48.DoubleSide
|
|
46072
46391
|
});
|
|
46073
|
-
const mesh = new
|
|
46392
|
+
const mesh = new THREE48.Mesh(geometry, material);
|
|
46074
46393
|
scene.add(mesh);
|
|
46075
46394
|
}
|
|
46076
46395
|
}
|
|
46077
|
-
const gridColor = new
|
|
46078
|
-
const gridHelper = new
|
|
46396
|
+
const gridColor = new THREE48.Color(8947848);
|
|
46397
|
+
const gridHelper = new THREE48.GridHelper(100, 100, gridColor, gridColor);
|
|
46079
46398
|
gridHelper.rotation.x = Math.PI / 2;
|
|
46080
46399
|
const materials = Array.isArray(gridHelper.material) ? gridHelper.material : [gridHelper.material];
|
|
46081
46400
|
for (const mat of materials) {
|
|
46082
46401
|
mat.transparent = true;
|
|
46083
46402
|
mat.opacity = 0.3;
|
|
46084
|
-
if (mat instanceof
|
|
46403
|
+
if (mat instanceof THREE48.LineBasicMaterial) {
|
|
46085
46404
|
mat.color = gridColor;
|
|
46086
46405
|
mat.vertexColors = false;
|
|
46087
46406
|
}
|
|
46088
46407
|
}
|
|
46089
46408
|
scene.add(gridHelper);
|
|
46090
|
-
const box = new
|
|
46091
|
-
const center = box.getCenter(new
|
|
46092
|
-
const size4 = box.getSize(new
|
|
46409
|
+
const box = new THREE48.Box3().setFromObject(scene);
|
|
46410
|
+
const center = box.getCenter(new THREE48.Vector3());
|
|
46411
|
+
const size4 = box.getSize(new THREE48.Vector3());
|
|
46093
46412
|
scene.position.sub(center);
|
|
46094
46413
|
const maxDim = Math.max(size4.x, size4.y, size4.z);
|
|
46095
46414
|
if (maxDim > 0) {
|
|
@@ -46107,7 +46426,7 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46107
46426
|
|
|
46108
46427
|
// src/hooks/exporter/gltf.ts
|
|
46109
46428
|
import { GLTFExporter as GLTFExporter3 } from "three-stdlib";
|
|
46110
|
-
import { useEffect as
|
|
46429
|
+
import { useEffect as useEffect48, useState as useState38, useMemo as useMemo30, useCallback as useCallback24 } from "react";
|
|
46111
46430
|
function useSaveGltfAs(options = {}) {
|
|
46112
46431
|
const parse2 = useParser(options);
|
|
46113
46432
|
const link = useMemo30(() => document.createElement("a"), []);
|
|
@@ -46120,7 +46439,7 @@ function useSaveGltfAs(options = {}) {
|
|
|
46120
46439
|
link.dispatchEvent(new MouseEvent("click"));
|
|
46121
46440
|
URL.revokeObjectURL(url);
|
|
46122
46441
|
};
|
|
46123
|
-
|
|
46442
|
+
useEffect48(
|
|
46124
46443
|
() => () => {
|
|
46125
46444
|
link.remove();
|
|
46126
46445
|
instance = null;
|
|
@@ -46128,20 +46447,20 @@ function useSaveGltfAs(options = {}) {
|
|
|
46128
46447
|
[]
|
|
46129
46448
|
);
|
|
46130
46449
|
let instance;
|
|
46131
|
-
const ref =
|
|
46450
|
+
const ref = useCallback24((obj3D) => {
|
|
46132
46451
|
instance = obj3D;
|
|
46133
46452
|
}, []);
|
|
46134
46453
|
return [ref, saveAs];
|
|
46135
46454
|
}
|
|
46136
46455
|
function useExportGltfUrl(options = {}) {
|
|
46137
46456
|
const parse2 = useParser(options);
|
|
46138
|
-
const [url, setUrl] =
|
|
46139
|
-
const [error, setError] =
|
|
46140
|
-
const ref =
|
|
46457
|
+
const [url, setUrl] = useState38();
|
|
46458
|
+
const [error, setError] = useState38();
|
|
46459
|
+
const ref = useCallback24(
|
|
46141
46460
|
(instance) => parse2(instance).then(setUrl).catch(setError),
|
|
46142
46461
|
[]
|
|
46143
46462
|
);
|
|
46144
|
-
|
|
46463
|
+
useEffect48(() => () => URL.revokeObjectURL(url), [url]);
|
|
46145
46464
|
return [ref, url, error];
|
|
46146
46465
|
}
|
|
46147
46466
|
function useParser(options = {}) {
|