@synnaxlabs/x 0.12.0 → 0.13.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/.turbo/turbo-build.log +6 -6
- package/dist/deep/difference.d.ts +3 -0
- package/dist/deep/external.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/invert.d.ts +1 -0
- package/dist/optional.d.ts +3 -0
- package/dist/spatial/{bounds.d.ts → bounds/bounds.d.ts} +1 -1
- package/dist/spatial/bounds/index.d.ts +1 -0
- package/dist/spatial/{box.d.ts → box/box.d.ts} +25 -8
- package/dist/spatial/box/index.d.ts +1 -0
- package/dist/spatial/{dimensions.d.ts → dimensions/dimensions.d.ts} +1 -1
- package/dist/spatial/dimensions/index.d.ts +1 -0
- package/dist/spatial/{direction.d.ts → direction/direction.d.ts} +1 -1
- package/dist/spatial/direction/index.d.ts +1 -0
- package/dist/spatial/external.d.ts +8 -7
- package/dist/spatial/location/index.d.ts +1 -0
- package/dist/spatial/{location.d.ts → location/location.d.ts} +12 -9
- package/dist/spatial/position/index.d.ts +1 -0
- package/dist/spatial/position/position.d.ts +20 -0
- package/dist/spatial/scale/index.d.ts +1 -0
- package/dist/spatial/{scale.d.ts → scale/scale.d.ts} +5 -5
- package/dist/spatial/scale/scale.spec.d.ts +1 -0
- package/dist/spatial/xy/index.d.ts +1 -0
- package/dist/spatial/{xy.d.ts → xy/xy.d.ts} +10 -9
- package/dist/spatial/xy/xy.spec.d.ts +1 -0
- package/dist/telem/series.d.ts +1 -0
- package/dist/telem/telem.d.ts +21 -1
- package/dist/{x.cjs.js → x.cjs} +377 -44
- package/dist/x.cjs.map +1 -0
- package/dist/{x.es.js → x.js} +377 -44
- package/dist/x.js.map +1 -0
- package/package.json +7 -6
- package/src/deep/difference.spec.ts +38 -0
- package/src/deep/difference.ts +47 -0
- package/src/deep/external.ts +1 -0
- package/src/index.ts +1 -0
- package/src/invert.ts +1 -0
- package/src/optional.ts +5 -0
- package/src/spatial/{bounds.spec.ts → bounds/bounds.spec.ts} +150 -68
- package/src/spatial/{bounds.ts → bounds/bounds.ts} +0 -1
- package/src/spatial/bounds/index.ts +10 -0
- package/src/spatial/{box.spec.ts → box/box.spec.ts} +106 -3
- package/src/spatial/{box.ts → box/box.ts} +107 -22
- package/src/spatial/box/index.ts +10 -0
- package/src/spatial/{dimensions.spec.ts → dimensions/dimensions.spec.ts} +1 -1
- package/src/spatial/dimensions/index.ts +10 -0
- package/src/spatial/{direction.spec.ts → direction/direction.spec.ts} +1 -1
- package/src/spatial/direction/index.ts +10 -0
- package/src/spatial/external.ts +8 -7
- package/src/spatial/location/index.ts +10 -0
- package/src/spatial/{location.spec.ts → location/location.spec.ts} +1 -1
- package/src/spatial/{location.ts → location/location.ts} +67 -29
- package/src/spatial/position/index.ts +10 -0
- package/src/spatial/position/position.spec.ts +211 -0
- package/src/spatial/position/position.ts +174 -0
- package/src/spatial/scale/index.ts +10 -0
- package/src/spatial/{scale.spec.ts → scale/scale.spec.ts} +2 -2
- package/src/spatial/{scale.ts → scale/scale.ts} +6 -6
- package/src/spatial/xy/index.ts +10 -0
- package/src/spatial/{xy.spec.ts → xy/xy.spec.ts} +1 -1
- package/src/spatial/{xy.ts → xy/xy.ts} +19 -14
- package/src/telem/series.ts +6 -10
- package/src/telem/telem.spec.ts +106 -24
- package/src/telem/telem.ts +73 -2
- package/dist/spatial/position.d.ts +0 -2
- package/dist/x.cjs.js.map +0 -1
- package/dist/x.es.js.map +0 -1
- package/src/spatial/position.ts +0 -26
- /package/dist/{spatial/bounds.spec.d.ts → deep/difference.spec.d.ts} +0 -0
- /package/dist/spatial/{box.spec.d.ts → bounds/bounds.spec.d.ts} +0 -0
- /package/dist/spatial/{dimensions.spec.d.ts → box/box.spec.d.ts} +0 -0
- /package/dist/spatial/{direction.spec.d.ts → dimensions/dimensions.spec.d.ts} +0 -0
- /package/dist/spatial/{location.spec.d.ts → direction/direction.spec.d.ts} +0 -0
- /package/dist/spatial/{scale.spec.d.ts → location/location.spec.d.ts} +0 -0
- /package/dist/spatial/{xy.spec.d.ts → position/position.spec.d.ts} +0 -0
- /package/src/spatial/{dimensions.ts → dimensions/dimensions.ts} +0 -0
- /package/src/spatial/{direction.ts → direction/direction.ts} +0 -0
package/dist/{x.es.js → x.js}
RENAMED
|
@@ -3853,7 +3853,7 @@ const xLocation = z.enum(X_LOCATIONS);
|
|
|
3853
3853
|
const Y_LOCATIONS = ["top", "bottom"];
|
|
3854
3854
|
const yLocation = z.enum(Y_LOCATIONS);
|
|
3855
3855
|
const CENTER_LOCATIONS = ["center"];
|
|
3856
|
-
z.enum(CENTER_LOCATIONS);
|
|
3856
|
+
const centerlocation = z.enum(CENTER_LOCATIONS);
|
|
3857
3857
|
const LOCATIONS = [...OUTER_LOCATIONS, ...CENTER_LOCATIONS];
|
|
3858
3858
|
const location$2 = z.enum(LOCATIONS);
|
|
3859
3859
|
const alignment = z.enum(ALIGNMENTS);
|
|
@@ -4614,51 +4614,82 @@ const direction = (cl) => {
|
|
|
4614
4614
|
return "y";
|
|
4615
4615
|
return "x";
|
|
4616
4616
|
};
|
|
4617
|
-
const xy$1 = z.object({
|
|
4617
|
+
const xy$1 = z.object({
|
|
4618
|
+
x: xLocation.or(centerlocation),
|
|
4619
|
+
y: yLocation.or(centerlocation)
|
|
4620
|
+
});
|
|
4618
4621
|
const corner = z.object({ x: xLocation, y: yLocation });
|
|
4619
|
-
const TOP_LEFT = { x: "left", y: "top" };
|
|
4620
|
-
const TOP_RIGHT = { x: "right", y: "top" };
|
|
4621
|
-
const BOTTOM_LEFT = { x: "left", y: "bottom" };
|
|
4622
|
-
const BOTTOM_RIGHT = { x: "right", y: "bottom" };
|
|
4623
|
-
const CENTER = { x: "center", y: "center" };
|
|
4624
|
-
const TOP_CENTER = { x: "center", y: "top" };
|
|
4625
|
-
const BOTTOM_CENTER = { x: "center", y: "bottom" };
|
|
4626
|
-
const RIGHT_CENTER = { x: "right", y: "center" };
|
|
4627
|
-
const LEFT_CENTER = { x: "left", y: "center" };
|
|
4622
|
+
const TOP_LEFT = Object.freeze({ x: "left", y: "top" });
|
|
4623
|
+
const TOP_RIGHT = Object.freeze({ x: "right", y: "top" });
|
|
4624
|
+
const BOTTOM_LEFT = Object.freeze({ x: "left", y: "bottom" });
|
|
4625
|
+
const BOTTOM_RIGHT = Object.freeze({ x: "right", y: "bottom" });
|
|
4626
|
+
const CENTER = Object.freeze({ x: "center", y: "center" });
|
|
4627
|
+
const TOP_CENTER = Object.freeze({ x: "center", y: "top" });
|
|
4628
|
+
const BOTTOM_CENTER = Object.freeze({ x: "center", y: "bottom" });
|
|
4629
|
+
const RIGHT_CENTER = Object.freeze({ x: "right", y: "center" });
|
|
4630
|
+
const LEFT_CENTER = Object.freeze({ x: "left", y: "center" });
|
|
4631
|
+
const XY_LOCATIONS = Object.freeze([
|
|
4632
|
+
LEFT_CENTER,
|
|
4633
|
+
RIGHT_CENTER,
|
|
4634
|
+
TOP_CENTER,
|
|
4635
|
+
BOTTOM_CENTER,
|
|
4636
|
+
TOP_LEFT,
|
|
4637
|
+
TOP_RIGHT,
|
|
4638
|
+
BOTTOM_LEFT,
|
|
4639
|
+
BOTTOM_RIGHT,
|
|
4640
|
+
CENTER
|
|
4641
|
+
]);
|
|
4628
4642
|
const xyEquals = (a, b) => a.x === b.x && a.y === b.y;
|
|
4643
|
+
const xyMatches = (a, l) => {
|
|
4644
|
+
if (typeof l === "object") {
|
|
4645
|
+
let ok = true;
|
|
4646
|
+
if ("x" in l) {
|
|
4647
|
+
const ok_ = a.x === l.x;
|
|
4648
|
+
if (!ok_)
|
|
4649
|
+
ok = false;
|
|
4650
|
+
}
|
|
4651
|
+
if ("y" in l) {
|
|
4652
|
+
const ok_ = a.y === l.y;
|
|
4653
|
+
if (!ok_)
|
|
4654
|
+
ok = false;
|
|
4655
|
+
}
|
|
4656
|
+
return ok;
|
|
4657
|
+
}
|
|
4658
|
+
return a.x === l || a.y === l;
|
|
4659
|
+
};
|
|
4629
4660
|
const xyCouple = (a) => [a.x, a.y];
|
|
4630
4661
|
const isX = (a) => direction(construct$3(a)) === "x";
|
|
4631
4662
|
const isY = (a) => direction(construct$3(a)) === "y";
|
|
4632
4663
|
const xyToString = (a) => `${a.x}${Case.capitalize(a.y)}`;
|
|
4633
4664
|
const constructXY = (x2, y2) => {
|
|
4634
|
-
let
|
|
4635
|
-
let
|
|
4665
|
+
let parsedX;
|
|
4666
|
+
let parsedY;
|
|
4636
4667
|
if (typeof x2 === "object" && "x" in x2) {
|
|
4637
|
-
|
|
4638
|
-
|
|
4668
|
+
parsedX = x2.x;
|
|
4669
|
+
parsedY = x2.y;
|
|
4639
4670
|
} else {
|
|
4640
|
-
|
|
4641
|
-
|
|
4671
|
+
parsedX = construct$3(x2);
|
|
4672
|
+
parsedY = construct$3(y2 ?? x2);
|
|
4642
4673
|
}
|
|
4643
|
-
if (direction(
|
|
4674
|
+
if (direction(parsedX) === direction(parsedY) && parsedX !== "center" && parsedY !== "center")
|
|
4644
4675
|
throw new Error(
|
|
4645
|
-
`[XYLocation] - encountered two locations with the same direction: ${
|
|
4676
|
+
`[XYLocation] - encountered two locations with the same direction: ${parsedX.toString()} - ${parsedY.toString()}`
|
|
4646
4677
|
);
|
|
4647
|
-
const xy2 = CENTER;
|
|
4648
|
-
if (
|
|
4649
|
-
if (
|
|
4650
|
-
[xy2.x, xy2.y] = [
|
|
4678
|
+
const xy2 = { ...CENTER };
|
|
4679
|
+
if (parsedX === "center") {
|
|
4680
|
+
if (isX(parsedY))
|
|
4681
|
+
[xy2.x, xy2.y] = [parsedY, parsedX];
|
|
4651
4682
|
else
|
|
4652
|
-
[xy2.x, xy2.y] = [
|
|
4653
|
-
} else if (
|
|
4654
|
-
if (
|
|
4655
|
-
[xy2.x, xy2.y] = [
|
|
4683
|
+
[xy2.x, xy2.y] = [parsedX, parsedY];
|
|
4684
|
+
} else if (parsedY === "center") {
|
|
4685
|
+
if (isX(parsedX))
|
|
4686
|
+
[xy2.x, xy2.y] = [parsedX, parsedY];
|
|
4656
4687
|
else
|
|
4657
|
-
[xy2.x, xy2.y] = [
|
|
4658
|
-
} else if (
|
|
4659
|
-
[xy2.x, xy2.y] = [
|
|
4688
|
+
[xy2.x, xy2.y] = [parsedY, parsedX];
|
|
4689
|
+
} else if (isX(parsedX))
|
|
4690
|
+
[xy2.x, xy2.y] = [parsedX, parsedY];
|
|
4660
4691
|
else
|
|
4661
|
-
[xy2.x, xy2.y] = [
|
|
4692
|
+
[xy2.x, xy2.y] = [parsedY, parsedX];
|
|
4662
4693
|
return xy2;
|
|
4663
4694
|
};
|
|
4664
4695
|
const location = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -4673,6 +4704,7 @@ const location = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
4673
4704
|
TOP_CENTER,
|
|
4674
4705
|
TOP_LEFT,
|
|
4675
4706
|
TOP_RIGHT,
|
|
4707
|
+
XY_LOCATIONS,
|
|
4676
4708
|
X_LOCATIONS,
|
|
4677
4709
|
Y_LOCATIONS,
|
|
4678
4710
|
construct: construct$3,
|
|
@@ -4690,6 +4722,7 @@ const location = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
4690
4722
|
xy: xy$1,
|
|
4691
4723
|
xyCouple,
|
|
4692
4724
|
xyEquals,
|
|
4725
|
+
xyMatches,
|
|
4693
4726
|
xyToString,
|
|
4694
4727
|
y: y$1
|
|
4695
4728
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -4702,6 +4735,13 @@ const crudeZ = z.union([
|
|
|
4702
4735
|
clientXY
|
|
4703
4736
|
]);
|
|
4704
4737
|
const construct$2 = (x2, y2) => {
|
|
4738
|
+
if (typeof x2 === "string") {
|
|
4739
|
+
if (y2 === void 0)
|
|
4740
|
+
throw new Error("The y coordinate must be given.");
|
|
4741
|
+
if (x2 === "x")
|
|
4742
|
+
return { x: y2, y: 0 };
|
|
4743
|
+
return { x: 0, y: y2 };
|
|
4744
|
+
}
|
|
4705
4745
|
if (typeof x2 === "number")
|
|
4706
4746
|
return { x: x2, y: y2 ?? x2 };
|
|
4707
4747
|
if (Array.isArray(x2))
|
|
@@ -4791,6 +4831,10 @@ const css$1 = (a) => {
|
|
|
4791
4831
|
const xy2 = construct$2(a);
|
|
4792
4832
|
return { left: xy2.x, top: xy2.y };
|
|
4793
4833
|
};
|
|
4834
|
+
const truncate$1 = (a, precision = 0) => {
|
|
4835
|
+
const xy2 = construct$2(a);
|
|
4836
|
+
return { x: Number(xy2.x.toFixed(precision)), y: Number(xy2.y.toFixed(precision)) };
|
|
4837
|
+
};
|
|
4794
4838
|
const xy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4795
4839
|
__proto__: null,
|
|
4796
4840
|
INFINITY,
|
|
@@ -4813,6 +4857,7 @@ const xy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4813
4857
|
translateX,
|
|
4814
4858
|
translateY,
|
|
4815
4859
|
translation,
|
|
4860
|
+
truncate: truncate$1,
|
|
4816
4861
|
xDistance,
|
|
4817
4862
|
xy: xy$2,
|
|
4818
4863
|
yDistance
|
|
@@ -4883,7 +4928,22 @@ const construct$1 = (first, second, width2 = 0, height2 = 0, coordinateRoot) =>
|
|
|
4883
4928
|
b.two = second;
|
|
4884
4929
|
return b;
|
|
4885
4930
|
};
|
|
4886
|
-
const resize = (b, dims2) =>
|
|
4931
|
+
const resize = (b, dims2, amount) => {
|
|
4932
|
+
const b_ = construct$1(b);
|
|
4933
|
+
if (typeof dims2 === "string") {
|
|
4934
|
+
if (amount == null)
|
|
4935
|
+
throw new Error("Invalid arguments for resize");
|
|
4936
|
+
const dir = construct$4(dims2);
|
|
4937
|
+
return construct$1(
|
|
4938
|
+
b_.one,
|
|
4939
|
+
void 0,
|
|
4940
|
+
dir === "x" ? amount : width(b_),
|
|
4941
|
+
dir === "y" ? amount : height(b_),
|
|
4942
|
+
b_.root
|
|
4943
|
+
);
|
|
4944
|
+
}
|
|
4945
|
+
return construct$1(b_.one, dims2, void 0, void 0, b_.root);
|
|
4946
|
+
};
|
|
4887
4947
|
const contains = (b, value) => {
|
|
4888
4948
|
const b_ = construct$1(b);
|
|
4889
4949
|
if ("one" in value)
|
|
@@ -4995,7 +5055,13 @@ const isBox = (value) => {
|
|
|
4995
5055
|
return "one" in value && "two" in value && "root" in value;
|
|
4996
5056
|
};
|
|
4997
5057
|
const aspect = (b) => width(b) / height(b);
|
|
4998
|
-
const translate = (b, t) => {
|
|
5058
|
+
const translate = (b, t, amount) => {
|
|
5059
|
+
if (typeof t === "string") {
|
|
5060
|
+
if (amount == null)
|
|
5061
|
+
throw new Error(`Undefined amount passed into box.translate`);
|
|
5062
|
+
const dir = construct$4(t);
|
|
5063
|
+
t = construct$2(dir, amount);
|
|
5064
|
+
}
|
|
4999
5065
|
const b_ = construct$1(b);
|
|
5000
5066
|
return construct$1(
|
|
5001
5067
|
translate$1(b_.one, t),
|
|
@@ -5005,10 +5071,52 @@ const translate = (b, t) => {
|
|
|
5005
5071
|
b_.root
|
|
5006
5072
|
);
|
|
5007
5073
|
};
|
|
5074
|
+
const intersect = (a, b) => {
|
|
5075
|
+
const x2 = Math.max(left(a), left(b));
|
|
5076
|
+
const y2 = Math.max(top(a), top(b));
|
|
5077
|
+
const x22 = Math.min(right(a), right(b));
|
|
5078
|
+
const y22 = Math.min(bottom(a), bottom(b));
|
|
5079
|
+
return construct$1({ x: x2, y: y2 }, { x: x22, y: y22 }, void 0, void 0, a.root);
|
|
5080
|
+
};
|
|
5081
|
+
const area = (b) => width(b) * height(b);
|
|
5082
|
+
const truncate = (b, precision = 0) => {
|
|
5083
|
+
const b_ = construct$1(b);
|
|
5084
|
+
return construct$1(
|
|
5085
|
+
truncate$1(b_.one, precision),
|
|
5086
|
+
truncate$1(b_.two, precision),
|
|
5087
|
+
void 0,
|
|
5088
|
+
void 0,
|
|
5089
|
+
b_.root
|
|
5090
|
+
);
|
|
5091
|
+
};
|
|
5092
|
+
const constructWithAlternateRoot = (x2, y2, width2, height2, currRoot, newRoot) => {
|
|
5093
|
+
const first = { x: x2, y: y2 };
|
|
5094
|
+
const second = { x: x2 + width2, y: y2 + height2 };
|
|
5095
|
+
if (currRoot.x !== newRoot.x) {
|
|
5096
|
+
if (currRoot.x === "center") {
|
|
5097
|
+
first.x -= width2 / 2;
|
|
5098
|
+
second.x -= width2 / 2;
|
|
5099
|
+
} else {
|
|
5100
|
+
first.x -= width2;
|
|
5101
|
+
second.x -= width2;
|
|
5102
|
+
}
|
|
5103
|
+
}
|
|
5104
|
+
if (currRoot.y !== newRoot.y) {
|
|
5105
|
+
if (currRoot.y === "center") {
|
|
5106
|
+
first.y -= height2 / 2;
|
|
5107
|
+
second.y -= height2 / 2;
|
|
5108
|
+
} else {
|
|
5109
|
+
first.y -= height2;
|
|
5110
|
+
second.y -= height2;
|
|
5111
|
+
}
|
|
5112
|
+
}
|
|
5113
|
+
return construct$1(first, second, void 0, void 0, newRoot);
|
|
5114
|
+
};
|
|
5008
5115
|
const box$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5009
5116
|
__proto__: null,
|
|
5010
5117
|
DECIMAL: DECIMAL$1,
|
|
5011
5118
|
ZERO: ZERO$1,
|
|
5119
|
+
area,
|
|
5012
5120
|
aspect,
|
|
5013
5121
|
bottom,
|
|
5014
5122
|
bottomLeft,
|
|
@@ -5016,6 +5124,7 @@ const box$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
5016
5124
|
box,
|
|
5017
5125
|
center,
|
|
5018
5126
|
construct: construct$1,
|
|
5127
|
+
constructWithAlternateRoot,
|
|
5019
5128
|
contains,
|
|
5020
5129
|
copy: copy$1,
|
|
5021
5130
|
css,
|
|
@@ -5023,6 +5132,7 @@ const box$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
5023
5132
|
dims,
|
|
5024
5133
|
equals: equals$1,
|
|
5025
5134
|
height,
|
|
5135
|
+
intersect,
|
|
5026
5136
|
isBox,
|
|
5027
5137
|
isZero,
|
|
5028
5138
|
left,
|
|
@@ -5041,6 +5151,7 @@ const box$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
5041
5151
|
topLeft,
|
|
5042
5152
|
topRight,
|
|
5043
5153
|
translate,
|
|
5154
|
+
truncate,
|
|
5044
5155
|
width,
|
|
5045
5156
|
x,
|
|
5046
5157
|
xBounds,
|
|
@@ -5383,6 +5494,131 @@ const scale = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
5383
5494
|
crudeXYTransform,
|
|
5384
5495
|
xyScaleToTransform
|
|
5385
5496
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5497
|
+
const posititonSoVisible = (target2, p) => {
|
|
5498
|
+
const { width: width2, height: height2 } = target2.getBoundingClientRect();
|
|
5499
|
+
const { innerWidth, innerHeight } = window;
|
|
5500
|
+
let changed = false;
|
|
5501
|
+
let nextXY = construct$2(p);
|
|
5502
|
+
if (p.x + width2 > innerWidth) {
|
|
5503
|
+
nextXY = translateX(nextXY, -width2);
|
|
5504
|
+
changed = true;
|
|
5505
|
+
}
|
|
5506
|
+
if (p.y + height2 > innerHeight) {
|
|
5507
|
+
nextXY = translateY(nextXY, -height2);
|
|
5508
|
+
changed = true;
|
|
5509
|
+
}
|
|
5510
|
+
return [nextXY, changed];
|
|
5511
|
+
};
|
|
5512
|
+
const parseLocationOptions = (initial) => {
|
|
5513
|
+
if (initial == null)
|
|
5514
|
+
return { x: void 0, y: void 0 };
|
|
5515
|
+
const parsedXYLoc = xy$1.safeParse(initial);
|
|
5516
|
+
if (parsedXYLoc.success)
|
|
5517
|
+
return parsedXYLoc.data;
|
|
5518
|
+
const parsedLoc = location$2.safeParse(initial);
|
|
5519
|
+
if (parsedLoc.success) {
|
|
5520
|
+
const isX2 = construct$4(parsedLoc.data) === "x";
|
|
5521
|
+
return isX2 ? { x: parsedLoc.data, y: void 0 } : { x: void 0, y: parsedLoc.data };
|
|
5522
|
+
}
|
|
5523
|
+
return initial;
|
|
5524
|
+
};
|
|
5525
|
+
const dialog = ({
|
|
5526
|
+
container: containerCrude,
|
|
5527
|
+
target: targetCrude,
|
|
5528
|
+
dialog: dialogCrude,
|
|
5529
|
+
initial,
|
|
5530
|
+
prefer,
|
|
5531
|
+
alignments = ["start"],
|
|
5532
|
+
disable = []
|
|
5533
|
+
}) => {
|
|
5534
|
+
const initialLocs = parseLocationOptions(initial);
|
|
5535
|
+
let options2 = XY_LOCATIONS;
|
|
5536
|
+
if (prefer != null) {
|
|
5537
|
+
const parsedPrefer = prefer.map((p) => parseLocationOptions(p));
|
|
5538
|
+
options2 = options2.slice().sort((a, b) => {
|
|
5539
|
+
const hasPreferA = parsedPrefer.findIndex((p) => xyMatches(a, p));
|
|
5540
|
+
const hasPreferB = parsedPrefer.findIndex((p) => xyMatches(b, p));
|
|
5541
|
+
if (hasPreferA > -1 && hasPreferB > -1)
|
|
5542
|
+
return hasPreferA - hasPreferB;
|
|
5543
|
+
if (hasPreferA > -1)
|
|
5544
|
+
return -1;
|
|
5545
|
+
if (hasPreferB > -1)
|
|
5546
|
+
return 1;
|
|
5547
|
+
return 0;
|
|
5548
|
+
});
|
|
5549
|
+
}
|
|
5550
|
+
const mappedOptions = options2.filter(
|
|
5551
|
+
(l) => !xyEquals(l, CENTER) && (initialLocs.x == null || l.x === initialLocs.x) && (initialLocs.y == null || l.y === initialLocs.y) && !disable.some((d) => xyMatches(l, d))
|
|
5552
|
+
).map((l) => alignments == null ? void 0 : alignments.map((a) => [l, a])).flat();
|
|
5553
|
+
const container = construct$1(containerCrude);
|
|
5554
|
+
const target2 = construct$1(targetCrude);
|
|
5555
|
+
const dialog2 = construct$1(dialogCrude);
|
|
5556
|
+
let bestOptionArea = -Infinity;
|
|
5557
|
+
const res = { location: CENTER, adjustedDialog: dialog2 };
|
|
5558
|
+
mappedOptions.forEach(([option, alignment2]) => {
|
|
5559
|
+
const [adjustedBox, area2] = evaluateOption({
|
|
5560
|
+
option,
|
|
5561
|
+
alignment: alignment2,
|
|
5562
|
+
container,
|
|
5563
|
+
target: target2,
|
|
5564
|
+
dialog: dialog2
|
|
5565
|
+
});
|
|
5566
|
+
if (area2 > bestOptionArea) {
|
|
5567
|
+
bestOptionArea = area2;
|
|
5568
|
+
res.location = option;
|
|
5569
|
+
res.adjustedDialog = adjustedBox;
|
|
5570
|
+
}
|
|
5571
|
+
});
|
|
5572
|
+
return res;
|
|
5573
|
+
};
|
|
5574
|
+
const evaluateOption = ({
|
|
5575
|
+
option,
|
|
5576
|
+
alignment: alignment2,
|
|
5577
|
+
container,
|
|
5578
|
+
target: target2,
|
|
5579
|
+
dialog: dialog2
|
|
5580
|
+
}) => {
|
|
5581
|
+
const root2 = getRoot(option, alignment2);
|
|
5582
|
+
const targetPoint = xyLoc(target2, option);
|
|
5583
|
+
const dialogBox = constructWithAlternateRoot(
|
|
5584
|
+
targetPoint.x,
|
|
5585
|
+
targetPoint.y,
|
|
5586
|
+
width(dialog2),
|
|
5587
|
+
height(dialog2),
|
|
5588
|
+
root2,
|
|
5589
|
+
TOP_LEFT
|
|
5590
|
+
);
|
|
5591
|
+
const area$1 = area(intersect(dialogBox, container));
|
|
5592
|
+
return [dialogBox, area$1];
|
|
5593
|
+
};
|
|
5594
|
+
const X_ALIGNMENT_MAP = {
|
|
5595
|
+
start: "left",
|
|
5596
|
+
center: "center",
|
|
5597
|
+
end: "right"
|
|
5598
|
+
};
|
|
5599
|
+
const Y_ALIGNMENT_MAP = {
|
|
5600
|
+
start: "bottom",
|
|
5601
|
+
center: "center",
|
|
5602
|
+
end: "top"
|
|
5603
|
+
};
|
|
5604
|
+
const getRoot = (option, alignment2) => {
|
|
5605
|
+
const out = { x: "center", y: "center" };
|
|
5606
|
+
if (option.y !== "center") {
|
|
5607
|
+
out.y = swap$1(option.y);
|
|
5608
|
+
const swapper = option.x === "left" ? swap$1 : (v) => v;
|
|
5609
|
+
out.x = swapper(X_ALIGNMENT_MAP[alignment2]);
|
|
5610
|
+
} else {
|
|
5611
|
+
out.x = swap$1(option.x);
|
|
5612
|
+
out.y = Y_ALIGNMENT_MAP[alignment2];
|
|
5613
|
+
}
|
|
5614
|
+
return out;
|
|
5615
|
+
};
|
|
5616
|
+
const position$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5617
|
+
__proto__: null,
|
|
5618
|
+
dialog,
|
|
5619
|
+
getRoot,
|
|
5620
|
+
posititonSoVisible
|
|
5621
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
5386
5622
|
const spatial = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5387
5623
|
__proto__: null,
|
|
5388
5624
|
ALIGNMENTS,
|
|
@@ -5641,6 +5877,9 @@ const _TimeStamp = class _TimeStamp extends Number {
|
|
|
5641
5877
|
truncate(span2) {
|
|
5642
5878
|
return this.sub(this.remainder(span2));
|
|
5643
5879
|
}
|
|
5880
|
+
get bigInt() {
|
|
5881
|
+
return BigInt(this.valueOf());
|
|
5882
|
+
}
|
|
5644
5883
|
/**
|
|
5645
5884
|
* @returns A new TimeStamp representing the current time in UTC. It's important to
|
|
5646
5885
|
* note that this TimeStamp is only accurate to the millisecond level (that's the best
|
|
@@ -5712,6 +5951,18 @@ const _TimeSpan = class _TimeSpan extends Number {
|
|
|
5712
5951
|
else
|
|
5713
5952
|
super(value);
|
|
5714
5953
|
}
|
|
5954
|
+
lessThan(other) {
|
|
5955
|
+
return this.valueOf() < new _TimeSpan(other).valueOf();
|
|
5956
|
+
}
|
|
5957
|
+
greaterThan(other) {
|
|
5958
|
+
return this.valueOf() > new _TimeSpan(other).valueOf();
|
|
5959
|
+
}
|
|
5960
|
+
lessThanOrEqual(other) {
|
|
5961
|
+
return this.valueOf() <= new _TimeSpan(other).valueOf();
|
|
5962
|
+
}
|
|
5963
|
+
greaterThanOrEqual(other) {
|
|
5964
|
+
return this.valueOf() >= new _TimeSpan(other).valueOf();
|
|
5965
|
+
}
|
|
5715
5966
|
remainder(divisor) {
|
|
5716
5967
|
return remainder(this, divisor);
|
|
5717
5968
|
}
|
|
@@ -6109,6 +6360,14 @@ const _TimeRange = class _TimeRange {
|
|
|
6109
6360
|
toPrettyString() {
|
|
6110
6361
|
return `${this.start.fString("preciseDate")} - ${this.span.toString()}`;
|
|
6111
6362
|
}
|
|
6363
|
+
/**
|
|
6364
|
+
* Checks if if the two time ranges overlap. If the two time ranges are equal, returns
|
|
6365
|
+
* true. If the start of one range is equal to the end of the other, returns false.
|
|
6366
|
+
* Just follow the rule [start, end) i.e. start is inclusive and end is exclusive.
|
|
6367
|
+
*
|
|
6368
|
+
* @param other - The other TimeRange to compare to.
|
|
6369
|
+
* @returns True if the two TimeRanges overlap, false otherwise.
|
|
6370
|
+
*/
|
|
6112
6371
|
overlapsWith(other) {
|
|
6113
6372
|
other = other.makeValid();
|
|
6114
6373
|
const rng = this.makeValid();
|
|
@@ -6320,6 +6579,48 @@ const _Size = class _Size extends Number {
|
|
|
6320
6579
|
sub(other) {
|
|
6321
6580
|
return _Size.bytes(this.valueOf() - other.valueOf());
|
|
6322
6581
|
}
|
|
6582
|
+
truncate(span2) {
|
|
6583
|
+
return new _Size(Math.trunc(this.valueOf() / span2.valueOf()) * span2.valueOf());
|
|
6584
|
+
}
|
|
6585
|
+
remainder(span2) {
|
|
6586
|
+
return _Size.bytes(this.valueOf() % span2.valueOf());
|
|
6587
|
+
}
|
|
6588
|
+
get gigabytes() {
|
|
6589
|
+
return this.valueOf() / _Size.GIGABYTE.valueOf();
|
|
6590
|
+
}
|
|
6591
|
+
get megabytes() {
|
|
6592
|
+
return this.valueOf() / _Size.MEGABYTE.valueOf();
|
|
6593
|
+
}
|
|
6594
|
+
get kilobytes() {
|
|
6595
|
+
return this.valueOf() / _Size.KILOBYTE.valueOf();
|
|
6596
|
+
}
|
|
6597
|
+
get terabytes() {
|
|
6598
|
+
return this.valueOf() / _Size.TERABYTE.valueOf();
|
|
6599
|
+
}
|
|
6600
|
+
toString() {
|
|
6601
|
+
const totalTB = this.truncate(_Size.TERABYTE);
|
|
6602
|
+
const totalGB = this.truncate(_Size.GIGABYTE);
|
|
6603
|
+
const totalMB = this.truncate(_Size.MEGABYTE);
|
|
6604
|
+
const totalKB = this.truncate(_Size.KILOBYTE);
|
|
6605
|
+
const totalB = this.truncate(_Size.BYTE);
|
|
6606
|
+
const tb = totalTB;
|
|
6607
|
+
const gb = totalGB.sub(totalTB);
|
|
6608
|
+
const mb = totalMB.sub(totalGB);
|
|
6609
|
+
const kb = totalKB.sub(totalMB);
|
|
6610
|
+
const bytes = totalB.sub(totalKB);
|
|
6611
|
+
let str = "";
|
|
6612
|
+
if (!tb.isZero)
|
|
6613
|
+
str += `${tb.terabytes}TB `;
|
|
6614
|
+
if (!gb.isZero)
|
|
6615
|
+
str += `${gb.gigabytes}GB `;
|
|
6616
|
+
if (!mb.isZero)
|
|
6617
|
+
str += `${mb.megabytes}MB `;
|
|
6618
|
+
if (!kb.isZero)
|
|
6619
|
+
str += `${kb.kilobytes}KB `;
|
|
6620
|
+
if (!bytes.isZero || str === "")
|
|
6621
|
+
str += `${bytes.valueOf()}B`;
|
|
6622
|
+
return str.trim();
|
|
6623
|
+
}
|
|
6323
6624
|
/**
|
|
6324
6625
|
* Creates a Size from the given number of bytes.
|
|
6325
6626
|
*
|
|
@@ -6365,7 +6666,7 @@ const _Size = class _Size extends Number {
|
|
|
6365
6666
|
static terabytes(value) {
|
|
6366
6667
|
return _Size.gigabytes(value.valueOf() * 1e3);
|
|
6367
6668
|
}
|
|
6368
|
-
isZero() {
|
|
6669
|
+
get isZero() {
|
|
6369
6670
|
return this.valueOf() === 0;
|
|
6370
6671
|
}
|
|
6371
6672
|
};
|
|
@@ -6406,11 +6707,6 @@ const convertDataType = (source, target2, value, offset = 0) => {
|
|
|
6406
6707
|
return BigInt(value) - BigInt(offset);
|
|
6407
6708
|
return addSamples(value, -offset);
|
|
6408
6709
|
};
|
|
6409
|
-
const validateFieldNotNull = (name, field) => {
|
|
6410
|
-
if (field == null) {
|
|
6411
|
-
throw new Error(`field ${name} is null`);
|
|
6412
|
-
}
|
|
6413
|
-
};
|
|
6414
6710
|
const FULL_BUFFER = -1;
|
|
6415
6711
|
class Series {
|
|
6416
6712
|
constructor({
|
|
@@ -6514,8 +6810,8 @@ class Series {
|
|
|
6514
6810
|
throw new Error("cannot release an array with a negative reference count");
|
|
6515
6811
|
}
|
|
6516
6812
|
/**
|
|
6517
|
-
* Writes the given series to this series. If the series being written exceeds the
|
|
6518
|
-
* remaining of series being written to, only the portion that fits will be written.
|
|
6813
|
+
* Writes the given series to this series. If the series being written exceeds the
|
|
6814
|
+
* remaining of series being written to, only the portion that fits will be written.
|
|
6519
6815
|
* @param other the series to write to this series. The data type of the series written
|
|
6520
6816
|
* must be the same as the data type of the series being written to.
|
|
6521
6817
|
* @returns the number of samples written. If the entire series fits, this value is
|
|
@@ -6570,7 +6866,8 @@ class Series {
|
|
|
6570
6866
|
}
|
|
6571
6867
|
/** @returns the time range of this array. */
|
|
6572
6868
|
get timeRange() {
|
|
6573
|
-
|
|
6869
|
+
if (this._timeRange == null)
|
|
6870
|
+
throw new Error("time range not set on series");
|
|
6574
6871
|
return this._timeRange;
|
|
6575
6872
|
}
|
|
6576
6873
|
/** @returns the capacity of the series in bytes. */
|
|
@@ -6752,7 +7049,8 @@ class Series {
|
|
|
6752
7049
|
sampleOffset: this.sampleOffset,
|
|
6753
7050
|
alignment: this.alignmentBounds,
|
|
6754
7051
|
timeRange: (_a2 = this._timeRange) == null ? void 0 : _a2.toString(),
|
|
6755
|
-
length: this.length
|
|
7052
|
+
length: this.length,
|
|
7053
|
+
capacity: this.capacity
|
|
6756
7054
|
};
|
|
6757
7055
|
}
|
|
6758
7056
|
get memInfo() {
|
|
@@ -7014,10 +7312,42 @@ const memo = (func) => {
|
|
|
7014
7312
|
};
|
|
7015
7313
|
return v;
|
|
7016
7314
|
};
|
|
7315
|
+
const difference = (obj1, obj2, path = "") => {
|
|
7316
|
+
const diffMap = {};
|
|
7317
|
+
const compare2 = (a, b, currentPath) => {
|
|
7318
|
+
if (typeof a !== typeof b || a === null || b === null) {
|
|
7319
|
+
diffMap[currentPath] = [a, b];
|
|
7320
|
+
return;
|
|
7321
|
+
}
|
|
7322
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
7323
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
7324
|
+
if (a.length !== b.length) {
|
|
7325
|
+
diffMap[currentPath] = [a, b];
|
|
7326
|
+
return;
|
|
7327
|
+
}
|
|
7328
|
+
for (let i = 0; i < a.length; i++) {
|
|
7329
|
+
compare2(a[i], b[i], `${currentPath}[${i}]`);
|
|
7330
|
+
}
|
|
7331
|
+
} else {
|
|
7332
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
7333
|
+
keys.forEach((key) => {
|
|
7334
|
+
compare2(a[key], b[key], currentPath ? `${currentPath}.${key}` : key);
|
|
7335
|
+
});
|
|
7336
|
+
}
|
|
7337
|
+
} else {
|
|
7338
|
+
if (a !== b) {
|
|
7339
|
+
diffMap[currentPath] = [a, b];
|
|
7340
|
+
}
|
|
7341
|
+
}
|
|
7342
|
+
};
|
|
7343
|
+
compare2(obj1, obj2, path);
|
|
7344
|
+
return diffMap;
|
|
7345
|
+
};
|
|
7017
7346
|
const external = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7018
7347
|
__proto__: null,
|
|
7019
7348
|
copy,
|
|
7020
7349
|
deleteD,
|
|
7350
|
+
difference,
|
|
7021
7351
|
element,
|
|
7022
7352
|
equal,
|
|
7023
7353
|
get,
|
|
@@ -9255,6 +9585,7 @@ const shallowCopy = (obj) => {
|
|
|
9255
9585
|
return { ...obj };
|
|
9256
9586
|
return obj;
|
|
9257
9587
|
};
|
|
9588
|
+
const invert = (condition) => condition ? -1 : 1;
|
|
9258
9589
|
export {
|
|
9259
9590
|
Case,
|
|
9260
9591
|
DataType,
|
|
@@ -9285,6 +9616,7 @@ export {
|
|
|
9285
9616
|
dimensions,
|
|
9286
9617
|
direction$1 as direction,
|
|
9287
9618
|
getEntries,
|
|
9619
|
+
invert,
|
|
9288
9620
|
isObject,
|
|
9289
9621
|
isStringer,
|
|
9290
9622
|
types as kv,
|
|
@@ -9292,6 +9624,7 @@ export {
|
|
|
9292
9624
|
nativeTypedArray,
|
|
9293
9625
|
nullToArr,
|
|
9294
9626
|
observe,
|
|
9627
|
+
position$2 as position,
|
|
9295
9628
|
primitiveIsZero,
|
|
9296
9629
|
external$1 as runtime,
|
|
9297
9630
|
scale,
|
|
@@ -9303,4 +9636,4 @@ export {
|
|
|
9303
9636
|
unknownRecordZ,
|
|
9304
9637
|
xy
|
|
9305
9638
|
};
|
|
9306
|
-
//# sourceMappingURL=x.
|
|
9639
|
+
//# sourceMappingURL=x.js.map
|