Initalize

This commit is contained in:
Your Name
2026-05-03 12:12:57 -04:00
commit 38652eb9b5
10603 changed files with 1762136 additions and 0 deletions

35
node_modules/timeago.js/lib/utils/date.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
/**
* Created by hustcc on 18/5/20.
* Contract: i@hust.cc
*/
import { LocaleFunc, TDate } from '../interface';
/**
* format Date / string / timestamp to timestamp
* @param input
* @returns {*}
*/
export declare function toDate(input?: Date | string | number): Date;
/**
* format the diff second to *** time ago, with setting locale
* @param diff
* @param localeFunc
* @returns
*/
export declare function formatDiff(diff: number, localeFunc: LocaleFunc): string;
/**
* calculate the diff second between date to be formatted an now date.
* @param date
* @param relativeDate
* @returns {number}
*/
export declare function diffSec(date: TDate, relativeDate: TDate): number;
/**
* nextInterval: calculate the next interval time.
* - diff: the diff sec between now and date to be formatted.
*
* What's the meaning?
* diff = 61 then return 59
* diff = 3601 (an hour + 1 second), then return 3599
* make the interval with high performance.
**/
export declare function nextInterval(diff: number): number;

120
node_modules/timeago.js/lib/utils/date.js generated vendored Normal file
View File

@@ -0,0 +1,120 @@
"use strict";
/**
* Created by hustcc on 18/5/20.
* Contract: i@hust.cc
*/
Object.defineProperty(exports, "__esModule", { value: true });
var SEC_ARRAY = [
60,
60,
24,
7,
365 / 7 / 12,
12,
];
/**
* format Date / string / timestamp to timestamp
* @param input
* @returns {*}
*/
function toDate(input) {
if (input instanceof Date)
return input;
// @ts-ignore
if (!isNaN(input) || /^\d+$/.test(input))
return new Date(parseInt(input));
input = (input || '')
// @ts-ignore
.trim()
.replace(/\.\d+/, '') // remove milliseconds
.replace(/-/, '/')
.replace(/-/, '/')
.replace(/(\d)T(\d)/, '$1 $2')
.replace(/Z/, ' UTC') // 2017-2-5T3:57:52Z -> 2017-2-5 3:57:52UTC
.replace(/([+-]\d\d):?(\d\d)/, ' $1$2'); // -04:00 -> -0400
return new Date(input);
}
exports.toDate = toDate;
/**
* format the diff second to *** time ago, with setting locale
* @param diff
* @param localeFunc
* @returns
*/
function formatDiff(diff, localeFunc) {
/**
* if locale is not exist, use defaultLocale.
* if defaultLocale is not exist, use build-in `en`.
* be sure of no error when locale is not exist.
*
* If `time in`, then 1
* If `time ago`, then 0
*/
var agoIn = diff < 0 ? 1 : 0;
/**
* Get absolute value of number (|diff| is non-negative) value of x
* |diff| = diff if diff is positive
* |diff| = -diff if diff is negative
* |0| = 0
*/
diff = Math.abs(diff);
/**
* Time in seconds
*/
var totalSec = diff;
/**
* Unit of time
*/
var idx = 0;
for (; diff >= SEC_ARRAY[idx] && idx < SEC_ARRAY.length; idx++) {
diff /= SEC_ARRAY[idx];
}
/**
* Math.floor() is alternative of ~~
*
* The differences and bugs:
* Math.floor(3.7) -> 4 but ~~3.7 -> 3
* Math.floor(1559125440000.6) -> 1559125440000 but ~~1559125440000.6 -> 52311552
*
* More information about the performance of algebraic:
* https://www.youtube.com/watch?v=65-RbBwZQdU
*/
diff = Math.floor(diff);
idx *= 2;
if (diff > (idx === 0 ? 9 : 1))
idx += 1;
return localeFunc(diff, idx, totalSec)[agoIn].replace('%s', diff.toString());
}
exports.formatDiff = formatDiff;
/**
* calculate the diff second between date to be formatted an now date.
* @param date
* @param relativeDate
* @returns {number}
*/
function diffSec(date, relativeDate) {
var relDate = relativeDate ? toDate(relativeDate) : new Date();
return (+relDate - +toDate(date)) / 1000;
}
exports.diffSec = diffSec;
/**
* nextInterval: calculate the next interval time.
* - diff: the diff sec between now and date to be formatted.
*
* What's the meaning?
* diff = 61 then return 59
* diff = 3601 (an hour + 1 second), then return 3599
* make the interval with high performance.
**/
function nextInterval(diff) {
var rst = 1, i = 0, d = Math.abs(diff);
for (; diff >= SEC_ARRAY[i] && i < SEC_ARRAY.length; i++) {
diff /= SEC_ARRAY[i];
rst *= SEC_ARRAY[i];
}
d = d % rst;
d = d ? rst - d : rst;
return Math.ceil(d);
}
exports.nextInterval = nextInterval;
//# sourceMappingURL=date.js.map

1
node_modules/timeago.js/lib/utils/date.js.map generated vendored Normal file
View File

@@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CAAC,CAAC,CAAC;QACrB,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;KACrB;IACD,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IACZ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACtB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAXD,oCAWC"}

18
node_modules/timeago.js/lib/utils/dom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/**
* get the datetime attribute, `datetime` are supported.
* @param node
* @returns {*}
*/
export declare function getDateAttribute(node: HTMLElement): string;
/**
* set the node attribute, native DOM
* @param node
* @param timerId
* @returns {*}
*/
export declare function setTimerId(node: HTMLElement, timerId: number): void;
/**
* get the timer id
* @param node
*/
export declare function getTimerId(node: HTMLElement): number;

32
node_modules/timeago.js/lib/utils/dom.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ATTR_TIMEAGO_TID = 'timeago-id';
/**
* get the datetime attribute, `datetime` are supported.
* @param node
* @returns {*}
*/
function getDateAttribute(node) {
return node.getAttribute('datetime');
}
exports.getDateAttribute = getDateAttribute;
/**
* set the node attribute, native DOM
* @param node
* @param timerId
* @returns {*}
*/
function setTimerId(node, timerId) {
// @ts-ignore
node.setAttribute(ATTR_TIMEAGO_TID, timerId);
}
exports.setTimerId = setTimerId;
/**
* get the timer id
* @param node
*/
function getTimerId(node) {
return parseInt(node.getAttribute(ATTR_TIMEAGO_TID));
}
exports.getTimerId = getTimerId;
//# sourceMappingURL=dom.js.map

1
node_modules/timeago.js/lib/utils/dom.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":";;AAAA,IAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAiB;IAChD,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC;AAFD,4CAEC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,IAAiB,EAAE,OAAe;IAC3D,aAAa;IACb,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAHD,gCAGC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,IAAiB;IAC1C,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACvD,CAAC;AAFD,gCAEC"}