jscad-electronics 0.0.151 → 0.0.153
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/README.md +35 -0
- package/dist/index.d.ts +106 -1
- package/dist/index.js +547 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -7308,6 +7308,550 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
7308
7308
|
}
|
|
7309
7309
|
return null;
|
|
7310
7310
|
};
|
|
7311
|
+
|
|
7312
|
+
// lib/FlexScreen.tsx
|
|
7313
|
+
import { Colorize as Colorize49, Rotate as Rotate19, RoundedCuboid as RoundedCuboid5, Translate as Translate39 } from "jscad-fiber";
|
|
7314
|
+
import { Fragment as Fragment80 } from "react";
|
|
7315
|
+
import { Fragment as Fragment81, jsx as jsx85, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
7316
|
+
var DEFAULT_ASPECT_RATIO = 16 / 9;
|
|
7317
|
+
var DEFAULT_DIAGONAL = 40;
|
|
7318
|
+
var EPSILON = 1e-6;
|
|
7319
|
+
var assertPositive = (name, value) => {
|
|
7320
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
7321
|
+
throw new Error(`${name} must be a finite number greater than zero`);
|
|
7322
|
+
}
|
|
7323
|
+
};
|
|
7324
|
+
var resolveAspectRatio = (value) => {
|
|
7325
|
+
if (value === void 0) return DEFAULT_ASPECT_RATIO;
|
|
7326
|
+
if (typeof value === "number") {
|
|
7327
|
+
assertPositive("aspectRatio", value);
|
|
7328
|
+
return value;
|
|
7329
|
+
}
|
|
7330
|
+
if (typeof value !== "string") {
|
|
7331
|
+
const [ratioWidth2, ratioHeight2] = value;
|
|
7332
|
+
assertPositive("aspectRatio width", ratioWidth2);
|
|
7333
|
+
assertPositive("aspectRatio height", ratioHeight2);
|
|
7334
|
+
return ratioWidth2 / ratioHeight2;
|
|
7335
|
+
}
|
|
7336
|
+
const parts = value.split(":");
|
|
7337
|
+
if (parts.length !== 2) {
|
|
7338
|
+
throw new Error('aspectRatio must look like "16:9"');
|
|
7339
|
+
}
|
|
7340
|
+
const ratioWidth = Number(parts[0]);
|
|
7341
|
+
const ratioHeight = Number(parts[1]);
|
|
7342
|
+
assertPositive("aspectRatio width", ratioWidth);
|
|
7343
|
+
assertPositive("aspectRatio height", ratioHeight);
|
|
7344
|
+
return ratioWidth / ratioHeight;
|
|
7345
|
+
};
|
|
7346
|
+
var resolveFlexScreenSize = ({
|
|
7347
|
+
width: width10,
|
|
7348
|
+
height: height10,
|
|
7349
|
+
diagonal,
|
|
7350
|
+
aspectRatio,
|
|
7351
|
+
ratio,
|
|
7352
|
+
defaultDiagonal = DEFAULT_DIAGONAL
|
|
7353
|
+
}) => {
|
|
7354
|
+
const resolvedRatio = resolveAspectRatio(aspectRatio ?? ratio);
|
|
7355
|
+
if (width10 !== void 0) assertPositive("width", width10);
|
|
7356
|
+
if (height10 !== void 0) assertPositive("height", height10);
|
|
7357
|
+
if (diagonal !== void 0) assertPositive("diagonal", diagonal);
|
|
7358
|
+
assertPositive("defaultDiagonal", defaultDiagonal);
|
|
7359
|
+
let resolvedWidth;
|
|
7360
|
+
let resolvedHeight;
|
|
7361
|
+
if (width10 !== void 0 && height10 !== void 0) {
|
|
7362
|
+
resolvedWidth = width10;
|
|
7363
|
+
resolvedHeight = height10;
|
|
7364
|
+
} else if (diagonal !== void 0 && width10 !== void 0) {
|
|
7365
|
+
if (width10 >= diagonal) {
|
|
7366
|
+
throw new Error("width must be smaller than diagonal");
|
|
7367
|
+
}
|
|
7368
|
+
resolvedWidth = width10;
|
|
7369
|
+
resolvedHeight = Math.sqrt(diagonal ** 2 - width10 ** 2);
|
|
7370
|
+
} else if (diagonal !== void 0 && height10 !== void 0) {
|
|
7371
|
+
if (height10 >= diagonal) {
|
|
7372
|
+
throw new Error("height must be smaller than diagonal");
|
|
7373
|
+
}
|
|
7374
|
+
resolvedWidth = Math.sqrt(diagonal ** 2 - height10 ** 2);
|
|
7375
|
+
resolvedHeight = height10;
|
|
7376
|
+
} else if (width10 !== void 0) {
|
|
7377
|
+
resolvedWidth = width10;
|
|
7378
|
+
resolvedHeight = width10 / resolvedRatio;
|
|
7379
|
+
} else if (height10 !== void 0) {
|
|
7380
|
+
resolvedWidth = height10 * resolvedRatio;
|
|
7381
|
+
resolvedHeight = height10;
|
|
7382
|
+
} else {
|
|
7383
|
+
const resolvedDiagonal = diagonal ?? defaultDiagonal;
|
|
7384
|
+
resolvedHeight = resolvedDiagonal / Math.sqrt(resolvedRatio ** 2 + 1);
|
|
7385
|
+
resolvedWidth = resolvedHeight * resolvedRatio;
|
|
7386
|
+
}
|
|
7387
|
+
return {
|
|
7388
|
+
width: resolvedWidth,
|
|
7389
|
+
height: resolvedHeight,
|
|
7390
|
+
diagonal: Math.hypot(resolvedWidth, resolvedHeight),
|
|
7391
|
+
aspectRatio: resolvedWidth / resolvedHeight
|
|
7392
|
+
};
|
|
7393
|
+
};
|
|
7394
|
+
var resolveOrientation = (props) => {
|
|
7395
|
+
const shortcuts = [
|
|
7396
|
+
["sitsFlat", props.sitsFlat],
|
|
7397
|
+
["sitsFlatBelowBoard", props.sitsFlatBelowBoard],
|
|
7398
|
+
["foldedToFaceAboveBoard", props.foldedToFaceAboveBoard],
|
|
7399
|
+
["foldedToFaceBelowBoard", props.foldedToFaceBelowBoard],
|
|
7400
|
+
["foldedToFaceAboveBoard", props.foldsAboveBoard],
|
|
7401
|
+
["foldedToFaceBelowBoard", props.foldsBelowBoard],
|
|
7402
|
+
["foldedToRightAngleAboveBoard", props.foldedToRightAngleAboveBoard],
|
|
7403
|
+
["foldedToRightAngleBelowBoard", props.foldedToRightAngleBelowBoard]
|
|
7404
|
+
].filter((entry) => entry[1]);
|
|
7405
|
+
if (shortcuts.length > 1) {
|
|
7406
|
+
throw new Error(
|
|
7407
|
+
"Only one FlexScreen boolean orientation shortcut can be true"
|
|
7408
|
+
);
|
|
7409
|
+
}
|
|
7410
|
+
return shortcuts[0]?.[0] ?? props.orientation ?? "sitsFlat";
|
|
7411
|
+
};
|
|
7412
|
+
var distance = (a, b) => Math.hypot(b[0] - a[0], b[1] - a[1], b[2] - a[2]);
|
|
7413
|
+
var interpolate = (a, b, progress) => [
|
|
7414
|
+
a[0] + (b[0] - a[0]) * progress,
|
|
7415
|
+
a[1] + (b[1] - a[1]) * progress,
|
|
7416
|
+
a[2] + (b[2] - a[2]) * progress
|
|
7417
|
+
];
|
|
7418
|
+
var getPathDistances = (points) => {
|
|
7419
|
+
const distances = [0];
|
|
7420
|
+
for (let index = 1; index < points.length; index += 1) {
|
|
7421
|
+
distances.push(
|
|
7422
|
+
distances[index - 1] + distance(points[index - 1], points[index])
|
|
7423
|
+
);
|
|
7424
|
+
}
|
|
7425
|
+
return distances;
|
|
7426
|
+
};
|
|
7427
|
+
var pointAtDistance = (points, distances, targetDistance) => {
|
|
7428
|
+
if (targetDistance <= 0) return points[0];
|
|
7429
|
+
const totalLength = distances.at(-1);
|
|
7430
|
+
if (targetDistance >= totalLength) return points.at(-1);
|
|
7431
|
+
for (let index = 1; index < points.length; index += 1) {
|
|
7432
|
+
if (distances[index] >= targetDistance) {
|
|
7433
|
+
const segmentStart = distances[index - 1];
|
|
7434
|
+
const segmentLength = distances[index] - segmentStart;
|
|
7435
|
+
return interpolate(
|
|
7436
|
+
points[index - 1],
|
|
7437
|
+
points[index],
|
|
7438
|
+
(targetDistance - segmentStart) / segmentLength
|
|
7439
|
+
);
|
|
7440
|
+
}
|
|
7441
|
+
}
|
|
7442
|
+
return points.at(-1);
|
|
7443
|
+
};
|
|
7444
|
+
var slicePath = (points, startDistance, endDistance) => {
|
|
7445
|
+
const distances = getPathDistances(points);
|
|
7446
|
+
const totalLength = distances.at(-1);
|
|
7447
|
+
const safeStart = Math.max(0, Math.min(startDistance, totalLength));
|
|
7448
|
+
const safeEnd = Math.max(safeStart, Math.min(endDistance, totalLength));
|
|
7449
|
+
const result = [pointAtDistance(points, distances, safeStart)];
|
|
7450
|
+
for (let index = 1; index < points.length - 1; index += 1) {
|
|
7451
|
+
if (distances[index] > safeStart && distances[index] < safeEnd) {
|
|
7452
|
+
result.push(points[index]);
|
|
7453
|
+
}
|
|
7454
|
+
}
|
|
7455
|
+
result.push(pointAtDistance(points, distances, safeEnd));
|
|
7456
|
+
return result;
|
|
7457
|
+
};
|
|
7458
|
+
var createFlatPath = (start, flexCableLength) => [
|
|
7459
|
+
start,
|
|
7460
|
+
[start[0], start[1] + flexCableLength, start[2]]
|
|
7461
|
+
];
|
|
7462
|
+
var createFoldedPath = ({
|
|
7463
|
+
start,
|
|
7464
|
+
endZ,
|
|
7465
|
+
flexCableLength,
|
|
7466
|
+
foldDistanceFromConnector,
|
|
7467
|
+
foldOutset,
|
|
7468
|
+
foldSegments
|
|
7469
|
+
}) => {
|
|
7470
|
+
const points = [start];
|
|
7471
|
+
const foldStart = [
|
|
7472
|
+
start[0],
|
|
7473
|
+
start[1] + foldDistanceFromConnector,
|
|
7474
|
+
start[2]
|
|
7475
|
+
];
|
|
7476
|
+
if (foldDistanceFromConnector > EPSILON) points.push(foldStart);
|
|
7477
|
+
for (let index = 1; index <= foldSegments; index += 1) {
|
|
7478
|
+
const angle = Math.PI * index / foldSegments;
|
|
7479
|
+
points.push([
|
|
7480
|
+
start[0],
|
|
7481
|
+
foldStart[1] + foldOutset * Math.sin(angle),
|
|
7482
|
+
start[2] + (endZ - start[2]) * (1 - Math.cos(angle)) / 2
|
|
7483
|
+
]);
|
|
7484
|
+
}
|
|
7485
|
+
const minimumLength = getPathDistances(points).at(-1);
|
|
7486
|
+
if (minimumLength > flexCableLength + EPSILON) {
|
|
7487
|
+
throw new Error(
|
|
7488
|
+
`flexCableLength must be at least ${minimumLength.toFixed(2)} for this 180-degree fold`
|
|
7489
|
+
);
|
|
7490
|
+
}
|
|
7491
|
+
const tailLength = Math.max(0, flexCableLength - minimumLength);
|
|
7492
|
+
if (tailLength > EPSILON) {
|
|
7493
|
+
const foldEnd = points.at(-1);
|
|
7494
|
+
points.push([foldEnd[0], foldEnd[1] - tailLength, foldEnd[2]]);
|
|
7495
|
+
}
|
|
7496
|
+
return points;
|
|
7497
|
+
};
|
|
7498
|
+
var createRightAnglePath = ({
|
|
7499
|
+
start,
|
|
7500
|
+
flexCableLength,
|
|
7501
|
+
bendRadius,
|
|
7502
|
+
bendSegments,
|
|
7503
|
+
verticalLead,
|
|
7504
|
+
direction
|
|
7505
|
+
}) => {
|
|
7506
|
+
const bendLengthPerRadius = 2 * bendSegments * Math.sin(Math.PI / (4 * bendSegments));
|
|
7507
|
+
const resolvedRadius = Math.min(
|
|
7508
|
+
bendRadius,
|
|
7509
|
+
flexCableLength / bendLengthPerRadius
|
|
7510
|
+
);
|
|
7511
|
+
const bendLength = resolvedRadius * bendLengthPerRadius;
|
|
7512
|
+
const remainingLength = Math.max(0, flexCableLength - bendLength);
|
|
7513
|
+
const resolvedVerticalLead = Math.min(verticalLead, remainingLength * 0.45);
|
|
7514
|
+
const horizontalLength = remainingLength - resolvedVerticalLead;
|
|
7515
|
+
const points = [start];
|
|
7516
|
+
if (horizontalLength > EPSILON) {
|
|
7517
|
+
points.push([start[0], start[1] + horizontalLength, start[2]]);
|
|
7518
|
+
}
|
|
7519
|
+
for (let index = 1; index <= bendSegments; index += 1) {
|
|
7520
|
+
const angle = Math.PI / 2 * index / bendSegments;
|
|
7521
|
+
points.push([
|
|
7522
|
+
start[0],
|
|
7523
|
+
start[1] + horizontalLength + resolvedRadius * Math.sin(angle),
|
|
7524
|
+
start[2] + direction * resolvedRadius * (1 - Math.cos(angle))
|
|
7525
|
+
]);
|
|
7526
|
+
}
|
|
7527
|
+
if (resolvedVerticalLead > EPSILON) {
|
|
7528
|
+
const arcEnd = points.at(-1);
|
|
7529
|
+
points.push([
|
|
7530
|
+
arcEnd[0],
|
|
7531
|
+
arcEnd[1],
|
|
7532
|
+
arcEnd[2] + direction * resolvedVerticalLead
|
|
7533
|
+
]);
|
|
7534
|
+
}
|
|
7535
|
+
return points;
|
|
7536
|
+
};
|
|
7537
|
+
var CableStrip = ({
|
|
7538
|
+
points,
|
|
7539
|
+
width: width10,
|
|
7540
|
+
thickness,
|
|
7541
|
+
color,
|
|
7542
|
+
acrossOffset = 0,
|
|
7543
|
+
normalOffset = 0,
|
|
7544
|
+
overlap = 0.03
|
|
7545
|
+
}) => /* @__PURE__ */ jsx85(Colorize49, { color, children: points.slice(1).map((point, index) => {
|
|
7546
|
+
const previous = points[index];
|
|
7547
|
+
const dx = point[0] - previous[0];
|
|
7548
|
+
const dy = point[1] - previous[1];
|
|
7549
|
+
const dz = point[2] - previous[2];
|
|
7550
|
+
const segmentLength = Math.hypot(dx, dy, dz);
|
|
7551
|
+
if (segmentLength < EPSILON) return null;
|
|
7552
|
+
const pitch = Math.asin(dz / segmentLength);
|
|
7553
|
+
const yaw = Math.atan2(-dx, dy);
|
|
7554
|
+
const midpoint = [
|
|
7555
|
+
(previous[0] + point[0]) / 2,
|
|
7556
|
+
(previous[1] + point[1]) / 2,
|
|
7557
|
+
(previous[2] + point[2]) / 2
|
|
7558
|
+
];
|
|
7559
|
+
const roundRadius = Math.max(
|
|
7560
|
+
1e-3,
|
|
7561
|
+
Math.min(width10, thickness, segmentLength) / 2 - 1e-3
|
|
7562
|
+
);
|
|
7563
|
+
return /* @__PURE__ */ jsx85(Translate39, { offset: midpoint, children: /* @__PURE__ */ jsx85(Rotate19, { rotation: [pitch, 0, yaw], children: /* @__PURE__ */ jsx85(
|
|
7564
|
+
RoundedCuboid5,
|
|
7565
|
+
{
|
|
7566
|
+
size: [width10, segmentLength + overlap, thickness],
|
|
7567
|
+
center: [acrossOffset, 0, normalOffset],
|
|
7568
|
+
roundRadius
|
|
7569
|
+
}
|
|
7570
|
+
) }) }, `${index}:${midpoint.join(":")}`);
|
|
7571
|
+
}) });
|
|
7572
|
+
var FlexScreen = (props) => {
|
|
7573
|
+
const {
|
|
7574
|
+
width: width10,
|
|
7575
|
+
height: height10,
|
|
7576
|
+
diagonal,
|
|
7577
|
+
aspectRatio,
|
|
7578
|
+
ratio,
|
|
7579
|
+
defaultDiagonal,
|
|
7580
|
+
screenThickness = 1.2,
|
|
7581
|
+
bezelInset = 2,
|
|
7582
|
+
bezelDepth = 0.65,
|
|
7583
|
+
activeAreaWidth,
|
|
7584
|
+
activeAreaHeight,
|
|
7585
|
+
screenColor = "#071b24",
|
|
7586
|
+
bezelColor = "#15181d",
|
|
7587
|
+
showScreen = true,
|
|
7588
|
+
flexCableLength = 28,
|
|
7589
|
+
flexCableThickness = 0.18,
|
|
7590
|
+
flexCableColor = "#d79528",
|
|
7591
|
+
conductorCount = 8,
|
|
7592
|
+
conductorPitch,
|
|
7593
|
+
conductorWidth,
|
|
7594
|
+
conductorThickness = 0.035,
|
|
7595
|
+
conductorColor = "#8c4a18",
|
|
7596
|
+
cableEdgeMargin = 0.6,
|
|
7597
|
+
exposedContactLength = 2.4,
|
|
7598
|
+
showConductors = true,
|
|
7599
|
+
showFlexCable = true,
|
|
7600
|
+
showStiffeners = true,
|
|
7601
|
+
stiffenerLength = 3,
|
|
7602
|
+
stiffenerThickness = 0.16,
|
|
7603
|
+
stiffenerColor = "#416bb3",
|
|
7604
|
+
bendRadius = 3,
|
|
7605
|
+
bendSegments = 10,
|
|
7606
|
+
rightAngleVerticalLead = 3,
|
|
7607
|
+
distanceAboveBoard = 7,
|
|
7608
|
+
distanceBelowBoard = 7,
|
|
7609
|
+
foldDistanceFromConnector = 7,
|
|
7610
|
+
foldOutset = 4,
|
|
7611
|
+
foldSegments = 18,
|
|
7612
|
+
screenGap = 0.08,
|
|
7613
|
+
boardTopZ = 0,
|
|
7614
|
+
boardThickness = 1.6,
|
|
7615
|
+
boardClearance = 0.15,
|
|
7616
|
+
cableStartX = 0,
|
|
7617
|
+
cableStartY = 0,
|
|
7618
|
+
cableStartZ,
|
|
7619
|
+
cableLateralOffset = 0,
|
|
7620
|
+
screenOffset,
|
|
7621
|
+
screenRotation,
|
|
7622
|
+
rotation = [0, 0, 0],
|
|
7623
|
+
offset
|
|
7624
|
+
} = props;
|
|
7625
|
+
const size = resolveFlexScreenSize({
|
|
7626
|
+
width: width10,
|
|
7627
|
+
height: height10,
|
|
7628
|
+
diagonal,
|
|
7629
|
+
aspectRatio,
|
|
7630
|
+
ratio,
|
|
7631
|
+
defaultDiagonal
|
|
7632
|
+
});
|
|
7633
|
+
const orientation = resolveOrientation(props);
|
|
7634
|
+
const belowBoard = orientation === "sitsFlatBelowBoard" || orientation === "foldedToFaceBelowBoard" || orientation === "foldedToRightAngleBelowBoard";
|
|
7635
|
+
const foldedFace = orientation === "foldedToFaceAboveBoard" || orientation === "foldedToFaceBelowBoard";
|
|
7636
|
+
const rightAngle = orientation === "foldedToRightAngleAboveBoard" || orientation === "foldedToRightAngleBelowBoard";
|
|
7637
|
+
assertPositive("screenThickness", screenThickness);
|
|
7638
|
+
assertPositive("flexCableLength", flexCableLength);
|
|
7639
|
+
assertPositive("flexCableThickness", flexCableThickness);
|
|
7640
|
+
assertPositive("conductorThickness", conductorThickness);
|
|
7641
|
+
assertPositive("bendRadius", bendRadius);
|
|
7642
|
+
assertPositive("foldOutset", foldOutset);
|
|
7643
|
+
assertPositive("boardThickness", boardThickness);
|
|
7644
|
+
if (showStiffeners) assertPositive("stiffenerThickness", stiffenerThickness);
|
|
7645
|
+
if (!Number.isInteger(conductorCount) || conductorCount < 1) {
|
|
7646
|
+
throw new Error("conductorCount must be a positive integer");
|
|
7647
|
+
}
|
|
7648
|
+
if (!Number.isInteger(bendSegments) || bendSegments < 2) {
|
|
7649
|
+
throw new Error("bendSegments must be an integer of at least 2");
|
|
7650
|
+
}
|
|
7651
|
+
if (!Number.isInteger(foldSegments) || foldSegments < 4) {
|
|
7652
|
+
throw new Error("foldSegments must be an integer of at least 4");
|
|
7653
|
+
}
|
|
7654
|
+
if (boardClearance < 0 || screenGap < 0 || cableEdgeMargin < 0 || exposedContactLength < 0 || stiffenerLength < 0 || rightAngleVerticalLead < 0 || distanceAboveBoard < 0 || distanceBelowBoard < 0 || foldDistanceFromConnector < 0) {
|
|
7655
|
+
throw new Error(
|
|
7656
|
+
"clearances, margins, contact lengths, and lead lengths cannot be negative"
|
|
7657
|
+
);
|
|
7658
|
+
}
|
|
7659
|
+
const resolvedCableWidth = props.flexCableWidth ?? Math.min(12, Math.max(5, size.width * 0.3));
|
|
7660
|
+
assertPositive("flexCableWidth", resolvedCableWidth);
|
|
7661
|
+
const usableCableWidth = resolvedCableWidth - cableEdgeMargin * 2;
|
|
7662
|
+
if (usableCableWidth <= 0) {
|
|
7663
|
+
throw new Error("cableEdgeMargin leaves no usable flex cable width");
|
|
7664
|
+
}
|
|
7665
|
+
const resolvedConductorPitch = conductorPitch ?? (conductorCount === 1 ? 0 : usableCableWidth / conductorCount);
|
|
7666
|
+
if (conductorCount > 1 && (!Number.isFinite(resolvedConductorPitch) || resolvedConductorPitch <= 0)) {
|
|
7667
|
+
throw new Error("conductorPitch must be greater than zero");
|
|
7668
|
+
}
|
|
7669
|
+
const resolvedConductorWidth = conductorWidth ?? (conductorCount === 1 ? Math.min(usableCableWidth, resolvedCableWidth * 0.45) : resolvedConductorPitch * 0.48);
|
|
7670
|
+
assertPositive("conductorWidth", resolvedConductorWidth);
|
|
7671
|
+
const conductorSpan = (conductorCount - 1) * resolvedConductorPitch + resolvedConductorWidth;
|
|
7672
|
+
if (conductorSpan > usableCableWidth + EPSILON) {
|
|
7673
|
+
throw new Error(
|
|
7674
|
+
"conductorPitch and conductorWidth do not fit inside the flex cable margins"
|
|
7675
|
+
);
|
|
7676
|
+
}
|
|
7677
|
+
const cableStartsBelowBoard = belowBoard && !foldedFace;
|
|
7678
|
+
const defaultCableZ = cableStartsBelowBoard ? boardTopZ - boardThickness - boardClearance - flexCableThickness / 2 : boardTopZ + boardClearance + flexCableThickness / 2;
|
|
7679
|
+
const start = [
|
|
7680
|
+
cableStartX + cableLateralOffset,
|
|
7681
|
+
cableStartY,
|
|
7682
|
+
cableStartZ ?? defaultCableZ
|
|
7683
|
+
];
|
|
7684
|
+
const direction = belowBoard ? -1 : 1;
|
|
7685
|
+
const foldedScreenBackZ = orientation === "foldedToFaceAboveBoard" ? boardTopZ + distanceAboveBoard : boardTopZ - boardThickness - distanceBelowBoard;
|
|
7686
|
+
const foldedCableEndZ = orientation === "foldedToFaceAboveBoard" ? foldedScreenBackZ - screenGap - flexCableThickness / 2 : foldedScreenBackZ + screenGap + flexCableThickness / 2;
|
|
7687
|
+
const path = foldedFace ? createFoldedPath({
|
|
7688
|
+
start,
|
|
7689
|
+
endZ: foldedCableEndZ,
|
|
7690
|
+
flexCableLength,
|
|
7691
|
+
foldDistanceFromConnector,
|
|
7692
|
+
foldOutset,
|
|
7693
|
+
foldSegments
|
|
7694
|
+
}) : rightAngle ? createRightAnglePath({
|
|
7695
|
+
start,
|
|
7696
|
+
flexCableLength,
|
|
7697
|
+
bendRadius,
|
|
7698
|
+
bendSegments,
|
|
7699
|
+
verticalLead: rightAngleVerticalLead,
|
|
7700
|
+
direction
|
|
7701
|
+
}) : createFlatPath(start, flexCableLength);
|
|
7702
|
+
const totalCableLength = getPathDistances(path).at(-1);
|
|
7703
|
+
const contactLength = Math.min(
|
|
7704
|
+
Math.max(0, exposedContactLength),
|
|
7705
|
+
totalCableLength / 2
|
|
7706
|
+
);
|
|
7707
|
+
const resolvedStiffenerLength = Math.min(
|
|
7708
|
+
Math.max(0, stiffenerLength),
|
|
7709
|
+
totalCableLength / 2
|
|
7710
|
+
);
|
|
7711
|
+
const startContacts = slicePath(path, 0, contactLength);
|
|
7712
|
+
const endContacts = slicePath(
|
|
7713
|
+
path,
|
|
7714
|
+
totalCableLength - contactLength,
|
|
7715
|
+
totalCableLength
|
|
7716
|
+
);
|
|
7717
|
+
const startStiffener = slicePath(path, 0, resolvedStiffenerLength);
|
|
7718
|
+
const endStiffener = slicePath(
|
|
7719
|
+
path,
|
|
7720
|
+
totalCableLength - resolvedStiffenerLength,
|
|
7721
|
+
totalCableLength
|
|
7722
|
+
);
|
|
7723
|
+
const pathEnd = path.at(-1);
|
|
7724
|
+
let presetScreenRotation;
|
|
7725
|
+
let screenCenter;
|
|
7726
|
+
if (orientation === "sitsFlat") {
|
|
7727
|
+
presetScreenRotation = [0, 0, 0];
|
|
7728
|
+
screenCenter = [
|
|
7729
|
+
pathEnd[0],
|
|
7730
|
+
pathEnd[1] + size.height / 2,
|
|
7731
|
+
pathEnd[2] + flexCableThickness / 2 + screenGap
|
|
7732
|
+
];
|
|
7733
|
+
} else if (orientation === "sitsFlatBelowBoard") {
|
|
7734
|
+
presetScreenRotation = [0, Math.PI, 0];
|
|
7735
|
+
screenCenter = [
|
|
7736
|
+
pathEnd[0],
|
|
7737
|
+
pathEnd[1] + size.height / 2,
|
|
7738
|
+
pathEnd[2] - flexCableThickness / 2 - screenGap
|
|
7739
|
+
];
|
|
7740
|
+
} else if (orientation === "foldedToFaceAboveBoard") {
|
|
7741
|
+
presetScreenRotation = [0, 0, 0];
|
|
7742
|
+
screenCenter = [pathEnd[0], pathEnd[1] - size.height / 2, foldedScreenBackZ];
|
|
7743
|
+
} else if (orientation === "foldedToFaceBelowBoard") {
|
|
7744
|
+
presetScreenRotation = [0, Math.PI, 0];
|
|
7745
|
+
screenCenter = [pathEnd[0], pathEnd[1] - size.height / 2, foldedScreenBackZ];
|
|
7746
|
+
} else if (orientation === "foldedToRightAngleAboveBoard") {
|
|
7747
|
+
presetScreenRotation = [Math.PI / 2, 0, 0];
|
|
7748
|
+
screenCenter = [
|
|
7749
|
+
pathEnd[0],
|
|
7750
|
+
pathEnd[1] - flexCableThickness / 2 - screenGap,
|
|
7751
|
+
pathEnd[2] + size.height / 2
|
|
7752
|
+
];
|
|
7753
|
+
} else {
|
|
7754
|
+
presetScreenRotation = [-Math.PI / 2, 0, 0];
|
|
7755
|
+
screenCenter = [
|
|
7756
|
+
pathEnd[0],
|
|
7757
|
+
pathEnd[1] + flexCableThickness / 2 + screenGap,
|
|
7758
|
+
pathEnd[2] - size.height / 2
|
|
7759
|
+
];
|
|
7760
|
+
}
|
|
7761
|
+
screenCenter = [
|
|
7762
|
+
screenCenter[0] + (screenOffset?.x ?? 0),
|
|
7763
|
+
screenCenter[1] + (screenOffset?.y ?? 0),
|
|
7764
|
+
screenCenter[2] + (screenOffset?.z ?? 0)
|
|
7765
|
+
];
|
|
7766
|
+
const conductorOffsets = Array.from(
|
|
7767
|
+
{ length: conductorCount },
|
|
7768
|
+
(_, index) => conductorCount === 1 ? 0 : (index - (conductorCount - 1) / 2) * resolvedConductorPitch
|
|
7769
|
+
);
|
|
7770
|
+
const conductorNormalOffset = (flexCableThickness + conductorThickness) / 2;
|
|
7771
|
+
const stiffenerNormalOffset = -(flexCableThickness + stiffenerThickness) / 2;
|
|
7772
|
+
const assembly = /* @__PURE__ */ jsxs80(Fragment81, { children: [
|
|
7773
|
+
showFlexCable && /* @__PURE__ */ jsx85(
|
|
7774
|
+
CableStrip,
|
|
7775
|
+
{
|
|
7776
|
+
points: path,
|
|
7777
|
+
width: resolvedCableWidth,
|
|
7778
|
+
thickness: flexCableThickness,
|
|
7779
|
+
color: flexCableColor
|
|
7780
|
+
}
|
|
7781
|
+
),
|
|
7782
|
+
showFlexCable && showStiffeners && resolvedStiffenerLength > EPSILON && /* @__PURE__ */ jsxs80(Fragment81, { children: [
|
|
7783
|
+
/* @__PURE__ */ jsx85(
|
|
7784
|
+
CableStrip,
|
|
7785
|
+
{
|
|
7786
|
+
points: startStiffener,
|
|
7787
|
+
width: resolvedCableWidth,
|
|
7788
|
+
thickness: stiffenerThickness,
|
|
7789
|
+
color: stiffenerColor,
|
|
7790
|
+
normalOffset: stiffenerNormalOffset
|
|
7791
|
+
}
|
|
7792
|
+
),
|
|
7793
|
+
/* @__PURE__ */ jsx85(
|
|
7794
|
+
CableStrip,
|
|
7795
|
+
{
|
|
7796
|
+
points: endStiffener,
|
|
7797
|
+
width: resolvedCableWidth,
|
|
7798
|
+
thickness: stiffenerThickness,
|
|
7799
|
+
color: stiffenerColor,
|
|
7800
|
+
normalOffset: stiffenerNormalOffset
|
|
7801
|
+
}
|
|
7802
|
+
)
|
|
7803
|
+
] }),
|
|
7804
|
+
showFlexCable && showConductors && contactLength > EPSILON && conductorOffsets.map((acrossOffset, index) => /* @__PURE__ */ jsxs80(Fragment80, { children: [
|
|
7805
|
+
/* @__PURE__ */ jsx85(
|
|
7806
|
+
CableStrip,
|
|
7807
|
+
{
|
|
7808
|
+
points: startContacts,
|
|
7809
|
+
width: resolvedConductorWidth,
|
|
7810
|
+
thickness: conductorThickness,
|
|
7811
|
+
color: conductorColor,
|
|
7812
|
+
acrossOffset,
|
|
7813
|
+
normalOffset: conductorNormalOffset
|
|
7814
|
+
}
|
|
7815
|
+
),
|
|
7816
|
+
/* @__PURE__ */ jsx85(
|
|
7817
|
+
CableStrip,
|
|
7818
|
+
{
|
|
7819
|
+
points: endContacts,
|
|
7820
|
+
width: resolvedConductorWidth,
|
|
7821
|
+
thickness: conductorThickness,
|
|
7822
|
+
color: conductorColor,
|
|
7823
|
+
acrossOffset,
|
|
7824
|
+
normalOffset: conductorNormalOffset
|
|
7825
|
+
}
|
|
7826
|
+
)
|
|
7827
|
+
] }, `conductor:${index}`)),
|
|
7828
|
+
showScreen && /* @__PURE__ */ jsx85(Translate39, { offset: screenCenter, children: /* @__PURE__ */ jsx85(Rotate19, { rotation: screenRotation ?? presetScreenRotation, children: /* @__PURE__ */ jsx85(
|
|
7829
|
+
Screen,
|
|
7830
|
+
{
|
|
7831
|
+
width: size.width,
|
|
7832
|
+
height: size.height,
|
|
7833
|
+
thickness: screenThickness,
|
|
7834
|
+
bezelInset,
|
|
7835
|
+
bezelDepth,
|
|
7836
|
+
screenWidth: activeAreaWidth,
|
|
7837
|
+
screenHeight: activeAreaHeight,
|
|
7838
|
+
screenColor,
|
|
7839
|
+
bezelColor
|
|
7840
|
+
}
|
|
7841
|
+
) }) })
|
|
7842
|
+
] });
|
|
7843
|
+
return /* @__PURE__ */ jsx85(
|
|
7844
|
+
Translate39,
|
|
7845
|
+
{
|
|
7846
|
+
offset: {
|
|
7847
|
+
x: offset?.x ?? 0,
|
|
7848
|
+
y: offset?.y ?? 0,
|
|
7849
|
+
z: offset?.z ?? 0
|
|
7850
|
+
},
|
|
7851
|
+
children: /* @__PURE__ */ jsx85(Translate39, { offset: start, children: /* @__PURE__ */ jsx85(Rotate19, { rotation, children: /* @__PURE__ */ jsx85(Translate39, { offset: [-start[0], -start[1], -start[2]], children: assembly }) }) })
|
|
7852
|
+
}
|
|
7853
|
+
);
|
|
7854
|
+
};
|
|
7311
7855
|
export {
|
|
7312
7856
|
A01005,
|
|
7313
7857
|
A0201,
|
|
@@ -7330,6 +7874,7 @@ export {
|
|
|
7330
7874
|
FPC,
|
|
7331
7875
|
FemaleHeader,
|
|
7332
7876
|
FemaleHeaderRow,
|
|
7877
|
+
FlexScreen,
|
|
7333
7878
|
FootprintPad,
|
|
7334
7879
|
FootprintPlatedHole,
|
|
7335
7880
|
Footprinter3d,
|
|
@@ -7388,6 +7933,7 @@ export {
|
|
|
7388
7933
|
TO92,
|
|
7389
7934
|
TQFP,
|
|
7390
7935
|
Tssop,
|
|
7391
|
-
VSSOP
|
|
7936
|
+
VSSOP,
|
|
7937
|
+
resolveFlexScreenSize
|
|
7392
7938
|
};
|
|
7393
7939
|
//# sourceMappingURL=index.js.map
|