Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsnow301 committed Jul 8, 2024
1 parent 1be7761 commit 1426f0f
Show file tree
Hide file tree
Showing 37 changed files with 150 additions and 1,450 deletions.
4 changes: 0 additions & 4 deletions dist/common/assets.d.ts

This file was deleted.

25 changes: 0 additions & 25 deletions dist/common/assets.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/common/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export declare const RADIO_CHANNELS: readonly [{
readonly color: "#1ecc43";
}];
export declare function getGasLabel(gasId: string, fallbackValue?: string): string;
export declare function getGasColor(gasId: string): "black" | "blue" | "brown" | "grey" | "olive" | "pink" | "purple" | "teal" | "white" | "yellow" | "lightsteelblue" | "bisque" | "limegreen" | "mediumpurple" | "mediumslateblue" | "paleturquoise" | "salmon" | "greenyellow" | "darkgreen" | "aliceblue" | "maroon";
export declare function getGasColor(gasId: string): string;
export declare const getGasFromId: (gasId: string) => Gas | undefined;
export declare const getGasFromPath: (gasPath: string) => Gas | undefined;
export {};
2 changes: 1 addition & 1 deletion dist/common/exhaustive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* exhaustiveCheck(color);
* }
*/
export declare function exhaustiveCheck(input: never): void;
export declare function exhaustiveCheck(input: never): never;
6 changes: 3 additions & 3 deletions dist/common/format.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export declare const formatSiUnit: (value: number, minBase1000?: number, unit?: string) => string;
export declare function formatSiUnit(value: number, minBase1000?: number, unit?: string): string;
export declare function formatPower(value: number, minBase1000?: number): string;
export declare function formatEnergy(value: number, minBase1000?: number): string;
export declare function formatMoney(value: number, precision?: number): string;
export declare function formatDb(value: number): string;
export declare const formatSiBaseTenUnit: (value: number, minBase1000?: number, unit?: string) => string;
export declare function formatSiBaseTenUnit(value: number, minBase1000?: number, unit?: string): string;
/**
* Formats decisecond count into HH:MM:SS display by default
* "short" format does not pad and adds hms suffixes
*/
export declare const formatTime: (val: number, formatType?: "short" | "default") => string;
export declare function formatTime(val: number, formatType?: 'short' | 'default'): string;
23 changes: 13 additions & 10 deletions dist/common/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,19 @@ const d = [
"F",
"N",
"H"
], l = d.indexOf(" "), m = (t, n = -l, s = "") => {
], l = d.indexOf(" ");
function u(t, n = -l, s = "") {
if (!isFinite(t))
return t.toString();
const o = Math.floor(Math.log10(Math.abs(t))), r = Math.max(n * 3, o), e = Math.floor(r / 3), i = d[Math.min(e + l, d.length - 1)];
let a = (t / Math.pow(1e3, e)).toFixed(2);
return a.endsWith(".00") ? a = a.slice(0, -3) : a.endsWith(".0") && (a = a.slice(0, -2)), `${a} ${i.trim()}${s}`.trim();
};
}
function S(t, n = 0) {
return m(t, n, "W");
return u(t, n, "W");
}
function $(t, n = 0) {
return m(t, n, "J");
return u(t, n, "J");
}
function b(t, n = 0) {
if (!Number.isFinite(t))
Expand Down Expand Up @@ -89,26 +90,28 @@ const M = [
"· 10³³",
"· 10³⁶",
"· 10³⁹"
], p = (t, n = 0, s = "") => {
];
function p(t, n = 0, s = "") {
if (!isFinite(t))
return "NaN";
const o = Math.floor(Math.log10(t)), r = Math.max(n * 3, o), e = Math.floor(r / 3), i = M[e], c = t / Math.pow(1e3, e), a = Math.max(0, 2 - r % 3);
return `${c.toFixed(a)} ${i} ${s}`.trim();
}, F = (t, n = "default") => {
}
function F(t, n = "default") {
const s = Math.floor(t / 10), o = Math.floor(s / 3600), r = Math.floor(s % 3600 / 60), e = s % 60;
if (n === "short") {
const f = o > 0 ? `${o}h` : "", u = r > 0 ? `${r}m` : "", h = e > 0 ? `${e}s` : "";
return `${f}${u}${h}`;
const f = o > 0 ? `${o}h` : "", m = r > 0 ? `${r}m` : "", h = e > 0 ? `${e}s` : "";
return `${f}${m}${h}`;
}
const i = String(o).padStart(2, "0"), c = String(r).padStart(2, "0"), a = String(e).padStart(2, "0");
return `${i}:${c}:${a}`;
};
}
export {
g as formatDb,
$ as formatEnergy,
b as formatMoney,
S as formatPower,
p as formatSiBaseTenUnit,
m as formatSiUnit,
u as formatSiUnit,
F as formatTime
};
16 changes: 8 additions & 8 deletions dist/common/math.d.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
/**
* Limits a number to the range between 'min' and 'max'.
*/
export declare function clamp(value: any, min: any, max: any): any;
export declare function clamp(value: number, min: number, max: number): number;
/**
* Limits a number between 0 and 1.
*/
export declare function clamp01(value: any): any;
export declare function clamp01(value: number): number;
/**
* Scales a number to fit into the range between min and max.
*/
export declare function scale(value: any, min: any, max: any): number;
export declare function scale(value: number, min?: number, max?: number): number;
/**
* Robust number rounding, similar to PHP's round() function.
*
* @url https://stackoverflow.com/questions/53450248/how-to-round-in-javascript-like-php-do/54721202#54721202
*/
export declare function round(num: any, dec: any): number;
export declare function round(num: number, dec: number): number;
/**
* Returns a string representing a number in fixed point notation.
*/
export declare function toFixed(value: any, fractionDigits?: number): string;
export declare function toFixed(value: number, fractionDigits?: number): string;
/**
* Checks whether a value is within the provided range.
*
* Range is an array of two numbers, for example: [0, 15].
*/
export declare function inRange(value: any, range: any): any;
export declare function inRange(value: number, range: number[]): boolean;
/**
* Walks over the object with ranges, comparing value against every range,
* and returns the key of the first matching range.
*
* Range is an array of two numbers, for example: [0, 15].
*/
export declare function keyOfMatchingRange(value: any, ranges: any): string | undefined;
export declare function keyOfMatchingRange(value: number, ranges: Record<string, any>): string | undefined;
/**
* Get number of digits following the decimal point in a number
*/
export declare function numberOfDecimalDigits(value: any): any;
export declare function numberOfDecimalDigits(value: number): number;
2 changes: 1 addition & 1 deletion dist/common/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function e(t, n, r) {
function c(t) {
return t < 0 ? 0 : t > 1 ? 1 : t;
}
function f(t, n, r) {
function f(t, n = 0, r = 100) {
return (t - n) / (r - n);
}
function u(t, n) {
Expand Down
24 changes: 0 additions & 24 deletions dist/common/perf.d.ts

This file was deleted.

33 changes: 0 additions & 33 deletions dist/common/perf.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/common/random.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export declare function randomInteger(lowerBound: number, upperBound: number): n
/**
* Returns random array element
*/
export declare const randomPick: <T>(array: T[]) => T;
export declare function randomPick<T>(array: T[]): T;
/**
* Return 1 with probability P percent; otherwise 0
*/
Expand Down
18 changes: 10 additions & 8 deletions dist/common/random.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { clamp as n } from "./math.js";
function o(t, r) {
return Math.random() * (r - t) + t;
import { clamp as r } from "./math.js";
function o(t, n) {
return Math.random() * (n - t) + t;
}
function m(t, r) {
return t = Math.ceil(t), r = Math.floor(r), Math.floor(Math.random() * (r - t) + t);
function m(t, n) {
return t = Math.ceil(t), n = Math.floor(n), Math.floor(Math.random() * (n - t) + t);
}
function h(t) {
return t[Math.floor(Math.random() * t.length)];
}
const h = (t) => t[Math.floor(Math.random() * t.length)];
function c(t) {
const r = n(t, 0, 100) / 100;
return Math.random() <= r;
const n = r(t, 0, 100) / 100;
return Math.random() <= n;
}
export {
m as randomInteger,
Expand Down
2 changes: 1 addition & 1 deletion dist/common/react.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export declare function normalizeChildren<T>(children: T | T[]): T[];
* Shallowly checks if two objects are different.
* Credit: https://github.com/developit/preact-compat
*/
export declare function shallowDiffers(a: object, b: object): boolean;
export declare function shallowDiffers(a: Record<string, any>, b: Record<string, any>): boolean;
/**
* A common case in tgui, when you pass a value conditionally, these are
* the types that can fall through the condition.
Expand Down
64 changes: 0 additions & 64 deletions dist/common/redux.d.ts

This file was deleted.

Loading

0 comments on commit 1426f0f

Please sign in to comment.