zeed 0.7.147 → 0.7.151
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/dist/{chunk-WG7HOP7M.js → chunk-BPJRSPRG.js} +8 -9
- package/dist/{chunk-WG7HOP7M.js.map → chunk-BPJRSPRG.js.map} +1 -1
- package/dist/{chunk-7W3LTMPP.js → chunk-CLY4VF5A.js} +28 -18
- package/dist/chunk-CLY4VF5A.js.map +1 -0
- package/dist/{chunk-XWMV2GEI.js → chunk-LMZGFDSJ.js} +3 -5
- package/dist/{chunk-XWMV2GEI.js.map → chunk-LMZGFDSJ.js.map} +1 -1
- package/dist/{chunk-2KDHZAAM.js → chunk-T5YP6WMZ.js} +5 -6
- package/dist/{chunk-2KDHZAAM.js.map → chunk-T5YP6WMZ.js.map} +1 -1
- package/dist/{chunk-Z7MQRVMT.js → chunk-XX52WKOZ.js} +45 -46
- package/dist/chunk-XX52WKOZ.js.map +1 -0
- package/dist/index.all.cjs +100 -93
- package/dist/index.all.cjs.map +1 -1
- package/dist/index.all.d.ts +3 -3
- package/dist/index.all.js +11 -7
- package/dist/index.browser.cjs +63 -68
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.ts +2 -2
- package/dist/index.browser.js +4 -4
- package/dist/index.log.cjs +5 -8
- package/dist/index.log.cjs.map +1 -1
- package/dist/index.log.js +2 -2
- package/dist/index.node.cjs +93 -84
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +2 -2
- package/dist/index.node.js +9 -5
- package/dist/{log-colors-7dcdbd62.d.ts → log-colors-5aa66e3b.d.ts} +1 -1
- package/dist/{log-util-5f7dcfd6.d.ts → log-util-3742711f.d.ts} +4 -2
- package/dist/{uuid-19af3724.d.ts → uuid-ab0c5451.d.ts} +11 -5
- package/package.json +8 -7
- package/dist/chunk-7W3LTMPP.js.map +0 -1
- package/dist/chunk-Z7MQRVMT.js.map +0 -1
package/dist/index.all.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { d1 as ArgumentsType, c4 as AsyncMutex, P as BinInput, cC as Channel, cB as ChannelMessageEvent, cQ as CryptoEncoder, al as Currency, aj as CurrencyInput, am as DAY_MS, aJ as Day, ao as DayInput, aI as DayInputLegacy, an as DayValue, aP as DecimalInput, aO as DecimalValue, cI as DefaultListener, bW as Disposable, bV as Disposer, bU as DisposerFunction, cJ as Emitter, cG as EmitterAllHandler, cF as EmitterHandler, cN as Encoder, dq as Json, cP as JsonEncoder, cH as ListenerSignature, cD as LocalChannel, cw as LoggerConsoleHandler, cA as LoggerMemoryHandler, dl as MemStorage, dk as MemStorageOptions, cT as Message, cR as MessageAction, cX as MessageDefinitions, cY as MessageHub, cS as MessageResult, cV as MessagesDefaultMethods, cW as MessagesMethods, cU as MessagesOptions, c3 as Mutex, ds as NestedArray, cO as NoopEncoder, dr as ObjectStorage, cd as Pool, c9 as PoolTask, cb as PoolTaskEvents, c7 as PoolTaskFn, ca as PoolTaskIdConflictResolution, c8 as PoolTaskState, aY as Primitive, c$ as PubSub, d4 as RPCFn, d3 as RPCOptions, d5 as RPCReturn, af as RenderMessagesOptions, d2 as ReturnType, bo as RoundingMode, cr as SerialQueue, bz as SortableItem, cq as TaskEvents, cp as TaskFn, $ as Uint8ArrayToJson, U as Uint8ArrayToString, b$ as UseDefer, bY as UseDispose, bT as XRX, Q as _decodeUtf8Polyfill, _ as _encodeUtf8Polyfill, B as arrayAvg, C as arrayBatches, p as arrayEmptyInPlace, n as arrayFilterInPlace, i as arrayFlatten, j as arrayIntersection, t as arrayIsEqual, y as arrayMax, z as arrayMin, g as arrayMinus, x as arrayRandomElement, l as arrayRemoveElement, m as arraySetElement, v as arrayShuffle, w as arrayShuffleForce, u as arrayShuffleInPlace, q as arraySorted, s as arraySortedNumbers, A as arraySum, k as arraySymmetricDifference, o as arrayToggleInPlace, h as arrayUnion, f as arrayUnique, bf as avg, bd as between, bO as cloneJsonObject, bN as cloneObject, bk as cmp, bj as composeOrderby, D as createArray, ce as createPromise, cZ as createPromiseProxy, c as csv, ak as currency, aN as dateStringToDays, aM as day, ar as dayDay, aH as dayDiff, av as dayFromAny, ax as dayFromDate, ay as dayFromDateGMT, aC as dayFromParts, aD as dayFromString, aA as dayFromTimestamp, au as dayFromToday, aq as dayMonth, aE as dayMonthStart, aG as dayOffset, at as dayToDate, aw as dayToDateGMT, as as dayToParts, aB as dayToString, az as dayToTimestamp, ap as dayYear, aF as dayYearStart, ct as debounce, aQ as decimal, aT as decimalCentsPart, aR as decimalFromCents, aS as decimalToCents, G as decodeBase16, I as decodeBase32, K as decodeBase58, M as decodeBase62, O as decodeBase64, b as decrypt, aU as deepEqual, aV as deepMerge, a as deriveKeyPbkdf2, dg as detect, d as digest, bM as empty, F as encodeBase16, H as encodeBase32, J as encodeBase58, L as encodeBase62, N as encodeBase64, bG as encodeQuery, e as encrypt, bB as endSortWeight, bI as ensureKey, bJ as ensureKeyAsync, Y as equalBinary, aW as escapeHTML, bn as escapeRegExp, cE as fakeWorkerPair, d8 as fetchBasic, d9 as fetchJson, da as fetchOptionsFormURLEncoded, db as fetchOptionsJson, dc as fetchText, ai as fixBrokenUth8String, aK as forEachDay, bQ as forTimes, ag as formatMessages, dn as formatMilliseconds, X as fromBase64, a3 as fromCamelCase, df as getGlobal, cu as getGlobalContext, cK as getGlobalEmitter, cx as getNamespaceFilterString, de as getNavigator, b8 as getSecureRandom, b9 as getSecureRandomIfPossible, dm as getTimestamp, dd as getWindow, d7 as httpMethod, cg as immediate, a$ as isArray, b5 as isBoolean, dh as isBrowser, bq as isEven, bp as isHalf, b3 as isInteger, cv as isLocalHost, b6 as isNullOrUndefined, b2 as isNumber, aZ as isObject, bh as isPrime, bg as isPrimeRX, a_ as isPrimitive, cn as isPromise, b0 as isRecord, b4 as isSafeInteger, b1 as isString, ck as isTimeout, b7 as jsonStringify, Z as jsonToUint8Array, bL as last, cM as lazyListener, bE as linkifyPlainText, bP as memoize, cL as messages, bC as moveSortWeight, dp as parseDate, bi as parseOrderby, bH as parseQuery, di as platform, co as promisify, dC as qid, ba as randomBoolean, bc as randomFloat, bb as randomInt, r as randomUint8Array, bS as regExpEscape, bR as regExpString, ah as renderMessages, bs as roundDown, bv as roundHalfAwayFromZero, bw as roundHalfDown, bx as roundHalfEven, bu as roundHalfOdd, by as roundHalfTowardsZero, bt as roundHalfUp, br as roundUp, bK as size, cf as sleep, bD as sortedItems, bl as sortedOrderby, bA as startSortWeight, a4 as stringToBoolean, a6 as stringToFloat, a5 as stringToInteger, R as stringToUInt8Array, dF as suid, dE as suidBytes, dH as suidBytesDate, dG as suidDate, be as sum, cs as throttle, ci as timeout, ch as timeoutReached, cj as timoutError, V as toBase64, W as toBase64Url, ae as toBool, a0 as toCamelCase, a1 as toCapitalize, a2 as toCapitalizeWords, ab as toFloat, T as toHex, bF as toHumanReadableUrl, ac as toInt, ad as toString, S as toUint8Array, bm as toValidFilename, aL as today, cl as tryTimeout, dB as uname, aX as unescapeHTML, c6 as useAsyncMutex, E as useBase, b_ as useDefer, bX as useDispose, bZ as useDisposer, c2 as useEventListener, dj as useExitHandler, c1 as useInterval, cz as useLevelFilter, c_ as useMessageHub, c5 as useMutex, cy as useNamespaceFilter, cc as usePool, d0 as usePubSub, d6 as useRPC, c0 as useTimeout, dv as uuid, dA as uuid32Decode, dz as uuid32Encode, du as uuid32bit, dy as uuidB32, dt as uuidBytes, dx as uuidDecode, dw as uuidEncode, dD as uuidv4, a7 as valueToBoolean, a9 as valueToFloat, a8 as valueToInteger, aa as valueToString, cm as waitOn } from './uuid-
|
|
1
|
+
export { d1 as ArgumentsType, c4 as AsyncMutex, P as BinInput, cC as Channel, cB as ChannelMessageEvent, cQ as CryptoEncoder, al as Currency, aj as CurrencyInput, am as DAY_MS, aJ as Day, ao as DayInput, aI as DayInputLegacy, an as DayValue, aP as DecimalInput, aO as DecimalValue, cI as DefaultListener, bW as Disposable, bV as Disposer, bU as DisposerFunction, cJ as Emitter, cG as EmitterAllHandler, cF as EmitterHandler, cN as Encoder, dq as Json, cP as JsonEncoder, cH as ListenerSignature, cD as LocalChannel, cw as LoggerConsoleHandler, cA as LoggerMemoryHandler, dl as MemStorage, dk as MemStorageOptions, cT as Message, cR as MessageAction, cX as MessageDefinitions, cY as MessageHub, cS as MessageResult, cV as MessagesDefaultMethods, cW as MessagesMethods, cU as MessagesOptions, c3 as Mutex, ds as NestedArray, cO as NoopEncoder, dr as ObjectStorage, cd as Pool, c9 as PoolTask, cb as PoolTaskEvents, c7 as PoolTaskFn, ca as PoolTaskIdConflictResolution, c8 as PoolTaskState, aY as Primitive, c$ as PubSub, d4 as RPCFn, d3 as RPCOptions, d5 as RPCReturn, af as RenderMessagesOptions, d2 as ReturnType, bo as RoundingMode, cr as SerialQueue, bz as SortableItem, cq as TaskEvents, cp as TaskFn, $ as Uint8ArrayToJson, U as Uint8ArrayToString, b$ as UseDefer, bY as UseDispose, bT as XRX, Q as _decodeUtf8Polyfill, _ as _encodeUtf8Polyfill, B as arrayAvg, C as arrayBatches, p as arrayEmptyInPlace, n as arrayFilterInPlace, i as arrayFlatten, j as arrayIntersection, t as arrayIsEqual, y as arrayMax, z as arrayMin, g as arrayMinus, x as arrayRandomElement, l as arrayRemoveElement, m as arraySetElement, v as arrayShuffle, w as arrayShuffleForce, u as arrayShuffleInPlace, q as arraySorted, s as arraySortedNumbers, A as arraySum, k as arraySymmetricDifference, o as arrayToggleInPlace, h as arrayUnion, f as arrayUnique, bf as avg, bd as between, bO as cloneJsonObject, bN as cloneObject, bk as cmp, bj as composeOrderby, D as createArray, ce as createPromise, cZ as createPromiseProxy, c as csv, ak as currency, aN as dateStringToDays, aM as day, ar as dayDay, aH as dayDiff, av as dayFromAny, ax as dayFromDate, ay as dayFromDateGMT, aC as dayFromParts, aD as dayFromString, aA as dayFromTimestamp, au as dayFromToday, aq as dayMonth, aE as dayMonthStart, aG as dayOffset, at as dayToDate, aw as dayToDateGMT, as as dayToParts, aB as dayToString, az as dayToTimestamp, ap as dayYear, aF as dayYearStart, ct as debounce, aQ as decimal, aT as decimalCentsPart, aR as decimalFromCents, aS as decimalToCents, G as decodeBase16, I as decodeBase32, K as decodeBase58, M as decodeBase62, O as decodeBase64, b as decrypt, aU as deepEqual, aV as deepMerge, a as deriveKeyPbkdf2, dg as detect, d as digest, bM as empty, F as encodeBase16, H as encodeBase32, J as encodeBase58, L as encodeBase62, N as encodeBase64, bG as encodeQuery, e as encrypt, bB as endSortWeight, bI as ensureKey, bJ as ensureKeyAsync, Y as equalBinary, aW as escapeHTML, bn as escapeRegExp, cE as fakeWorkerPair, d8 as fetchBasic, d9 as fetchJson, da as fetchOptionsFormURLEncoded, db as fetchOptionsJson, dc as fetchText, ai as fixBrokenUth8String, aK as forEachDay, bQ as forTimes, ag as formatMessages, dn as formatMilliseconds, X as fromBase64, a3 as fromCamelCase, df as getGlobal, cu as getGlobalContext, cK as getGlobalEmitter, cx as getNamespaceFilterString, de as getNavigator, b8 as getSecureRandom, b9 as getSecureRandomIfPossible, dm as getTimestamp, dd as getWindow, d7 as httpMethod, cg as immediate, a$ as isArray, b5 as isBoolean, dh as isBrowser, bq as isEven, bp as isHalf, b3 as isInteger, cv as isLocalHost, b6 as isNullOrUndefined, b2 as isNumber, aZ as isObject, bh as isPrime, bg as isPrimeRX, a_ as isPrimitive, cn as isPromise, b0 as isRecord, b4 as isSafeInteger, b1 as isString, ck as isTimeout, b7 as jsonStringify, Z as jsonToUint8Array, bL as last, cM as lazyListener, bE as linkifyPlainText, bP as memoize, cL as messages, bC as moveSortWeight, dp as parseDate, bi as parseOrderby, bH as parseQuery, di as platform, co as promisify, dC as qid, ba as randomBoolean, bc as randomFloat, bb as randomInt, r as randomUint8Array, bS as regExpEscape, bR as regExpString, ah as renderMessages, bs as roundDown, bv as roundHalfAwayFromZero, bw as roundHalfDown, bx as roundHalfEven, bu as roundHalfOdd, by as roundHalfTowardsZero, bt as roundHalfUp, br as roundUp, bK as size, cf as sleep, bD as sortedItems, bl as sortedOrderby, bA as startSortWeight, a4 as stringToBoolean, a6 as stringToFloat, a5 as stringToInteger, R as stringToUInt8Array, dF as suid, dE as suidBytes, dH as suidBytesDate, dG as suidDate, be as sum, cs as throttle, ci as timeout, ch as timeoutReached, cj as timoutError, V as toBase64, W as toBase64Url, ae as toBool, a0 as toCamelCase, a1 as toCapitalize, a2 as toCapitalizeWords, ab as toFloat, T as toHex, bF as toHumanReadableUrl, ac as toInt, ad as toString, S as toUint8Array, bm as toValidFilename, aL as today, cl as tryTimeout, dB as uname, aX as unescapeHTML, c6 as useAsyncMutex, E as useBase, b_ as useDefer, bX as useDispose, bZ as useDisposer, c2 as useEventListener, dj as useExitHandler, c1 as useInterval, cz as useLevelFilter, c_ as useMessageHub, c5 as useMutex, cy as useNamespaceFilter, cc as usePool, d0 as usePubSub, d6 as useRPC, c0 as useTimeout, dv as uuid, dA as uuid32Decode, dz as uuid32Encode, du as uuid32bit, dy as uuidB32, dt as uuidBytes, dx as uuidDecode, dw as uuidEncode, dD as uuidv4, a7 as valueToBoolean, a9 as valueToFloat, a8 as valueToInteger, aa as valueToString, cm as waitOn } from './uuid-ab0c5451.js';
|
|
2
2
|
export { d as LogHandler, g as LogHandlerOptions, a as LogLevel, b as LogLevelAlias, c as LogMessage, L as Logger, h as LoggerContext, f as LoggerContextInterface, e as LoggerInterface } from './log-b80164f3.js';
|
|
3
|
-
export { b as FileStorage, F as FileStorageOptions, L as LoggerFileHandler,
|
|
4
|
-
export { a as LocalStorage, L as LocalStorageOptions, b as LoggerBrowserClassicHandler, g as gravatarURLByEmail, c as selectColor, s as supportsColors, u as urlBase64ToUint8Array } from './log-colors-
|
|
3
|
+
export { b as FileStorage, F as FileStorageOptions, L as LoggerFileHandler, h as LoggerNodeHandler, f as colorString, g as colorStringList, c as ensureFolder, e as exists, k as getSourceLocation, n as getSourceLocationByPrecedingPattern, m as getStack, j as getStackLlocationList, i as isTTY, l as loggerStackTraceDebug, p as pbcopy, d as readText, r as removeFolder, a as setupEnv, s as stringToPath, t as toPath, v as valueToPath, w as writeText } from './log-util-3742711f.js';
|
|
4
|
+
export { a as LocalStorage, L as LocalStorageOptions, b as LoggerBrowserClassicHandler, g as gravatarURLByEmail, c as selectColor, s as supportsColors, u as urlBase64ToUint8Array } from './log-colors-5aa66e3b.js';
|
|
5
5
|
export { L as LoggerBrowserHandler, a as LoggerBrowserSetupDebugFactory, b as activateConsoleDebug } from './log-browser-d263ebe0.js';
|
package/dist/index.all.js
CHANGED
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
LoggerBrowserClassicHandler,
|
|
4
4
|
gravatarURLByEmail,
|
|
5
5
|
urlBase64ToUint8Array
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BPJRSPRG.js";
|
|
7
7
|
import {
|
|
8
8
|
LoggerBrowserHandler,
|
|
9
9
|
LoggerBrowserSetupDebugFactory,
|
|
10
10
|
activateConsoleDebug,
|
|
11
11
|
selectColor,
|
|
12
12
|
supportsColors
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-T5YP6WMZ.js";
|
|
14
14
|
import {
|
|
15
15
|
FileStorage,
|
|
16
16
|
LoggerFileHandler,
|
|
@@ -26,12 +26,14 @@ import {
|
|
|
26
26
|
isTTY,
|
|
27
27
|
loggerStackTraceDebug,
|
|
28
28
|
pbcopy,
|
|
29
|
+
readText,
|
|
29
30
|
removeFolder,
|
|
30
31
|
setupEnv,
|
|
31
32
|
stringToPath,
|
|
32
33
|
toPath,
|
|
33
|
-
valueToPath
|
|
34
|
-
|
|
34
|
+
valueToPath,
|
|
35
|
+
writeText
|
|
36
|
+
} from "./chunk-CLY4VF5A.js";
|
|
35
37
|
import {
|
|
36
38
|
Channel,
|
|
37
39
|
CryptoEncoder,
|
|
@@ -254,7 +256,7 @@ import {
|
|
|
254
256
|
valueToInteger,
|
|
255
257
|
valueToString,
|
|
256
258
|
waitOn
|
|
257
|
-
} from "./chunk-
|
|
259
|
+
} from "./chunk-XX52WKOZ.js";
|
|
258
260
|
import {
|
|
259
261
|
LogLevel,
|
|
260
262
|
LogLevelAlias,
|
|
@@ -280,7 +282,7 @@ import {
|
|
|
280
282
|
parseDate,
|
|
281
283
|
useLevelFilter,
|
|
282
284
|
useNamespaceFilter
|
|
283
|
-
} from "./chunk-
|
|
285
|
+
} from "./chunk-LMZGFDSJ.js";
|
|
284
286
|
export {
|
|
285
287
|
Channel,
|
|
286
288
|
CryptoEncoder,
|
|
@@ -471,6 +473,7 @@ export {
|
|
|
471
473
|
randomFloat,
|
|
472
474
|
randomInt,
|
|
473
475
|
randomUint8Array,
|
|
476
|
+
readText,
|
|
474
477
|
regExpEscape,
|
|
475
478
|
regExpString,
|
|
476
479
|
removeFolder,
|
|
@@ -554,6 +557,7 @@ export {
|
|
|
554
557
|
valueToInteger,
|
|
555
558
|
valueToPath,
|
|
556
559
|
valueToString,
|
|
557
|
-
waitOn
|
|
560
|
+
waitOn,
|
|
561
|
+
writeText
|
|
558
562
|
};
|
|
559
563
|
//# sourceMappingURL=index.all.js.map
|
package/dist/index.browser.cjs
CHANGED
|
@@ -412,8 +412,7 @@ function getNamespaceFilterString(defaultNamespaceFilter2) {
|
|
|
412
412
|
return defaultNamespaceFilter2;
|
|
413
413
|
}
|
|
414
414
|
__name(getNamespaceFilterString, "getNamespaceFilterString");
|
|
415
|
-
var
|
|
416
|
-
var defaultNamespaceFilter = getNamespaceFilterString(typeof process !== "undefined" ? (_a = process.env.ZEED) != null ? _a : process.env.DEBUG : typeof localStorage !== "undefined" ? (_b = localStorage.zeed) != null ? _b : localStorage.debug : "*");
|
|
415
|
+
var defaultNamespaceFilter = getNamespaceFilterString(typeof process !== "undefined" ? process.env.ZEED ?? process.env.DEBUG : typeof localStorage !== "undefined" ? localStorage.zeed ?? localStorage.debug : "*");
|
|
417
416
|
function useNamespaceFilter(filter = defaultNamespaceFilter) {
|
|
418
417
|
let fn;
|
|
419
418
|
let reject = [];
|
|
@@ -465,8 +464,7 @@ function useNamespaceFilter(filter = defaultNamespaceFilter) {
|
|
|
465
464
|
return fn;
|
|
466
465
|
}
|
|
467
466
|
__name(useNamespaceFilter, "useNamespaceFilter");
|
|
468
|
-
var
|
|
469
|
-
var defaultLevelFilter = typeof process !== "undefined" ? (_b2 = (_a2 = process.env.ZEED_LEVEL) != null ? _a2 : process.env.LEVEL) != null ? _b2 : process.env.DEBUG_LEVEL : typeof localStorage !== "undefined" ? (_d = (_c = localStorage.zeed_level) != null ? _c : localStorage.level) != null ? _d : localStorage.debug_level : void 0;
|
|
467
|
+
var defaultLevelFilter = typeof process !== "undefined" ? process.env.ZEED_LEVEL ?? process.env.LEVEL ?? process.env.DEBUG_LEVEL : typeof localStorage !== "undefined" ? localStorage.zeed_level ?? localStorage.level ?? localStorage.debug_level : void 0;
|
|
470
468
|
function useLevelFilter(filter = defaultLevelFilter) {
|
|
471
469
|
let filterLevel = -1 /* all */;
|
|
472
470
|
if (typeof filter === "string") {
|
|
@@ -882,13 +880,12 @@ async function digest(message, algorithm = DEFAULT_HASH_ALG) {
|
|
|
882
880
|
}
|
|
883
881
|
__name(digest, "digest");
|
|
884
882
|
async function deriveKeyPbkdf2(secret, opt = {}) {
|
|
885
|
-
var _a3;
|
|
886
883
|
const secretBuffer = toUint8Array(secret);
|
|
887
884
|
const keyMaterial = await crypto.subtle.importKey("raw", secretBuffer, DEFAULT_DERIVE_ALG, false, ["deriveKey"]);
|
|
888
885
|
return await crypto.subtle.deriveKey({
|
|
889
886
|
name: DEFAULT_DERIVE_ALG,
|
|
890
887
|
salt: opt.salt ? toUint8Array(opt.salt) : new Uint8Array(0),
|
|
891
|
-
iterations:
|
|
888
|
+
iterations: opt.iterations ?? 1e5,
|
|
892
889
|
hash: DEFAULT_HASH_ALG
|
|
893
890
|
}, keyMaterial, {
|
|
894
891
|
name: DEFAULT_CRYPTO_ALG,
|
|
@@ -1377,17 +1374,15 @@ function stringToBoolean(value, defaultValue = false) {
|
|
|
1377
1374
|
}
|
|
1378
1375
|
__name(stringToBoolean, "stringToBoolean");
|
|
1379
1376
|
function stringToInteger(value, defaultValue = 0) {
|
|
1380
|
-
var _a3;
|
|
1381
1377
|
if (value == null || typeof value !== "string")
|
|
1382
1378
|
return defaultValue;
|
|
1383
|
-
return
|
|
1379
|
+
return parseInt(value.trim(), 10) ?? defaultValue;
|
|
1384
1380
|
}
|
|
1385
1381
|
__name(stringToInteger, "stringToInteger");
|
|
1386
1382
|
function stringToFloat(value, defaultValue = 0) {
|
|
1387
|
-
var _a3;
|
|
1388
1383
|
if (value == null || typeof value !== "string")
|
|
1389
1384
|
return defaultValue;
|
|
1390
|
-
return
|
|
1385
|
+
return parseFloat(value.trim()) ?? defaultValue;
|
|
1391
1386
|
}
|
|
1392
1387
|
__name(stringToFloat, "stringToFloat");
|
|
1393
1388
|
function valueToBoolean(value, defaultValue = false) {
|
|
@@ -1401,32 +1396,29 @@ function valueToBoolean(value, defaultValue = false) {
|
|
|
1401
1396
|
}
|
|
1402
1397
|
__name(valueToBoolean, "valueToBoolean");
|
|
1403
1398
|
function valueToInteger(value, defaultValue = 0) {
|
|
1404
|
-
var _a3;
|
|
1405
1399
|
if (value == null)
|
|
1406
1400
|
return defaultValue;
|
|
1407
1401
|
if (typeof value === "boolean")
|
|
1408
1402
|
return value ? 1 : 0;
|
|
1409
1403
|
if (typeof value === "number")
|
|
1410
1404
|
return Math.floor(value);
|
|
1411
|
-
return
|
|
1405
|
+
return parseInt(String(value).trim(), 10) ?? defaultValue;
|
|
1412
1406
|
}
|
|
1413
1407
|
__name(valueToInteger, "valueToInteger");
|
|
1414
1408
|
function valueToFloat(value, defaultValue = 0) {
|
|
1415
|
-
var _a3;
|
|
1416
1409
|
if (value == null)
|
|
1417
1410
|
return defaultValue;
|
|
1418
1411
|
if (typeof value === "boolean")
|
|
1419
1412
|
return value ? 1 : 0;
|
|
1420
1413
|
if (typeof value === "number")
|
|
1421
1414
|
return Math.floor(value);
|
|
1422
|
-
return
|
|
1415
|
+
return parseFloat(String(value).trim()) ?? defaultValue;
|
|
1423
1416
|
}
|
|
1424
1417
|
__name(valueToFloat, "valueToFloat");
|
|
1425
1418
|
function valueToString(value, defaultValue = "") {
|
|
1426
|
-
var _a3;
|
|
1427
1419
|
if (value == null)
|
|
1428
1420
|
return defaultValue;
|
|
1429
|
-
return
|
|
1421
|
+
return String(value) ?? defaultValue;
|
|
1430
1422
|
}
|
|
1431
1423
|
__name(valueToString, "valueToString");
|
|
1432
1424
|
var toFloat = valueToFloat;
|
|
@@ -1486,9 +1478,8 @@ function currency(value, opts = {}) {
|
|
|
1486
1478
|
__name(currency, "currency");
|
|
1487
1479
|
var _Currency = class {
|
|
1488
1480
|
constructor(value, opts = {}) {
|
|
1489
|
-
var _a3;
|
|
1490
1481
|
let settings = Object.assign({}, defaults, opts);
|
|
1491
|
-
let precision = pow(
|
|
1482
|
+
let precision = pow(settings.precision ?? 2);
|
|
1492
1483
|
let v = parse(value, settings);
|
|
1493
1484
|
this.intValue = v;
|
|
1494
1485
|
this.value = v / precision;
|
|
@@ -1811,13 +1802,13 @@ var Day = class {
|
|
|
1811
1802
|
return this.days;
|
|
1812
1803
|
}
|
|
1813
1804
|
constructor(days) {
|
|
1814
|
-
var
|
|
1805
|
+
var _a;
|
|
1815
1806
|
if (typeof days === "number") {
|
|
1816
1807
|
this.days = days;
|
|
1817
1808
|
return;
|
|
1818
1809
|
}
|
|
1819
1810
|
if (days != null) {
|
|
1820
|
-
days = (
|
|
1811
|
+
days = (_a = Day.from(days)) == null ? void 0 : _a.days;
|
|
1821
1812
|
}
|
|
1822
1813
|
if (days == null) {
|
|
1823
1814
|
const date = new Date();
|
|
@@ -1899,8 +1890,8 @@ var Day = class {
|
|
|
1899
1890
|
return Day.from([this.year + yy, mm, this.day]);
|
|
1900
1891
|
}
|
|
1901
1892
|
daysUntil(otherDay) {
|
|
1902
|
-
var
|
|
1903
|
-
return Math.round((((
|
|
1893
|
+
var _a;
|
|
1894
|
+
return Math.round((((_a = new Day(otherDay)) == null ? void 0 : _a.toDateGMT().getTime()) - this.toDateGMT().getTime()) / DAY_MS);
|
|
1904
1895
|
}
|
|
1905
1896
|
yesterday() {
|
|
1906
1897
|
return this.dayOffset(-1);
|
|
@@ -2217,7 +2208,7 @@ var XRX = class {
|
|
|
2217
2208
|
constructor(pattern2, flags) {
|
|
2218
2209
|
this.namedGroups = {};
|
|
2219
2210
|
this.names = [];
|
|
2220
|
-
let _flags = flags
|
|
2211
|
+
let _flags = flags ?? "";
|
|
2221
2212
|
let _rx;
|
|
2222
2213
|
if (pattern2 instanceof RegExp) {
|
|
2223
2214
|
if (flags == null) {
|
|
@@ -2330,7 +2321,7 @@ async function callDisposer(disposable) {
|
|
|
2330
2321
|
}
|
|
2331
2322
|
__name(callDisposer, "callDisposer");
|
|
2332
2323
|
function useDispose(config) {
|
|
2333
|
-
const { name } = typeof config === "string" ? { name: config } : config
|
|
2324
|
+
const { name } = typeof config === "string" ? { name: config } : config ?? {};
|
|
2334
2325
|
let tracked = [];
|
|
2335
2326
|
const untrack = /* @__PURE__ */ __name(async (disposable) => {
|
|
2336
2327
|
if (disposable != null && tracked.includes(disposable)) {
|
|
@@ -2492,12 +2483,17 @@ var Emitter = class {
|
|
|
2492
2483
|
constructor() {
|
|
2493
2484
|
this.subscribers = {};
|
|
2494
2485
|
this.subscribersOnAny = [];
|
|
2486
|
+
this.dispose = useDispose("emitter");
|
|
2495
2487
|
this.call = new Proxy({}, {
|
|
2496
2488
|
get: (target, name) => (...args) => this.emit(name, ...args)
|
|
2497
2489
|
});
|
|
2498
2490
|
}
|
|
2499
2491
|
async emit(event, ...args) {
|
|
2500
2492
|
let ok = false;
|
|
2493
|
+
this.dispose.add(() => {
|
|
2494
|
+
this.subscribers = {};
|
|
2495
|
+
this.subscribersOnAny = [];
|
|
2496
|
+
});
|
|
2501
2497
|
try {
|
|
2502
2498
|
let subscribers = this.subscribers[event] || [];
|
|
2503
2499
|
this.subscribersOnAny.forEach((fn) => fn(event, ...args));
|
|
@@ -2551,10 +2547,6 @@ var Emitter = class {
|
|
|
2551
2547
|
this.subscribers = {};
|
|
2552
2548
|
return this;
|
|
2553
2549
|
}
|
|
2554
|
-
dispose() {
|
|
2555
|
-
this.subscribers = {};
|
|
2556
|
-
this.subscribersOnAny = [];
|
|
2557
|
-
}
|
|
2558
2550
|
};
|
|
2559
2551
|
__name(Emitter, "Emitter");
|
|
2560
2552
|
function getGlobalEmitter() {
|
|
@@ -2846,12 +2838,11 @@ function usePool(config = {}) {
|
|
|
2846
2838
|
}
|
|
2847
2839
|
__name(cancelAll, "cancelAll");
|
|
2848
2840
|
function enqueue(task, config2 = {}) {
|
|
2849
|
-
var _a3, _b3, _c2, _d2;
|
|
2850
2841
|
let done;
|
|
2851
2842
|
let promise = new Promise((resolve) => done = resolve);
|
|
2852
|
-
let id =
|
|
2843
|
+
let id = config2.id ?? uuid();
|
|
2853
2844
|
if (tasks[id] != null) {
|
|
2854
|
-
const resolution =
|
|
2845
|
+
const resolution = config2.idConflictResolution ?? 1 /* memoize */;
|
|
2855
2846
|
if (resolution === 0 /* replace */) {
|
|
2856
2847
|
cancel(id);
|
|
2857
2848
|
} else if (resolution === 1 /* memoize */) {
|
|
@@ -2875,8 +2866,8 @@ function usePool(config = {}) {
|
|
|
2875
2866
|
task,
|
|
2876
2867
|
priority: ++priority,
|
|
2877
2868
|
state: 0 /* waiting */,
|
|
2878
|
-
max:
|
|
2879
|
-
resolved:
|
|
2869
|
+
max: config2.max ?? 1,
|
|
2870
|
+
resolved: config2.resolved ?? 0,
|
|
2880
2871
|
done,
|
|
2881
2872
|
payload: config2.payload,
|
|
2882
2873
|
setMax(max) {
|
|
@@ -2926,7 +2917,7 @@ var SerialQueue = class extends Emitter {
|
|
|
2926
2917
|
const { name = uname("queue"), logLevel } = opt;
|
|
2927
2918
|
this.name = name;
|
|
2928
2919
|
this.log = Logger(`zeed:queue:${name}`);
|
|
2929
|
-
this.log.level = logLevel
|
|
2920
|
+
this.log.level = logLevel ?? Infinity /* off */;
|
|
2930
2921
|
}
|
|
2931
2922
|
async performNext() {
|
|
2932
2923
|
this.log(`performNext, queue.length =`, this.queue.length);
|
|
@@ -3124,7 +3115,7 @@ function debounce(callback, opt = {}) {
|
|
|
3124
3115
|
__name(debounce, "debounce");
|
|
3125
3116
|
|
|
3126
3117
|
// src/common/localhost.ts
|
|
3127
|
-
function isLocalHost(hostname = ((
|
|
3118
|
+
function isLocalHost(hostname = ((_a) => (_a = globalThis == null ? void 0 : globalThis.location) == null ? void 0 : _a.hostname)() ?? "") {
|
|
3128
3119
|
return ["localhost", "127.0.0.1", "", "::1", "::"].includes(hostname) || hostname.startsWith("192.168.") || hostname.startsWith("10.0.") || hostname.endsWith(".local");
|
|
3129
3120
|
}
|
|
3130
3121
|
__name(isLocalHost, "isLocalHost");
|
|
@@ -3160,8 +3151,8 @@ var LocalChannel = class extends Channel {
|
|
|
3160
3151
|
this.isConnected = true;
|
|
3161
3152
|
}
|
|
3162
3153
|
postMessage(data) {
|
|
3163
|
-
var
|
|
3164
|
-
(
|
|
3154
|
+
var _a;
|
|
3155
|
+
(_a = this.other) == null ? void 0 : _a.emit("message", {
|
|
3165
3156
|
data,
|
|
3166
3157
|
origin: "local",
|
|
3167
3158
|
lastEventId: uuid()
|
|
@@ -3355,7 +3346,6 @@ __name(useMessageHub, "useMessageHub");
|
|
|
3355
3346
|
// src/common/msg/pubsub.ts
|
|
3356
3347
|
var PubSub = class extends Emitter {
|
|
3357
3348
|
constructor(opt) {
|
|
3358
|
-
var _a3;
|
|
3359
3349
|
super();
|
|
3360
3350
|
this.publish = this.emit;
|
|
3361
3351
|
this.subscribe = this.on;
|
|
@@ -3363,7 +3353,7 @@ var PubSub = class extends Emitter {
|
|
|
3363
3353
|
this.channel = channel;
|
|
3364
3354
|
this.encoder = encoder;
|
|
3365
3355
|
this.debug = debug;
|
|
3366
|
-
this.name =
|
|
3356
|
+
this.name = name ?? this.channel.id ?? uname("pubsub");
|
|
3367
3357
|
this.log = Logger(`${this.shortId}`);
|
|
3368
3358
|
if (this.debug) {
|
|
3369
3359
|
this.channel.on("connect", () => {
|
|
@@ -3394,9 +3384,9 @@ var PubSub = class extends Emitter {
|
|
|
3394
3384
|
async emit(event, ...args) {
|
|
3395
3385
|
try {
|
|
3396
3386
|
if (this.debug)
|
|
3397
|
-
this.log(`emit(${event})`, event);
|
|
3387
|
+
this.log(`emit(${String(event)})`, event);
|
|
3398
3388
|
else
|
|
3399
|
-
this.log(`emit(${event})`, args.length);
|
|
3389
|
+
this.log(`emit(${String(event)})`, args.length);
|
|
3400
3390
|
if (!this.channel.isConnected) {
|
|
3401
3391
|
this.log.warn("channel not connected");
|
|
3402
3392
|
return false;
|
|
@@ -3405,7 +3395,7 @@ var PubSub = class extends Emitter {
|
|
|
3405
3395
|
this.channel.postMessage(data);
|
|
3406
3396
|
return true;
|
|
3407
3397
|
} catch (err) {
|
|
3408
|
-
this.log.warn(`emit(${event})`, err);
|
|
3398
|
+
this.log.warn(`emit(${String(event)})`, err);
|
|
3409
3399
|
}
|
|
3410
3400
|
return false;
|
|
3411
3401
|
}
|
|
@@ -3418,13 +3408,15 @@ __name(usePubSub, "usePubSub");
|
|
|
3418
3408
|
|
|
3419
3409
|
// src/common/msg/rpc.ts
|
|
3420
3410
|
var rpcCounter = 1;
|
|
3411
|
+
var defaultSerialize = /* @__PURE__ */ __name((i) => i, "defaultSerialize");
|
|
3412
|
+
var defaultDeserialize = defaultSerialize;
|
|
3421
3413
|
function useRPC(functions, options) {
|
|
3422
3414
|
const {
|
|
3423
3415
|
post,
|
|
3424
3416
|
on,
|
|
3425
3417
|
eventNames = [],
|
|
3426
|
-
serialize =
|
|
3427
|
-
deserialize =
|
|
3418
|
+
serialize = defaultSerialize,
|
|
3419
|
+
deserialize = defaultDeserialize
|
|
3428
3420
|
} = options;
|
|
3429
3421
|
const rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
3430
3422
|
on(async (data) => {
|
|
@@ -3432,10 +3424,14 @@ function useRPC(functions, options) {
|
|
|
3432
3424
|
const [mode, args, id, method] = msg;
|
|
3433
3425
|
if (mode === 1 /* request */ || mode === 2 /* event */) {
|
|
3434
3426
|
let result, error2;
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3427
|
+
if (method != null) {
|
|
3428
|
+
try {
|
|
3429
|
+
result = await functions[method](...args);
|
|
3430
|
+
} catch (e) {
|
|
3431
|
+
error2 = String(e);
|
|
3432
|
+
}
|
|
3433
|
+
} else {
|
|
3434
|
+
error2 = "Method implementation missing";
|
|
3439
3435
|
}
|
|
3440
3436
|
if (mode === 1 /* request */ && id) {
|
|
3441
3437
|
if (error2) {
|
|
@@ -3446,10 +3442,12 @@ function useRPC(functions, options) {
|
|
|
3446
3442
|
}
|
|
3447
3443
|
} else if (id) {
|
|
3448
3444
|
const promise = rpcPromiseMap.get(id);
|
|
3449
|
-
if (
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3445
|
+
if (promise != null) {
|
|
3446
|
+
if (mode === 4 /* reject */)
|
|
3447
|
+
promise.reject(args);
|
|
3448
|
+
else
|
|
3449
|
+
promise.resolve(args);
|
|
3450
|
+
}
|
|
3453
3451
|
rpcPromiseMap.delete(id);
|
|
3454
3452
|
}
|
|
3455
3453
|
});
|
|
@@ -3565,8 +3563,7 @@ function getNavigator() {
|
|
|
3565
3563
|
}
|
|
3566
3564
|
__name(getNavigator, "getNavigator");
|
|
3567
3565
|
function getGlobal() {
|
|
3568
|
-
|
|
3569
|
-
return ((_a3 = getWindow()) != null ? _a3 : typeof WorkerGlobalScope !== "undefined") ? self : typeof global !== "undefined" ? global : Function("return this;")();
|
|
3566
|
+
return getWindow() ?? typeof WorkerGlobalScope !== "undefined" ? self : typeof global !== "undefined" ? global : Function("return this;")();
|
|
3570
3567
|
}
|
|
3571
3568
|
__name(getGlobal, "getGlobal");
|
|
3572
3569
|
var _navigator = getNavigator();
|
|
@@ -3590,12 +3587,12 @@ function detect(info = {
|
|
|
3590
3587
|
appleNative: false,
|
|
3591
3588
|
touch: false
|
|
3592
3589
|
}) {
|
|
3593
|
-
var
|
|
3594
|
-
info.ios = ((
|
|
3595
|
-
info.macos = !!((
|
|
3596
|
-
info.windows = !!((
|
|
3590
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3591
|
+
info.ios = ((_a = _navigator == null ? void 0 : _navigator.platform) == null ? void 0 : _a.match(/(iPhone|iPod|iPad)/i)) != null;
|
|
3592
|
+
info.macos = !!((_b = _navigator == null ? void 0 : _navigator.platform) == null ? void 0 : _b.startsWith("Mac"));
|
|
3593
|
+
info.windows = !!((_c = _navigator == null ? void 0 : _navigator.platform) == null ? void 0 : _c.startsWith("Win"));
|
|
3597
3594
|
info.beaker = (_window == null ? void 0 : _window["beaker"]) != null;
|
|
3598
|
-
info.electron = (((_e = (
|
|
3595
|
+
info.electron = (((_e = (_d = _navigator == null ? void 0 : _navigator.userAgent) == null ? void 0 : _d.toLowerCase()) == null ? void 0 : _e.indexOf(" electron/")) || -1) > -1 && !info.beaker;
|
|
3599
3596
|
info.wkwebview = ((_f = _window == null ? void 0 : _window.webkit) == null ? void 0 : _f["messageHandlers"]) != null;
|
|
3600
3597
|
info.pwa = (_navigator == null ? void 0 : _navigator.serviceWorker) != null;
|
|
3601
3598
|
info.pwaInstalled = (_navigator == null ? void 0 : _navigator.standalone) || ((_h = (_g = _window == null ? void 0 : _window.matchMedia) == null ? void 0 : _g.call(_window, "(display-mode: standalone)")) == null ? void 0 : _h.matches);
|
|
@@ -3852,20 +3849,19 @@ var log11 = Logger("zeed:localstorage");
|
|
|
3852
3849
|
var LocalStorage = class {
|
|
3853
3850
|
constructor(opt) {
|
|
3854
3851
|
this.pretty = false;
|
|
3855
|
-
var _a3, _b3;
|
|
3856
3852
|
log11.assert(opt.name, "name required");
|
|
3857
3853
|
this.name = opt.name;
|
|
3858
3854
|
this.prefix = `${opt.name}$`;
|
|
3859
|
-
this.objectToString =
|
|
3855
|
+
this.objectToString = opt.objectToString ?? ((data) => {
|
|
3860
3856
|
return this.pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);
|
|
3861
|
-
};
|
|
3862
|
-
this.objectFromString =
|
|
3857
|
+
});
|
|
3858
|
+
this.objectFromString = opt.objectFromString ?? ((data) => {
|
|
3863
3859
|
try {
|
|
3864
3860
|
return JSON.parse(data);
|
|
3865
3861
|
} catch (err) {
|
|
3866
3862
|
log11.warn(`LocalStorage parse error '${err}' in`, data);
|
|
3867
3863
|
}
|
|
3868
|
-
};
|
|
3864
|
+
});
|
|
3869
3865
|
}
|
|
3870
3866
|
setItem(key, value) {
|
|
3871
3867
|
const data = this.objectToString(value);
|
|
@@ -4010,7 +4006,7 @@ function LoggerBrowserHandler(opt = {}) {
|
|
|
4010
4006
|
const matchesNamespace = useNamespaceFilter(filter);
|
|
4011
4007
|
const matchesLevel = useLevelFilter(level);
|
|
4012
4008
|
return (msg) => {
|
|
4013
|
-
var
|
|
4009
|
+
var _a;
|
|
4014
4010
|
if (!matchesLevel(msg.level))
|
|
4015
4011
|
return;
|
|
4016
4012
|
if (!matchesNamespace(msg.name))
|
|
@@ -4033,7 +4029,7 @@ function LoggerBrowserHandler(opt = {}) {
|
|
|
4033
4029
|
args = [`%c${name}%c %s %c+${diff}`];
|
|
4034
4030
|
args.push(`color:${ninfo.color}; ${styleBold}`);
|
|
4035
4031
|
args.push(styleDefault);
|
|
4036
|
-
args.push((
|
|
4032
|
+
args.push(((_a = msg.messages) == null ? void 0 : _a[0]) ?? "");
|
|
4037
4033
|
args.push(`color:${ninfo.color};`);
|
|
4038
4034
|
args.push(...msg.messages.slice(1));
|
|
4039
4035
|
} else {
|
|
@@ -4065,8 +4061,7 @@ function LoggerBrowserHandler(opt = {}) {
|
|
|
4065
4061
|
}
|
|
4066
4062
|
__name(LoggerBrowserHandler, "LoggerBrowserHandler");
|
|
4067
4063
|
function LoggerBrowserSetupDebugFactory(opt = {}) {
|
|
4068
|
-
|
|
4069
|
-
const filter = (_b3 = (_a3 = opt.filter) != null ? _a3 : localStorage.zeed) != null ? _b3 : localStorage.debug;
|
|
4064
|
+
const filter = opt.filter ?? localStorage.zeed ?? localStorage.debug;
|
|
4070
4065
|
return /* @__PURE__ */ __name(function LoggerBrowserDebugFactory(name = "") {
|
|
4071
4066
|
let log12;
|
|
4072
4067
|
const matches = useNamespaceFilter(filter);
|