@synnaxlabs/x 0.12.0 → 0.14.1
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/binary/encoder.d.ts +2 -22
- 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/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 +91 -15
- package/dist/x.cjs +8 -0
- package/dist/x.cjs.map +1 -0
- package/dist/x.js +6731 -0
- package/dist/x.js.map +1 -0
- package/package.json +7 -6
- package/src/binary/encoder.ts +13 -37
- 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/primitive.ts +1 -1
- 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.spec.ts +1 -3
- package/src/telem/series.ts +6 -10
- package/src/telem/telem.spec.ts +127 -24
- package/src/telem/telem.ts +162 -41
- package/vite.config.ts +1 -1
- package/dist/spatial/position.d.ts +0 -2
- package/dist/x.cjs.js +0 -9305
- package/dist/x.cjs.js.map +0 -1
- package/dist/x.es.js +0 -9306
- package/dist/x.es.js.map +0 -1
- package/src/spatial/position.ts +0 -26
- package/src/telem/encode.ts +0 -22
- /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/dist/{telem/encode.d.ts → spatial/scale/scale.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/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @synnaxlabs/x@0.
|
|
2
|
+
> @synnaxlabs/x@0.14.1 build /home/runner/work/synnax/synnax/x/ts
|
|
3
3
|
> tsc --noEmit && vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v5.1.2 [32mbuilding for production...[36m[39m
|
|
6
6
|
transforming...
|
|
7
7
|
[1m[33m[plugin:vite:resolve][39m[22m [33mModule "crypto" has been externalized for browser compatibility, imported by "/home/runner/work/synnax/synnax/node_modules/.pnpm/nanoid@3.0.0/node_modules/nanoid/index.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.[39m
|
|
8
|
-
[32m✓[39m
|
|
8
|
+
[32m✓[39m 127 modules transformed.
|
|
9
9
|
rendering chunks...
|
|
10
10
|
[32m
|
|
11
11
|
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
12
12
|
computing gzip size...
|
|
13
|
-
[2mdist/[22m[36mx.
|
|
14
|
-
[32m[36m[vite:dts][32m Declaration files built in
|
|
13
|
+
[2mdist/[22m[36mx.js [39m[1m[2m209.89 kB[22m[1m[22m[2m │ gzip: 49.04 kB[22m[2m │ map: 632.82 kB[22m
|
|
14
|
+
[32m[36m[vite:dts][32m Declaration files built in 3265ms.
|
|
15
15
|
[39m
|
|
16
|
-
[2mdist/[22m[36mx.cjs
|
|
17
|
-
[32m✓ built in
|
|
16
|
+
[2mdist/[22m[36mx.cjs [39m[1m[2m137.61 kB[22m[1m[22m[2m │ gzip: 39.21 kB[22m[2m │ map: 612.53 kB[22m
|
|
17
|
+
[32m✓ built in 4.16s[39m
|
package/dist/binary/encoder.d.ts
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
import { type ZodSchema, type z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* CustomTypeEncoder is an interface for a class that needs to transform its
|
|
4
|
-
* value before encoding.
|
|
5
|
-
*/
|
|
6
|
-
interface CustomTypeEncoder {
|
|
7
|
-
/** The Class the custom encoder is set for */
|
|
8
|
-
Class: Function;
|
|
9
|
-
/**
|
|
10
|
-
* The function that transforms the value before encoding;
|
|
11
|
-
*
|
|
12
|
-
* @param instance - The instance of the class to transform.
|
|
13
|
-
* @returns The transformed value.
|
|
14
|
-
*/
|
|
15
|
-
write: <P>(instance: P) => unknown;
|
|
16
|
-
}
|
|
17
2
|
/**
|
|
18
3
|
* EncoderDecoder is an entity that encodes and decodes messages to and from a
|
|
19
4
|
* binary format.
|
|
@@ -36,24 +21,19 @@ export interface EncoderDecoder {
|
|
|
36
21
|
*/
|
|
37
22
|
decode: <P>(data: Uint8Array | ArrayBuffer, schema?: ZodSchema<P>) => P;
|
|
38
23
|
}
|
|
39
|
-
interface StaticEncoderDecoder {
|
|
40
|
-
registerCustomType: (encoder: CustomTypeEncoder) => void;
|
|
41
|
-
}
|
|
42
24
|
/** MsgpackEncoderDecoder is a msgpack implementation of EncoderDecoder. */
|
|
43
25
|
export declare class MsgpackEncoderDecoder implements EncoderDecoder {
|
|
44
26
|
contentType: string;
|
|
45
27
|
encode(payload: unknown): ArrayBuffer;
|
|
46
28
|
decode<P extends z.ZodTypeAny>(data: Uint8Array | ArrayBuffer, schema?: P): z.output<P>;
|
|
47
|
-
static registerCustomType(encoder: CustomTypeEncoder): void;
|
|
48
29
|
}
|
|
49
30
|
/** JSONEncoderDecoder is a JSON implementation of EncoderDecoder. */
|
|
50
31
|
export declare class JSONEncoderDecoder implements EncoderDecoder {
|
|
51
32
|
contentType: string;
|
|
33
|
+
readonly decoder: TextDecoder;
|
|
34
|
+
constructor();
|
|
52
35
|
encode(payload: unknown): ArrayBuffer;
|
|
53
36
|
decode<P extends z.ZodTypeAny>(data: Uint8Array | ArrayBuffer, schema?: P): z.output<P>;
|
|
54
37
|
static registerCustomType(): void;
|
|
55
38
|
}
|
|
56
39
|
export declare const ENCODERS: EncoderDecoder[];
|
|
57
|
-
export declare const ENCODER_CLASSES: StaticEncoderDecoder[];
|
|
58
|
-
export declare const registerCustomTypeEncoder: (encoder: CustomTypeEncoder) => void;
|
|
59
|
-
export {};
|
package/dist/deep/external.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/invert.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const invert: (condition: boolean) => -1 | 1;
|
package/dist/optional.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Bounds, bounds, type CrudeBounds } from '
|
|
1
|
+
import { type Bounds, bounds, type CrudeBounds } from '../base';
|
|
2
2
|
export { type Bounds, bounds };
|
|
3
3
|
export type Crude = CrudeBounds;
|
|
4
4
|
export declare const construct: (lower: number | Crude, upper?: number) => Bounds;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as bounds from './bounds';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type * as bounds from '
|
|
3
|
-
import type * as dimensions from '
|
|
4
|
-
import * as direction from '
|
|
5
|
-
import * as location from '
|
|
6
|
-
import * as xy from '
|
|
2
|
+
import type * as bounds from '../bounds/bounds';
|
|
3
|
+
import type * as dimensions from '../dimensions/dimensions';
|
|
4
|
+
import * as direction from '../direction/direction';
|
|
5
|
+
import * as location from '../location/location';
|
|
6
|
+
import * as xy from '../xy/xy';
|
|
7
7
|
declare const cssBox: z.ZodObject<{
|
|
8
8
|
top: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
9
9
|
left: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
@@ -97,7 +97,7 @@ export declare const box: z.ZodObject<{
|
|
|
97
97
|
export type Box = z.infer<typeof box>;
|
|
98
98
|
export type CSS = z.infer<typeof cssBox>;
|
|
99
99
|
export type DOMRect = z.infer<typeof domRect>;
|
|
100
|
-
type Crude = DOMRect | Box | {
|
|
100
|
+
export type Crude = DOMRect | Box | {
|
|
101
101
|
getBoundingClientRect: () => DOMRect;
|
|
102
102
|
};
|
|
103
103
|
/** A box centered at (0,0) with a width and height of 0. */
|
|
@@ -147,7 +147,20 @@ export declare const copy: (b: Box, root?: location.CornerXY) => Box;
|
|
|
147
147
|
export declare const construct: (first: number | DOMRect | xy.XY | Box | {
|
|
148
148
|
getBoundingClientRect: () => DOMRect;
|
|
149
149
|
}, second?: number | xy.XY | dimensions.Dimensions | dimensions.Signed, width?: number, height?: number, coordinateRoot?: location.CornerXY) => Box;
|
|
150
|
-
export
|
|
150
|
+
export interface Resize {
|
|
151
|
+
/**
|
|
152
|
+
* Sets the dimensions of the box to the given dimensions.
|
|
153
|
+
* @example resize(b, { width: 10, height: 10 }) // Sets the box to a 10x10 box.
|
|
154
|
+
*/
|
|
155
|
+
(b: Crude, dims: dimensions.Dimensions | dimensions.Signed): Box;
|
|
156
|
+
/**
|
|
157
|
+
* Sets the dimension along the given direction to the given amount.
|
|
158
|
+
* @example resize(b, "x", 10) // Sets the width of the box to 10.
|
|
159
|
+
* @example resize(b, "y", 10) // Sets the height of the box to 10.
|
|
160
|
+
*/
|
|
161
|
+
(b: Crude, direction: direction.Direction, amount: number): Box;
|
|
162
|
+
}
|
|
163
|
+
export declare const resize: Resize;
|
|
151
164
|
/**
|
|
152
165
|
* Checks if a box contains a point or another box.
|
|
153
166
|
*
|
|
@@ -236,5 +249,9 @@ export declare const isBox: (value: unknown) => value is {
|
|
|
236
249
|
};
|
|
237
250
|
};
|
|
238
251
|
export declare const aspect: (b: Box) => number;
|
|
239
|
-
export declare const translate: (b:
|
|
252
|
+
export declare const translate: (b: Crude, t: xy.XY | direction.Direction, amount?: number) => Box;
|
|
253
|
+
export declare const intersect: (a: Box, b: Box) => Box;
|
|
254
|
+
export declare const area: (b: Box) => number;
|
|
255
|
+
export declare const truncate: (b: Box, precision?: number) => Box;
|
|
256
|
+
export declare const constructWithAlternateRoot: (x: number, y: number, width: number, height: number, currRoot: location.XY, newRoot: location.CornerXY) => Box;
|
|
240
257
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as box from './box';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as dimensions from './dimensions';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Dimension, type Direction, type Location, type direction, type SignedDimension, type CrudeDirection } from '
|
|
1
|
+
import { type Dimension, type Direction, type Location, type direction, type SignedDimension, type CrudeDirection } from '../base';
|
|
2
2
|
export type { Direction, direction };
|
|
3
3
|
export declare const crude: import("zod").ZodUnion<[import("zod").ZodEnum<["x", "y"]>, import("zod").ZodEnum<["top", "right", "bottom", "left", "center"]>]>;
|
|
4
4
|
export type Crude = CrudeDirection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as direction from './direction';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export
|
|
3
|
-
export *
|
|
4
|
-
export *
|
|
5
|
-
export *
|
|
6
|
-
export *
|
|
7
|
-
export *
|
|
1
|
+
export * from './bounds';
|
|
2
|
+
export { box } from './box';
|
|
3
|
+
export * from './dimensions';
|
|
4
|
+
export * from './direction';
|
|
5
|
+
export * from './location';
|
|
6
|
+
export * from './xy';
|
|
7
|
+
export * from './scale';
|
|
8
|
+
export * from './position';
|
|
8
9
|
export * as spatial from './spatial';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as location from './location';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { location, type Location, X_LOCATIONS, Y_LOCATIONS, CENTER_LOCATIONS, type XLocation, type OuterLocation, type YLocation, outerLocation, type Direction, type CrudeLocation } from '
|
|
2
|
+
import { location, type Location, X_LOCATIONS, Y_LOCATIONS, CENTER_LOCATIONS, type XLocation, type OuterLocation, type YLocation, outerLocation, type Direction, type CrudeLocation, type CenterLocation } from '../base';
|
|
3
3
|
export { location, type Location, X_LOCATIONS, Y_LOCATIONS, CENTER_LOCATIONS, outerLocation as outer, };
|
|
4
4
|
export declare const x: z.ZodEnum<["left", "right"]>;
|
|
5
5
|
export declare const y: z.ZodEnum<["top", "bottom"]>;
|
|
6
6
|
export type X = XLocation;
|
|
7
7
|
export type Y = YLocation;
|
|
8
8
|
export type Outer = OuterLocation;
|
|
9
|
+
export type Center = CenterLocation;
|
|
9
10
|
export declare const crude: z.ZodUnion<[z.ZodEnum<["x", "y"]>, z.ZodEnum<["top", "right", "bottom", "left", "center"]>, z.ZodType<String, z.ZodTypeDef, String>]>;
|
|
10
11
|
export type Crude = CrudeLocation;
|
|
11
12
|
export declare const construct: (cl: Crude) => Location;
|
|
@@ -13,14 +14,14 @@ export declare const swap: (cl: Crude) => Location;
|
|
|
13
14
|
export declare const rotate90: (cl: Crude) => Location;
|
|
14
15
|
export declare const direction: (cl: Crude) => Direction;
|
|
15
16
|
export declare const xy: z.ZodObject<{
|
|
16
|
-
x: z.ZodEnum<["
|
|
17
|
-
y: z.ZodEnum<["top", "
|
|
17
|
+
x: z.ZodUnion<[z.ZodEnum<["left", "right"]>, z.ZodEnum<["center"]>]>;
|
|
18
|
+
y: z.ZodUnion<[z.ZodEnum<["top", "bottom"]>, z.ZodEnum<["center"]>]>;
|
|
18
19
|
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
x: "center" | "
|
|
20
|
-
y: "center" | "top" | "
|
|
20
|
+
x: "center" | "right" | "left";
|
|
21
|
+
y: "center" | "top" | "bottom";
|
|
21
22
|
}, {
|
|
22
|
-
x: "center" | "
|
|
23
|
-
y: "center" | "top" | "
|
|
23
|
+
x: "center" | "right" | "left";
|
|
24
|
+
y: "center" | "top" | "bottom";
|
|
24
25
|
}>;
|
|
25
26
|
export declare const corner: z.ZodObject<{
|
|
26
27
|
x: z.ZodEnum<["left", "right"]>;
|
|
@@ -44,9 +45,11 @@ export declare const TOP_CENTER: XY;
|
|
|
44
45
|
export declare const BOTTOM_CENTER: XY;
|
|
45
46
|
export declare const RIGHT_CENTER: XY;
|
|
46
47
|
export declare const LEFT_CENTER: XY;
|
|
48
|
+
export declare const XY_LOCATIONS: readonly XY[];
|
|
47
49
|
export declare const xyEquals: (a: XY, b: XY) => boolean;
|
|
50
|
+
export declare const xyMatches: (a: XY, l: Partial<XY> | Location) => boolean;
|
|
48
51
|
export declare const xyCouple: (a: XY) => [Location, Location];
|
|
49
|
-
export declare const isX: (a: Crude) =>
|
|
50
|
-
export declare const isY: (a: Crude) =>
|
|
52
|
+
export declare const isX: (a: Crude) => a is "center" | "right" | "left";
|
|
53
|
+
export declare const isY: (a: Crude) => a is "top" | "bottom";
|
|
51
54
|
export declare const xyToString: (a: XY) => string;
|
|
52
55
|
export declare const constructXY: (x: Crude | XY, y?: Crude) => XY;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as position from './position';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Alignment } from '../base';
|
|
2
|
+
import { box } from '../box';
|
|
3
|
+
import { location } from '../location';
|
|
4
|
+
import { xy } from '../xy';
|
|
5
|
+
export declare const posititonSoVisible: (target: HTMLElement, p: xy.XY) => [xy.XY, boolean];
|
|
6
|
+
export interface DialogProps {
|
|
7
|
+
container: box.Crude;
|
|
8
|
+
target: box.Crude;
|
|
9
|
+
dialog: box.Crude;
|
|
10
|
+
alignments?: Alignment[];
|
|
11
|
+
initial?: location.Outer | Partial<location.XY> | location.XY;
|
|
12
|
+
prefer?: Array<location.Outer | Partial<location.XY> | location.XY>;
|
|
13
|
+
disable?: Array<location.Location | Partial<location.XY>>;
|
|
14
|
+
}
|
|
15
|
+
export interface DialogReturn {
|
|
16
|
+
location: location.XY;
|
|
17
|
+
adjustedDialog: box.Box;
|
|
18
|
+
}
|
|
19
|
+
export declare const dialog: ({ container: containerCrude, target: targetCrude, dialog: dialogCrude, initial, prefer, alignments, disable, }: DialogProps) => DialogReturn;
|
|
20
|
+
export declare const getRoot: (option: location.XY, alignment: Alignment) => location.XY;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as scale from './scale';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import * as bounds from '
|
|
3
|
-
import { type Box } from '
|
|
4
|
-
import type * as dims from '
|
|
5
|
-
import * as location from '
|
|
6
|
-
import * as xy from '
|
|
2
|
+
import * as bounds from '../bounds/bounds';
|
|
3
|
+
import { type Box } from '../box/box';
|
|
4
|
+
import type * as dims from '../dimensions/dimensions';
|
|
5
|
+
import * as location from '../location/location';
|
|
6
|
+
import * as xy from '../xy/xy';
|
|
7
7
|
export declare const crudeXYTransform: z.ZodObject<{
|
|
8
8
|
offset: z.ZodUnion<[z.ZodNumber, z.ZodObject<{
|
|
9
9
|
x: z.ZodNumber;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as xy from './xy';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { clientXY, xy, type ClientXY, type XY, type Direction } from '
|
|
2
|
+
import { clientXY, xy, type ClientXY, type XY, type Direction } from '../base';
|
|
3
3
|
export { clientXY, xy, type ClientXY as Client, type XY };
|
|
4
4
|
/** A crude representation of a {@link XY} coordinate as a zod schema. */
|
|
5
5
|
export declare const crudeZ: z.ZodUnion<[z.ZodNumber, z.ZodObject<{
|
|
@@ -49,7 +49,7 @@ export type Crude = z.infer<typeof crudeZ>;
|
|
|
49
49
|
* @param y - If x is a number, the y coordinate. If x is a number and this argument is
|
|
50
50
|
* not given, the y coordinate is assumed to be the same as the x coordinate.
|
|
51
51
|
*/
|
|
52
|
-
export declare const construct: (x: Crude, y?: number) => XY;
|
|
52
|
+
export declare const construct: (x: Crude | Direction, y?: number) => XY;
|
|
53
53
|
/** An x and y coordinate of zero */
|
|
54
54
|
export declare const ZERO: {
|
|
55
55
|
x: number;
|
|
@@ -83,13 +83,13 @@ export declare const scale: (c: Crude, x: number, y?: number) => XY;
|
|
|
83
83
|
export declare const translateX: (c: Crude, x: number) => XY;
|
|
84
84
|
/** @returns the given coordinate translated in the Y direction by the given amount. */
|
|
85
85
|
export declare const translateY: (c: Crude, y: number) => XY;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
export declare const translate:
|
|
86
|
+
interface Translate {
|
|
87
|
+
/** @returns the sum of the given coordinates. */
|
|
88
|
+
(a: Crude, b: Crude, ...cb: Crude[]): XY;
|
|
89
|
+
/** @returns the coordinates translated in the given direction by the given value. */
|
|
90
|
+
(a: Crude, direction: Direction, value: number): XY;
|
|
91
|
+
}
|
|
92
|
+
export declare const translate: Translate;
|
|
93
93
|
/**
|
|
94
94
|
* @returns the given coordinate the given direction set to the given value.
|
|
95
95
|
* @example set({ x: 1, y: 2 }, "x", 3) // { x: 3, y: 2 }
|
|
@@ -117,3 +117,4 @@ export declare const css: (a: Crude) => {
|
|
|
117
117
|
left: number;
|
|
118
118
|
top: number;
|
|
119
119
|
};
|
|
120
|
+
export declare const truncate: (a: Crude, precision?: number) => XY;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/telem/series.d.ts
CHANGED
package/dist/telem/telem.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type DateComponents = [number?, number?, number?];
|
|
|
16
16
|
* 1. A number representing the number of milliseconds since the Unix epoch.
|
|
17
17
|
* 2. A javascript Date object.
|
|
18
18
|
* 3. An array of numbers satisfying the DateComponents type, where the first element is the
|
|
19
|
-
* year, the second is the month, and the third is the day. To
|
|
19
|
+
* year, the second is the month, and the third is the day. To incraase resolution
|
|
20
20
|
* when using this method, use the add method. It's important to note that this initializes
|
|
21
21
|
* a timestamp at midnight UTC, regardless of the timezone specified.
|
|
22
22
|
* 4. An ISO compliant date or date time string. The time zone component is ignored.
|
|
@@ -29,9 +29,13 @@ export type DateComponents = [number?, number?, number?];
|
|
|
29
29
|
* @example ts = new TimeStamp([2021, 1, 1]).add(1 * TimeSpan.HOUR) // 1/1/2021 at 1am UTC
|
|
30
30
|
* @example ts = new TimeStamp("2021-01-01T12:30:00Z") // 1/1/2021 at 12:30pm UTC
|
|
31
31
|
*/
|
|
32
|
-
export declare class TimeStamp
|
|
32
|
+
export declare class TimeStamp implements Stringer {
|
|
33
|
+
private readonly value;
|
|
34
|
+
readonly encodeValue: true;
|
|
33
35
|
constructor(value?: CrudeTimeStamp, tzInfo?: TZInfo);
|
|
34
36
|
private static parseDate;
|
|
37
|
+
encode(): string;
|
|
38
|
+
valueOf(): bigint;
|
|
35
39
|
private static parseTimeString;
|
|
36
40
|
private static parseDateTimeString;
|
|
37
41
|
fString(format?: TimeStampStringFormat, tzInfo?: TZInfo): string;
|
|
@@ -159,6 +163,8 @@ export declare class TimeStamp extends Number implements Stringer {
|
|
|
159
163
|
* JavaScript can do).
|
|
160
164
|
*/
|
|
161
165
|
static now(): TimeStamp;
|
|
166
|
+
static max(...timestamps: CrudeTimeStamp[]): TimeStamp;
|
|
167
|
+
static min(...timestamps: CrudeTimeStamp[]): TimeStamp;
|
|
162
168
|
/** @returns a new TimeStamp n nanoseconds after the unix epoch */
|
|
163
169
|
static nanoseconds(value: number): TimeStamp;
|
|
164
170
|
static readonly NANOSECOND: TimeStamp;
|
|
@@ -193,14 +199,29 @@ export declare class TimeStamp extends Number implements Stringer {
|
|
|
193
199
|
/** The unix epoch */
|
|
194
200
|
static readonly ZERO: TimeStamp;
|
|
195
201
|
/** A zod schema for validating timestamps */
|
|
196
|
-
static readonly z: z.ZodUnion<[z.ZodEffects<z.
|
|
202
|
+
static readonly z: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
203
|
+
value: z.ZodBigInt;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
value: bigint;
|
|
206
|
+
}, {
|
|
207
|
+
value: bigint;
|
|
208
|
+
}>, TimeStamp, {
|
|
209
|
+
value: bigint;
|
|
210
|
+
}>, z.ZodEffects<z.ZodString, TimeStamp, string>, z.ZodEffects<z.ZodType<Number, z.ZodTypeDef, Number>, TimeStamp, Number>, z.ZodEffects<z.ZodNumber, TimeStamp, number>, z.ZodType<TimeStamp, z.ZodTypeDef, TimeStamp>]>;
|
|
197
211
|
}
|
|
198
212
|
/** TimeSpan represents a nanosecond precision duration. */
|
|
199
|
-
export declare class TimeSpan
|
|
213
|
+
export declare class TimeSpan implements Stringer {
|
|
214
|
+
private readonly value;
|
|
215
|
+
readonly encodeValue: true;
|
|
200
216
|
constructor(value: CrudeTimeSpan);
|
|
217
|
+
encode(): string;
|
|
218
|
+
valueOf(): bigint;
|
|
219
|
+
lessThan(other: CrudeTimeSpan): boolean;
|
|
220
|
+
greaterThan(other: CrudeTimeSpan): boolean;
|
|
221
|
+
lessThanOrEqual(other: CrudeTimeSpan): boolean;
|
|
222
|
+
greaterThanOrEqual(other: CrudeTimeSpan): boolean;
|
|
201
223
|
remainder(divisor: TimeSpan): TimeSpan;
|
|
202
224
|
truncate(span: TimeSpan): TimeSpan;
|
|
203
|
-
multiply(factor: number): TimeSpan;
|
|
204
225
|
toString(): string;
|
|
205
226
|
/** @returns the decimal number of days in the timespan */
|
|
206
227
|
get days(): number;
|
|
@@ -308,7 +329,15 @@ export declare class TimeSpan extends Number implements Stringer {
|
|
|
308
329
|
/** The zero value for a TimeSpan. */
|
|
309
330
|
static readonly ZERO: TimeSpan;
|
|
310
331
|
/** A zod schema for validating and transforming timespans */
|
|
311
|
-
static readonly z: z.ZodUnion<[z.ZodEffects<z.
|
|
332
|
+
static readonly z: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
333
|
+
value: z.ZodBigInt;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
value: bigint;
|
|
336
|
+
}, {
|
|
337
|
+
value: bigint;
|
|
338
|
+
}>, TimeSpan, {
|
|
339
|
+
value: bigint;
|
|
340
|
+
}>, z.ZodEffects<z.ZodString, TimeSpan, string>, z.ZodEffects<z.ZodType<Number, z.ZodTypeDef, Number>, TimeSpan, Number>, z.ZodEffects<z.ZodNumber, TimeSpan, number>, z.ZodType<TimeSpan, z.ZodTypeDef, TimeSpan>]>;
|
|
312
341
|
}
|
|
313
342
|
/** Rate represents a data rate in Hz. */
|
|
314
343
|
export declare class Rate extends Number implements Stringer {
|
|
@@ -465,6 +494,14 @@ export declare class TimeRange implements Stringer {
|
|
|
465
494
|
equals(other: TimeRange): boolean;
|
|
466
495
|
toString(): string;
|
|
467
496
|
toPrettyString(): string;
|
|
497
|
+
/**
|
|
498
|
+
* Checks if if the two time ranges overlap. If the two time ranges are equal, returns
|
|
499
|
+
* true. If the start of one range is equal to the end of the other, returns false.
|
|
500
|
+
* Just follow the rule [start, end) i.e. start is inclusive and end is exclusive.
|
|
501
|
+
*
|
|
502
|
+
* @param other - The other TimeRange to compare to.
|
|
503
|
+
* @returns True if the two TimeRanges overlap, false otherwise.
|
|
504
|
+
*/
|
|
468
505
|
overlapsWith(other: TimeRange): boolean;
|
|
469
506
|
contains(other: TimeRange): boolean;
|
|
470
507
|
contains(ts: CrudeTimeStamp): boolean;
|
|
@@ -477,17 +514,49 @@ export declare class TimeRange implements Stringer {
|
|
|
477
514
|
static readonly ZERO: TimeRange;
|
|
478
515
|
/** A zod schema for validating and transforming time ranges */
|
|
479
516
|
static readonly z: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
480
|
-
start: z.ZodUnion<[z.ZodEffects<z.
|
|
481
|
-
|
|
517
|
+
start: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
518
|
+
value: z.ZodBigInt;
|
|
519
|
+
}, "strip", z.ZodTypeAny, {
|
|
520
|
+
value: bigint;
|
|
521
|
+
}, {
|
|
522
|
+
value: bigint;
|
|
523
|
+
}>, TimeStamp, {
|
|
524
|
+
value: bigint;
|
|
525
|
+
}>, z.ZodEffects<z.ZodString, TimeStamp, string>, z.ZodEffects<z.ZodType<Number, z.ZodTypeDef, Number>, TimeStamp, Number>, z.ZodEffects<z.ZodNumber, TimeStamp, number>, z.ZodType<TimeStamp, z.ZodTypeDef, TimeStamp>]>;
|
|
526
|
+
end: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
527
|
+
value: z.ZodBigInt;
|
|
528
|
+
}, "strip", z.ZodTypeAny, {
|
|
529
|
+
value: bigint;
|
|
530
|
+
}, {
|
|
531
|
+
value: bigint;
|
|
532
|
+
}>, TimeStamp, {
|
|
533
|
+
value: bigint;
|
|
534
|
+
}>, z.ZodEffects<z.ZodString, TimeStamp, string>, z.ZodEffects<z.ZodType<Number, z.ZodTypeDef, Number>, TimeStamp, Number>, z.ZodEffects<z.ZodNumber, TimeStamp, number>, z.ZodType<TimeStamp, z.ZodTypeDef, TimeStamp>]>;
|
|
482
535
|
}, "strip", z.ZodTypeAny, {
|
|
483
536
|
start: TimeStamp;
|
|
484
537
|
end: TimeStamp;
|
|
485
538
|
}, {
|
|
486
|
-
start: (
|
|
487
|
-
|
|
539
|
+
start: (string | number | Number | TimeStamp | {
|
|
540
|
+
value: bigint;
|
|
541
|
+
}) & (string | number | Number | TimeStamp | {
|
|
542
|
+
value: bigint;
|
|
543
|
+
} | undefined);
|
|
544
|
+
end: (string | number | Number | TimeStamp | {
|
|
545
|
+
value: bigint;
|
|
546
|
+
}) & (string | number | Number | TimeStamp | {
|
|
547
|
+
value: bigint;
|
|
548
|
+
} | undefined);
|
|
488
549
|
}>, TimeRange, {
|
|
489
|
-
start: (
|
|
490
|
-
|
|
550
|
+
start: (string | number | Number | TimeStamp | {
|
|
551
|
+
value: bigint;
|
|
552
|
+
}) & (string | number | Number | TimeStamp | {
|
|
553
|
+
value: bigint;
|
|
554
|
+
} | undefined);
|
|
555
|
+
end: (string | number | Number | TimeStamp | {
|
|
556
|
+
value: bigint;
|
|
557
|
+
}) & (string | number | Number | TimeStamp | {
|
|
558
|
+
value: bigint;
|
|
559
|
+
} | undefined);
|
|
491
560
|
}>, z.ZodType<TimeRange, z.ZodTypeDef, TimeRange>]>;
|
|
492
561
|
}
|
|
493
562
|
/** DataType is a string that represents a data type. */
|
|
@@ -562,6 +631,13 @@ export declare class Size extends Number implements Stringer {
|
|
|
562
631
|
smallerThan(other: CrudeSize): boolean;
|
|
563
632
|
add(other: CrudeSize): Size;
|
|
564
633
|
sub(other: CrudeSize): Size;
|
|
634
|
+
truncate(span: CrudeSize): Size;
|
|
635
|
+
remainder(span: CrudeSize): Size;
|
|
636
|
+
get gigabytes(): number;
|
|
637
|
+
get megabytes(): number;
|
|
638
|
+
get kilobytes(): number;
|
|
639
|
+
get terabytes(): number;
|
|
640
|
+
toString(): string;
|
|
565
641
|
/**
|
|
566
642
|
* Creates a Size from the given number of bytes.
|
|
567
643
|
*
|
|
@@ -611,11 +687,11 @@ export declare class Size extends Number implements Stringer {
|
|
|
611
687
|
static readonly ZERO: Size;
|
|
612
688
|
/** A zod schema for a Size. */
|
|
613
689
|
static readonly z: z.ZodUnion<[z.ZodEffects<z.ZodNumber, Size, number>, z.ZodType<Size, z.ZodTypeDef, Size>]>;
|
|
614
|
-
isZero(): boolean;
|
|
690
|
+
get isZero(): boolean;
|
|
615
691
|
}
|
|
616
|
-
export type CrudeTimeStamp = TimeStamp | TimeSpan | number | Date | string | DateComponents | Number;
|
|
692
|
+
export type CrudeTimeStamp = bigint | BigInt | TimeStamp | TimeSpan | number | Date | string | DateComponents | Number;
|
|
617
693
|
export type TimeStampT = number;
|
|
618
|
-
export type CrudeTimeSpan = TimeSpan | TimeStamp | number | Number;
|
|
694
|
+
export type CrudeTimeSpan = bigint | BigInt | TimeSpan | TimeStamp | number | Number;
|
|
619
695
|
export type TimeSpanT = number;
|
|
620
696
|
export type CrudeRate = Rate | number | Number;
|
|
621
697
|
export type RateT = number;
|