plotboilerplate 1.25.0 → 1.26.0
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 +1 -0
- package/dist/index.esm.js +139 -33
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +139 -33
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/Bounds.d.ts +79 -25
- package/src/cjs/Bounds.js +102 -29
- package/src/cjs/Bounds.js.map +1 -1
- package/src/cjs/CircleSector.d.ts +3 -0
- package/src/cjs/CircleSector.js +28 -1
- package/src/cjs/CircleSector.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +2 -1
- package/src/cjs/drawutilssvg.js +9 -3
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/utils/LissajousFigure.d.ts +34 -0
- package/src/cjs/utils/LissajousFigure.js +100 -0
- package/src/cjs/utils/LissajousFigure.js.map +1 -0
- package/src/cjs/utils/PerlinNoise.d.ts +19 -0
- package/src/cjs/utils/PerlinNoise.js +352 -0
- package/src/cjs/utils/PerlinNoise.js.map +1 -0
- package/src/cjs/utils/SVGPathUtils.d.ts +22 -0
- package/src/cjs/utils/SVGPathUtils.js +45 -0
- package/src/cjs/utils/SVGPathUtils.js.map +1 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js +270 -0
- package/src/cjs/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/cjs/utils/datastructures/DataGrid2d.d.ts +6 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js +155 -0
- package/src/cjs/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js +3 -3
- package/src/cjs/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
- package/src/cjs/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/cjs/utils/datastructures/GeometryMesh.js +58 -0
- package/src/cjs/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/cjs/utils/detectDarkMode.js +16 -7
- package/src/cjs/utils/detectDarkMode.js.map +1 -1
- package/src/cjs/utils/dom/components/ColorGradientPicker.d.ts +4 -3
- package/src/cjs/utils/dom/components/ColorGradientPicker.js +8 -8
- package/src/cjs/utils/dom/components/ColorGradientPicker.js.map +1 -1
- package/src/cjs/utils/dom/components/ColorGradientSelector.d.ts +1 -0
- package/src/cjs/utils/dom/components/ColorGradientSelector.js +4 -2
- package/src/cjs/utils/dom/components/ColorGradientSelector.js.map +1 -1
- package/src/cjs/utils/parsers/svg/types.d.ts +8 -8
- package/src/esm/Bounds.d.ts +79 -25
- package/src/esm/Bounds.js +102 -29
- package/src/esm/Bounds.js.map +1 -1
- package/src/esm/CircleSector.d.ts +3 -0
- package/src/esm/CircleSector.js +28 -1
- package/src/esm/CircleSector.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +2 -1
- package/src/esm/drawutilssvg.js +9 -3
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/utils/LissajousFigure.d.ts +34 -0
- package/src/esm/utils/LissajousFigure.js +95 -0
- package/src/esm/utils/LissajousFigure.js.map +1 -0
- package/src/esm/utils/PerlinNoise.d.ts +19 -0
- package/src/esm/utils/PerlinNoise.js +346 -0
- package/src/esm/utils/PerlinNoise.js.map +1 -0
- package/src/esm/utils/SVGPathUtils.d.ts +22 -0
- package/src/esm/utils/SVGPathUtils.js +42 -0
- package/src/esm/utils/SVGPathUtils.js.map +1 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.d.ts +23 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js +266 -0
- package/src/esm/utils/algorithms/pixelCornersToRoundPaths.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2d.d.ts +6 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.d.ts +88 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js +150 -0
- package/src/esm/utils/datastructures/DataGrid2dArrayMatrix.js.map +1 -0
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.d.ts +1 -7
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js +3 -3
- package/src/esm/utils/datastructures/DataGrid2dListAdapter.js.map +1 -1
- package/src/esm/utils/datastructures/GeometryMesh.d.ts +49 -0
- package/src/esm/utils/datastructures/GeometryMesh.js +53 -0
- package/src/esm/utils/datastructures/GeometryMesh.js.map +1 -0
- package/src/esm/utils/detectDarkMode.js +16 -7
- package/src/esm/utils/detectDarkMode.js.map +1 -1
- package/src/esm/utils/dom/components/ColorGradientPicker.d.ts +4 -3
- package/src/esm/utils/dom/components/ColorGradientPicker.js +18 -7
- package/src/esm/utils/dom/components/ColorGradientPicker.js.map +1 -1
- package/src/esm/utils/dom/components/ColorGradientSelector.d.ts +1 -0
- package/src/esm/utils/dom/components/ColorGradientSelector.js +9 -2
- package/src/esm/utils/dom/components/ColorGradientSelector.js.map +1 -1
- package/src/esm/utils/parsers/svg/types.d.ts +8 -8
- package/src/ts/Bounds.ts +107 -22
- package/src/ts/CircleSector.ts +39 -6
- package/src/ts/drawutilssvg.ts +8 -3
- package/src/ts/utils/LissajousFigure.ts +110 -0
- package/src/ts/utils/PerlinNoise.ts +368 -0
- package/src/ts/utils/SVGPathUtils.ts +55 -0
- package/src/ts/utils/algorithms/pixelCornersToRoundPaths.ts +379 -0
- package/src/ts/utils/datastructures/DataGrid2d.ts +7 -0
- package/src/ts/utils/datastructures/DataGrid2dArrayMatrix.ts +182 -0
- package/src/ts/utils/datastructures/DataGrid2dListAdapter.ts +4 -11
- package/src/ts/utils/datastructures/GeometryMesh.ts +79 -0
- package/src/ts/utils/detectDarkMode.ts +17 -8
- package/src/ts/utils/dom/components/ColorGradientPicker.tsx +18 -6
- package/src/ts/utils/dom/components/ColorGradientSelector.tsx +9 -2
- package/src/ts/utils/parsers/svg/types.ts +8 -8
package/dist/plotboilerplate.js
CHANGED
|
@@ -1391,7 +1391,11 @@ exports.drawutils = drawutils;
|
|
|
1391
1391
|
* @modified 2025-04-18 Change parameter type in `Bounds.computeFromVertices` from `Vertex` to more general `XYCoords`.
|
|
1392
1392
|
* @modified 2025-04-19 Added methods to `Bounds` class: `getNorthPoint`, `getSouthPoint`, `getEastPoint` and `getWestPoint`.
|
|
1393
1393
|
* @modified 2025-04-26 Added static method `Bounds.computeFromBoundsSet` to calculate containing bounds for a set of bounding boxes.
|
|
1394
|
-
* @
|
|
1394
|
+
* @modified 2025-10-17 Added the methods `Bounds.getSouthWestPoint`, `getNorthWestPoint`, `getNorthEastPoint` and `getSouthEastPoint`.
|
|
1395
|
+
* @modified 2025-10-18 Added method `Bounds.containsVert(XYCoords)`.
|
|
1396
|
+
* @modified 2025-10-28 Added the `Bounds.getWidth()` and `Bounds.getHeight()`.
|
|
1397
|
+
* @modified 2025-11-12 Added the `Bounds.getMoved()` method.
|
|
1398
|
+
* @version 1.11.0
|
|
1395
1399
|
**/
|
|
1396
1400
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1397
1401
|
exports.Bounds = void 0;
|
|
@@ -1419,6 +1423,35 @@ var Bounds = /** @class */ (function () {
|
|
|
1419
1423
|
this.width = max.x - min.x;
|
|
1420
1424
|
this.height = max.y - min.y;
|
|
1421
1425
|
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Check if the given vertex is inside this bounds.
|
|
1428
|
+
*
|
|
1429
|
+
* @method containsVert
|
|
1430
|
+
* @param {XYCoords} vert - The vertex to check.
|
|
1431
|
+
* @return {boolean} True if the passed vertex is inside this bounds.
|
|
1432
|
+
* @instance
|
|
1433
|
+
* @memberof Bounds
|
|
1434
|
+
**/
|
|
1435
|
+
Bounds.prototype.containsVert = function (vert) {
|
|
1436
|
+
return this.min.x <= vert.x && vert.x < this.max.x && this.min.y <= vert.y && vert.y < this.max.y;
|
|
1437
|
+
};
|
|
1438
|
+
Bounds.prototype.getWidth = function () {
|
|
1439
|
+
return this.max.x - this.min.x;
|
|
1440
|
+
};
|
|
1441
|
+
Bounds.prototype.getHeight = function () {
|
|
1442
|
+
return this.max.y - this.min.y;
|
|
1443
|
+
};
|
|
1444
|
+
Bounds.prototype.getScaled = function (scaleFactor) {
|
|
1445
|
+
var center = this.getCenter();
|
|
1446
|
+
var newMin = new Vertex_1.Vertex(this.min).scale(scaleFactor, center);
|
|
1447
|
+
var newMax = new Vertex_1.Vertex(this.max).scale(scaleFactor, center);
|
|
1448
|
+
return new Bounds(newMin, newMax);
|
|
1449
|
+
};
|
|
1450
|
+
Bounds.prototype.getMoved = function (moveAmount) {
|
|
1451
|
+
var newMin = new Vertex_1.Vertex(this.min).move(moveAmount);
|
|
1452
|
+
var newMax = new Vertex_1.Vertex(this.max).move(moveAmount);
|
|
1453
|
+
return new Bounds(newMin, newMax);
|
|
1454
|
+
};
|
|
1422
1455
|
/**
|
|
1423
1456
|
* Get the center point of the north bound.
|
|
1424
1457
|
*
|
|
@@ -1430,7 +1463,6 @@ var Bounds = /** @class */ (function () {
|
|
|
1430
1463
|
Bounds.prototype.getNorthPoint = function () {
|
|
1431
1464
|
return new Vertex_1.Vertex(this.min.x + this.width / 2.0, this.min.y);
|
|
1432
1465
|
};
|
|
1433
|
-
;
|
|
1434
1466
|
/**
|
|
1435
1467
|
* Get the center point of the south bound.
|
|
1436
1468
|
*
|
|
@@ -1442,31 +1474,72 @@ var Bounds = /** @class */ (function () {
|
|
|
1442
1474
|
Bounds.prototype.getSouthPoint = function () {
|
|
1443
1475
|
return new Vertex_1.Vertex(this.min.x + this.width / 2.0, this.max.y);
|
|
1444
1476
|
};
|
|
1445
|
-
;
|
|
1446
1477
|
/**
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1478
|
+
* Get the center point of the west bound.
|
|
1479
|
+
*
|
|
1480
|
+
* @method getWestPoint
|
|
1481
|
+
* @instance
|
|
1482
|
+
* @memberof Bounds
|
|
1483
|
+
* @return {Vertex} The "westhmost" centered point of this bounding box.
|
|
1484
|
+
*/
|
|
1454
1485
|
Bounds.prototype.getWestPoint = function () {
|
|
1455
1486
|
return new Vertex_1.Vertex(this.min.x, this.min.y + this.height / 2.0);
|
|
1456
1487
|
};
|
|
1457
|
-
;
|
|
1458
1488
|
/**
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1489
|
+
* Get the center point of the east bound.
|
|
1490
|
+
*
|
|
1491
|
+
* @method getEastPoint
|
|
1492
|
+
* @instance
|
|
1493
|
+
* @memberof Bounds
|
|
1494
|
+
* @return {Vertex} The "easthmost" centered point of this bounding box.
|
|
1495
|
+
*/
|
|
1466
1496
|
Bounds.prototype.getEastPoint = function () {
|
|
1467
1497
|
return new Vertex_1.Vertex(this.max.x, this.min.y + this.height / 2.0);
|
|
1468
1498
|
};
|
|
1469
|
-
|
|
1499
|
+
/**
|
|
1500
|
+
* Get the upper left corner point these bounds box.
|
|
1501
|
+
*
|
|
1502
|
+
* @method getNorthWestPoint
|
|
1503
|
+
* @instance
|
|
1504
|
+
* @memberof Bounds
|
|
1505
|
+
* @return {Vertex} The "northwestmost" point of this bounding box.
|
|
1506
|
+
*/
|
|
1507
|
+
Bounds.prototype.getNorthWestPoint = function () {
|
|
1508
|
+
return new Vertex_1.Vertex(this.min.x, this.min.y);
|
|
1509
|
+
};
|
|
1510
|
+
/**
|
|
1511
|
+
* Get the upper right corner point these bounds box.
|
|
1512
|
+
*
|
|
1513
|
+
* @method getNorthEastPoint
|
|
1514
|
+
* @instance
|
|
1515
|
+
* @memberof Bounds
|
|
1516
|
+
* @return {Vertex} The "northeastmost" point of this bounding box.
|
|
1517
|
+
*/
|
|
1518
|
+
Bounds.prototype.getNorthEastPoint = function () {
|
|
1519
|
+
return new Vertex_1.Vertex(this.max.x, this.min.y);
|
|
1520
|
+
};
|
|
1521
|
+
/**
|
|
1522
|
+
* Get the lower right corner point these bounds box.
|
|
1523
|
+
*
|
|
1524
|
+
* @method getSouthEastPoint
|
|
1525
|
+
* @instance
|
|
1526
|
+
* @memberof Bounds
|
|
1527
|
+
* @return {Vertex} The "southeastmost" point of this bounding box.
|
|
1528
|
+
*/
|
|
1529
|
+
Bounds.prototype.getSouthEastPoint = function () {
|
|
1530
|
+
return new Vertex_1.Vertex(this.max.x, this.max.y);
|
|
1531
|
+
};
|
|
1532
|
+
/**
|
|
1533
|
+
* Get the lower left corner point these bounds box.
|
|
1534
|
+
*
|
|
1535
|
+
* @method getSouthWestPoint
|
|
1536
|
+
* @instance
|
|
1537
|
+
* @memberof Bounds
|
|
1538
|
+
* @return {Vertex} The "southwestmost" point of this bounding box.
|
|
1539
|
+
*/
|
|
1540
|
+
Bounds.prototype.getSouthWestPoint = function () {
|
|
1541
|
+
return new Vertex_1.Vertex(this.min.x, this.max.y);
|
|
1542
|
+
};
|
|
1470
1543
|
/**
|
|
1471
1544
|
* Convert this rectangular bounding box to a polygon with four vertices.
|
|
1472
1545
|
*
|
|
@@ -1579,16 +1652,16 @@ var Bounds = /** @class */ (function () {
|
|
|
1579
1652
|
return new Bounds(new Vertex_1.Vertex(xMin, yMin), new Vertex_1.Vertex(xMax, yMax));
|
|
1580
1653
|
};
|
|
1581
1654
|
/**
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1655
|
+
* Compute the minimal bounding box for a given set of existing bounding boxes.
|
|
1656
|
+
*
|
|
1657
|
+
* An empty vertex array will return an empty bounding box located at (0,0).
|
|
1658
|
+
*
|
|
1659
|
+
* @static
|
|
1660
|
+
* @method computeFromBoundsSet
|
|
1661
|
+
* @memberof Bounds
|
|
1662
|
+
* @param {Array<IBounds>} boundingBoxes - The set of existing bounding boxes to get the containing bounding box for.
|
|
1663
|
+
* @return The minimal Bounds for the given bounds instances.
|
|
1664
|
+
**/
|
|
1592
1665
|
Bounds.computeFromBoundsSet = function (boundingBoxes) {
|
|
1593
1666
|
if (boundingBoxes.length == 0) {
|
|
1594
1667
|
return new Bounds(new Vertex_1.Vertex(0, 0), new Vertex_1.Vertex(0, 0));
|
|
@@ -2237,6 +2310,32 @@ var CircleSector = /** @class */ (function () {
|
|
|
2237
2310
|
});
|
|
2238
2311
|
};
|
|
2239
2312
|
//--- END --- Implement interface `Intersectable`
|
|
2313
|
+
CircleSector.prototype.describeSVGPath = function (options) {
|
|
2314
|
+
// const buffer: SVGPathParams = [];
|
|
2315
|
+
// const start = this.getStartPoint();
|
|
2316
|
+
// const end = this.getEndPoint();
|
|
2317
|
+
// // describeSVGArc
|
|
2318
|
+
// // x: number,
|
|
2319
|
+
// // y: number,
|
|
2320
|
+
// // radius: number,
|
|
2321
|
+
// // startAngle: number,
|
|
2322
|
+
// // endAngle: number,
|
|
2323
|
+
// // options?: { moveToStart: boolean }
|
|
2324
|
+
// // ): SVGPathParams => {
|
|
2325
|
+
// var arcRotation = 0.0;
|
|
2326
|
+
// var largeArcFlag = 1;
|
|
2327
|
+
// var sweepFlag = 0;
|
|
2328
|
+
// if (options && options.moveToStart) {
|
|
2329
|
+
// buffer.push("M", start.x, start.y);
|
|
2330
|
+
// }
|
|
2331
|
+
// buffer.push("A", cSector.circle.radius, cSector.circle.radius, arcRotation, largeArcFlag, sweepFlag, end.x, end.y);
|
|
2332
|
+
// return buffer;
|
|
2333
|
+
var arc = CircleSector.circleSectorUtils.describeSVGArc(this.circle.center.x, // end.x,
|
|
2334
|
+
this.circle.center.y, // end.y,
|
|
2335
|
+
this.circle.radius, this.startAngle, this.endAngle, options // options?: { moveToStart: boolean }
|
|
2336
|
+
);
|
|
2337
|
+
return arc;
|
|
2338
|
+
};
|
|
2240
2339
|
/**
|
|
2241
2340
|
* This function should invalidate any installed listeners and invalidate this object.
|
|
2242
2341
|
* After calling this function the object might not hold valid data any more and
|
|
@@ -2275,8 +2374,9 @@ var CircleSector = /** @class */ (function () {
|
|
|
2275
2374
|
* @return [ 'A', radiusx, radiusy, rotation=0, largeArcFlag=1|0, sweepFlag=0, endx, endy ]
|
|
2276
2375
|
*/
|
|
2277
2376
|
describeSVGArc: function (x, y, radius, startAngle, endAngle, options) {
|
|
2278
|
-
if (typeof options === "undefined")
|
|
2377
|
+
if (typeof options === "undefined") {
|
|
2279
2378
|
options = { moveToStart: true };
|
|
2379
|
+
}
|
|
2280
2380
|
var end = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, endAngle);
|
|
2281
2381
|
var start = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, startAngle);
|
|
2282
2382
|
// Split full circles into two halves.
|
|
@@ -3393,7 +3493,8 @@ exports.geomutils = {
|
|
|
3393
3493
|
* @modified 2024-01-30 Fixing an issue with immutable style sets; changes to the global draw config did not reflect here (do now).
|
|
3394
3494
|
* @modified 2024-03-10 Fixing some types for Typescript 5 compatibility.
|
|
3395
3495
|
* @modified 2024-07-24 Caching custom style defs in a private buffer variable.
|
|
3396
|
-
* @
|
|
3496
|
+
* @modified 2025-11-14 Fixing a bug in the CSS `mix-blend-mode` property handling (caused a runtime error).
|
|
3497
|
+
* @version 1.6.11
|
|
3397
3498
|
**/
|
|
3398
3499
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3399
3500
|
exports.drawutilssvg = void 0;
|
|
@@ -3598,8 +3699,13 @@ var drawutilssvg = /** @class */ (function () {
|
|
|
3598
3699
|
node = this.createSVGNode(nodeName);
|
|
3599
3700
|
}
|
|
3600
3701
|
if (this.drawlibConfiguration.blendMode) {
|
|
3601
|
-
|
|
3602
|
-
|
|
3702
|
+
var blendMode = node.style["mix-blend-mode"];
|
|
3703
|
+
if (typeof blendMode === "function") {
|
|
3704
|
+
blendMode(this.drawlibConfiguration.blendMode);
|
|
3705
|
+
}
|
|
3706
|
+
else {
|
|
3707
|
+
node.style["mix-blend-mode"] = this.drawlibConfiguration.blendMode;
|
|
3708
|
+
}
|
|
3603
3709
|
}
|
|
3604
3710
|
// if (this.lineDashEnabled && this.lineDash && this.lineDash.length > 0 && drawutilssvg.nodeSupportsLineDash(nodeName)) {
|
|
3605
3711
|
// node.setAttribute("stroke-dasharray", this.lineDash.join(" "));
|