@unicom-cloud/utils 0.1.16 → 0.1.18
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/class-name/index.js +5 -5
- package/constant/index.js +24 -2
- package/constant/platform.js +13 -12
- package/constant.js +24 -2
- package/content-disposition/index.js +3 -3
- package/date/convertTime.js +4 -4
- package/diff/index.js +7 -0
- package/diff/src/diff.d.ts +21 -0
- package/diff/src/diff.js +381 -0
- package/diff.js +7 -0
- package/filesize/types/constants.d.ts +81 -0
- package/filesize/types/filesize.d.ts +97 -0
- package/index.js +68 -58
- package/js-cookie/index.d.ts +116 -0
- package/js-cookie/index.js +4 -0
- package/js-cookie/src/api.js +56 -0
- package/js-cookie/src/assign.js +11 -0
- package/js-cookie/src/converter.js +14 -0
- package/jsCookie.js +4 -0
- package/lunar/lib/HolidayUtil.js +48 -49
- package/mitt/index.js +4 -0
- package/mitt/src/index.js +37 -0
- package/mitt.js +4 -0
- package/nzh/nzh.d.ts +74 -0
- package/package.json +1 -1
- package/pinyin/index.js +4 -0
- package/pinyin/simplified.js +4 -0
- package/pinyin/src/core.js +143 -0
- package/pinyin/src/simplified.js +8 -0
- package/pinyin/src/simplified_dict.js +410 -0
- package/pinyin/src/traditional.js +8 -0
- package/pinyin/src/traditional_dict.js +403 -0
- package/pinyin/traditional.js +4 -0
- package/pinyin.js +4 -0
- package/query-string/base.d.ts +717 -0
- package/query-string/base.js +268 -0
- package/query-string/index.d.ts +16 -0
- package/query-string/index.js +4 -0
- package/query-string/splitOnFirst.js +14 -0
- package/queryString.js +4 -0
- package/random/index.js +56 -35
- package/snapdom/src/api/preCache.js +51 -28
- package/snapdom/src/core/cache.js +1 -4
- package/snapdom/src/core/capture.js +45 -44
- package/snapdom/src/core/clone.js +82 -66
- package/snapdom/src/core/prepare.js +167 -45
- package/snapdom/src/modules/background.js +29 -19
- package/snapdom/src/modules/fonts.js +158 -111
- package/snapdom/src/modules/images.js +14 -9
- package/snapdom/src/modules/pseudo.js +52 -47
- package/snapdom/src/modules/styles.js +22 -22
- package/snapdom/src/modules/svgDefs.js +39 -20
- package/snapdom/src/utils/cssTools.js +58 -51
- package/snapdom/src/utils/helpers.js +197 -140
- package/snapdom/types/snapdom.d.ts +101 -0
- package/types/constant/index.d.ts +11 -0
- package/types/constant/platform.d.ts +1 -0
- package/types/diff/index.d.ts +2 -0
- package/types/diff/src/diff.d.ts +40 -0
- package/types/index.d.ts +6 -1
- package/types/js-cookie/index.d.ts +1 -0
- package/types/js-cookie/src/api.d.mts +2 -0
- package/types/js-cookie/src/assign.d.mts +1 -0
- package/types/js-cookie/src/converter.d.mts +5 -0
- package/types/mitt/index.d.ts +2 -0
- package/types/mitt/src/index.d.ts +29 -0
- package/types/pinyin/index.d.ts +1 -0
- package/types/pinyin/simplified.d.ts +1 -0
- package/types/pinyin/src/core.d.ts +3 -0
- package/types/pinyin/src/simplified.d.ts +4 -0
- package/types/pinyin/src/simplified_dict.d.ts +408 -0
- package/types/pinyin/src/traditional.d.ts +4 -0
- package/types/pinyin/src/traditional_dict.d.ts +401 -0
- package/types/pinyin/traditional.d.ts +1 -0
- package/types/query-string/base.d.ts +11 -0
- package/types/query-string/index.d.ts +2 -0
- package/types/query-string/splitOnFirst.d.ts +1 -0
- package/types/random/index.d.ts +14 -23
- package/types/snapdom/src/api/preCache.d.ts +2 -5
- package/types/snapdom/src/core/cache.d.ts +0 -3
- package/types/snapdom/src/core/clone.d.ts +1 -1
- package/types/snapdom/src/modules/background.d.ts +16 -6
- package/types/snapdom/src/modules/fonts.d.ts +5 -1
- package/types/snapdom/src/modules/pseudo.d.ts +1 -1
- package/types/snapdom/src/modules/styles.d.ts +1 -1
- package/types/snapdom/src/modules/svgDefs.d.ts +13 -13
- package/types/snapdom/src/utils/cssTools.d.ts +2 -10
- package/types/snapdom/src/utils/helpers.d.ts +13 -7
- package/types/turbo-stream/src/shared.d.ts +3 -3
- package/url-toolkit/src/url-toolkit.d.ts +22 -0
- package/event-emitter/index.js +0 -48
- package/eventEmitter.js +0 -4
- package/types/event-emitter/index.d.ts +0 -17
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options interface for configuring filesize behavior
|
|
3
|
+
*/
|
|
4
|
+
export interface FilesizeOptions {
|
|
5
|
+
/** If true, calculates bits instead of bytes */
|
|
6
|
+
bits?: boolean;
|
|
7
|
+
/** If true, pads decimal places to match round parameter */
|
|
8
|
+
pad?: boolean;
|
|
9
|
+
/** Number base (2 for binary, 10 for decimal, -1 for auto) */
|
|
10
|
+
base?: number;
|
|
11
|
+
/** Number of decimal places to round to */
|
|
12
|
+
round?: number;
|
|
13
|
+
/** Locale for number formatting, true for system locale */
|
|
14
|
+
locale?: string | boolean;
|
|
15
|
+
/** Additional options for locale formatting */
|
|
16
|
+
localeOptions?: Intl.NumberFormatOptions;
|
|
17
|
+
/** Custom decimal separator */
|
|
18
|
+
separator?: string;
|
|
19
|
+
/** String to separate value and unit */
|
|
20
|
+
spacer?: string;
|
|
21
|
+
/** Custom unit symbols */
|
|
22
|
+
symbols?: Record<string, string>;
|
|
23
|
+
/** Unit standard to use (SI, IEC, JEDEC) */
|
|
24
|
+
standard?: 'si' | 'iec' | 'jedec' | '';
|
|
25
|
+
/** Output format: "string", "array", "object", or "exponent" */
|
|
26
|
+
output?: 'string' | 'array' | 'object' | 'exponent';
|
|
27
|
+
/** If true, uses full unit names instead of abbreviations */
|
|
28
|
+
fullform?: boolean;
|
|
29
|
+
/** Custom full unit names */
|
|
30
|
+
fullforms?: string[];
|
|
31
|
+
/** Force specific exponent (-1 for auto) */
|
|
32
|
+
exponent?: number;
|
|
33
|
+
/** Math rounding method to use */
|
|
34
|
+
roundingMethod?: 'round' | 'floor' | 'ceil';
|
|
35
|
+
/** Number of significant digits (0 for auto) */
|
|
36
|
+
precision?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Object format return type when output is "object"
|
|
41
|
+
*/
|
|
42
|
+
export interface FilesizeObject {
|
|
43
|
+
/** The numeric value */
|
|
44
|
+
value: number | string;
|
|
45
|
+
/** The unit symbol */
|
|
46
|
+
symbol: string;
|
|
47
|
+
/** The exponent used in calculation */
|
|
48
|
+
exponent: number;
|
|
49
|
+
/** The original unit before symbol customization */
|
|
50
|
+
unit: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Array format return type when output is "array"
|
|
55
|
+
*/
|
|
56
|
+
export type FilesizeArray = [number | string, string];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Return type based on output option
|
|
60
|
+
*/
|
|
61
|
+
export type FilesizeReturn<T extends FilesizeOptions = {}> =
|
|
62
|
+
T['output'] extends 'object'
|
|
63
|
+
? FilesizeObject
|
|
64
|
+
: T['output'] extends 'array'
|
|
65
|
+
? FilesizeArray
|
|
66
|
+
: T['output'] extends 'exponent'
|
|
67
|
+
? number
|
|
68
|
+
: string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Converts a file size in bytes to a human-readable string with appropriate units
|
|
72
|
+
* @param arg - The file size in bytes to convert
|
|
73
|
+
* @param options - Configuration options for formatting
|
|
74
|
+
* @returns Formatted file size based on output option
|
|
75
|
+
* @throws {TypeError} When arg is not a valid number or roundingMethod is invalid
|
|
76
|
+
* @example
|
|
77
|
+
* filesize(1024) // "1 KB"
|
|
78
|
+
* filesize(1024, {bits: true}) // "8 Kb"
|
|
79
|
+
* filesize(1024, {output: "object"}) // {value: 1, symbol: "KB", exponent: 1, unit: "KB"}
|
|
80
|
+
*/
|
|
81
|
+
export function filesize<T extends FilesizeOptions = {}>(
|
|
82
|
+
arg: number | string | bigint,
|
|
83
|
+
options?: T,
|
|
84
|
+
): FilesizeReturn<T>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Creates a partially applied version of filesize with preset options
|
|
88
|
+
* @param options - Default options to apply to the returned function
|
|
89
|
+
* @returns A function that takes a file size and returns formatted output
|
|
90
|
+
* @example
|
|
91
|
+
* const formatBytes = partial({round: 1, standard: "iec"});
|
|
92
|
+
* formatBytes(1024) // "1.0 KiB"
|
|
93
|
+
* formatBytes(2048) // "2.0 KiB"
|
|
94
|
+
*/
|
|
95
|
+
export function partial<T extends FilesizeOptions = {}>(
|
|
96
|
+
options?: T,
|
|
97
|
+
): (arg: number | string | bigint) => FilesizeReturn<T>;
|
package/index.js
CHANGED
|
@@ -1,62 +1,72 @@
|
|
|
1
|
-
import * as o from "./
|
|
2
|
-
import * as e from "./
|
|
3
|
-
import * as r from "./
|
|
4
|
-
import * as t from "./
|
|
5
|
-
import * as a from "./
|
|
6
|
-
import * as s from "./
|
|
7
|
-
import * as i from "./
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { default as
|
|
11
|
-
import { default as
|
|
12
|
-
import {
|
|
13
|
-
import { default as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import { default as
|
|
22
|
-
import { default as
|
|
23
|
-
import
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
26
|
-
import { default as
|
|
27
|
-
import {
|
|
28
|
-
import
|
|
1
|
+
import * as o from "./constant/index.js";
|
|
2
|
+
import * as e from "./date/index.js";
|
|
3
|
+
import * as r from "./is/index.js";
|
|
4
|
+
import * as t from "./math/index.js";
|
|
5
|
+
import * as a from "./snapdom/index.js";
|
|
6
|
+
import * as s from "./tree/index.js";
|
|
7
|
+
import * as i from "./turbo-stream/index.js";
|
|
8
|
+
import * as m from "./ui-color/index.js";
|
|
9
|
+
import * as p from "./url-toolkit/index.js";
|
|
10
|
+
import { default as u } from "./case-name/index.js";
|
|
11
|
+
import { default as C } from "./class-name/index.js";
|
|
12
|
+
import { default as b } from "./clipboard-copy/index.js";
|
|
13
|
+
import { default as k, getContentDispositionFromHeader as y, getContentDispositionParametersFilenameFromHeader as T, getContentDispositionParametersFromHeader as g } from "./content-disposition/index.js";
|
|
14
|
+
import { splitCookiesString as D } from "./cookie/index.js";
|
|
15
|
+
import { default as S } from "./decimal/decimal.js";
|
|
16
|
+
import { default as j } from "./diff/src/diff.js";
|
|
17
|
+
import { fileToURL as L } from "./file/fileToURL.js";
|
|
18
|
+
import { saveAs as P } from "./file/saveAs.js";
|
|
19
|
+
import * as f from "./filesize/src/constants.js";
|
|
20
|
+
import { filesize as K, partial as R } from "./filesize/src/filesize.js";
|
|
21
|
+
import { default as W } from "./invariant/index.js";
|
|
22
|
+
import { default as q } from "./js-cookie/src/api.js";
|
|
23
|
+
import * as n from "./lunar/lib/index.js";
|
|
24
|
+
import { default as B } from "./md5/index.js";
|
|
25
|
+
import { default as G } from "./mitt/src/index.js";
|
|
26
|
+
import { default as J } from "./normalize-wheel/index.js";
|
|
27
|
+
import { default as O } from "./number-to-chinese/index.js";
|
|
28
|
+
import { default as V } from "./nzh/nzh.js";
|
|
29
|
+
import { default as Y } from "./object-keys-sort/index.js";
|
|
30
|
+
import { default as oo } from "./pinyin/src/simplified.js";
|
|
31
|
+
import { default as ro } from "./screenfull/index.js";
|
|
32
|
+
import { TinyColor as ao } from "./tinycolor/src/index.js";
|
|
33
|
+
import * as x from "./cookie/src/index.js";
|
|
29
34
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
S as
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
n as Lunar,
|
|
36
|
+
u as caseName,
|
|
37
|
+
C as className,
|
|
38
|
+
b as clipboardCopy,
|
|
39
|
+
o as constant,
|
|
40
|
+
k as contentDisposition,
|
|
41
|
+
x as cookie,
|
|
42
|
+
e as date,
|
|
43
|
+
S as decimal,
|
|
44
|
+
j as diff,
|
|
45
|
+
L as fileToURL,
|
|
46
|
+
K as filesize,
|
|
47
|
+
f as filesizeConstants,
|
|
48
|
+
y as getContentDispositionFromHeader,
|
|
43
49
|
T as getContentDispositionParametersFilenameFromHeader,
|
|
44
50
|
g as getContentDispositionParametersFromHeader,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
a as
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
W as invariant,
|
|
52
|
+
r as is,
|
|
53
|
+
q as jsCookie,
|
|
54
|
+
t as math,
|
|
55
|
+
B as md5,
|
|
56
|
+
G as mitt,
|
|
57
|
+
J as normalizeWheel,
|
|
58
|
+
O as numberToChinese,
|
|
59
|
+
V as nzh,
|
|
60
|
+
Y as objectKeysSort,
|
|
61
|
+
R as partial,
|
|
62
|
+
oo as pinyin,
|
|
63
|
+
P as saveAs,
|
|
64
|
+
ro as screenfull,
|
|
65
|
+
a as snapdom,
|
|
66
|
+
D as splitCookiesString,
|
|
67
|
+
ao as tinycolor,
|
|
68
|
+
s as tree,
|
|
69
|
+
i as turboStream,
|
|
70
|
+
m as uiColor,
|
|
71
|
+
p as urlToolkit
|
|
62
72
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
declare namespace Cookies {
|
|
2
|
+
interface CookieAttributes {
|
|
3
|
+
/**
|
|
4
|
+
* Define when the cookie will be removed. Value can be a Number
|
|
5
|
+
* which will be interpreted as days from time of creation or a
|
|
6
|
+
* Date instance. If omitted, the cookie becomes a session cookie.
|
|
7
|
+
*/
|
|
8
|
+
expires?: number | Date | undefined;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Define the path where the cookie is available. Defaults to '/'
|
|
12
|
+
*/
|
|
13
|
+
path?: string | undefined;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Define the domain where the cookie is available. Defaults to
|
|
17
|
+
* the domain of the page where the cookie was created.
|
|
18
|
+
*/
|
|
19
|
+
domain?: string | undefined;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A Boolean indicating if the cookie transmission requires a
|
|
23
|
+
* secure protocol (https). Defaults to false.
|
|
24
|
+
*/
|
|
25
|
+
secure?: boolean | undefined;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Asserts that a cookie must not be sent with cross-origin requests,
|
|
29
|
+
* providing some protection against cross-site request forgery
|
|
30
|
+
* attacks (CSRF)
|
|
31
|
+
*/
|
|
32
|
+
sameSite?:
|
|
33
|
+
| 'strict'
|
|
34
|
+
| 'Strict'
|
|
35
|
+
| 'lax'
|
|
36
|
+
| 'Lax'
|
|
37
|
+
| 'none'
|
|
38
|
+
| 'None'
|
|
39
|
+
| undefined;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An attribute which will be serialized, conformably to RFC 6265
|
|
43
|
+
* section 5.2.
|
|
44
|
+
*/
|
|
45
|
+
[property: string]: any;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface CookiesStatic<T = string> {
|
|
49
|
+
readonly attributes: CookieAttributes;
|
|
50
|
+
readonly converter: Required<Converter<string>>;
|
|
51
|
+
/**
|
|
52
|
+
* Create a cookie
|
|
53
|
+
*/
|
|
54
|
+
set(
|
|
55
|
+
name: string,
|
|
56
|
+
value: string | T,
|
|
57
|
+
options?: CookieAttributes,
|
|
58
|
+
): string | undefined;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Read cookie
|
|
62
|
+
*/
|
|
63
|
+
get(name: string): string | T | undefined;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Read all available cookies
|
|
67
|
+
*/
|
|
68
|
+
get(): { [key: string]: string };
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Delete cookie
|
|
72
|
+
*/
|
|
73
|
+
remove(name: string, options?: CookieAttributes): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Cookie attribute defaults can be set globally by creating an
|
|
77
|
+
* instance of the api via withAttributes(), or individually for
|
|
78
|
+
* each call to Cookies.set(...) by passing a plain object as the
|
|
79
|
+
* last argument. Per-call attributes override the default attributes.
|
|
80
|
+
*/
|
|
81
|
+
withAttributes(attributes: CookieAttributes): CookiesStatic<T>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Create a new instance of the api that overrides the default
|
|
85
|
+
* decoding implementation. All methods that rely in a proper
|
|
86
|
+
* decoding to work, such as Cookies.remove() and Cookies.get(),
|
|
87
|
+
* will run the converter first for each cookie. The returned
|
|
88
|
+
* string will be used as the cookie value.
|
|
89
|
+
*/
|
|
90
|
+
withConverter<TConv = string>(
|
|
91
|
+
converter: Converter<TConv>,
|
|
92
|
+
): CookiesStatic<TConv>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface Converter<TConv> {
|
|
96
|
+
write?: CookieWriteConverter<TConv> | undefined;
|
|
97
|
+
read?: CookieReadConverter<TConv> | undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
type CookieWriteConverter<T> = (value: string | T, name: string) => string;
|
|
101
|
+
type CookieReadConverter<T> = (value: string, name: string) => string | T;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare const Cookies: Cookies.CookiesStatic & {
|
|
105
|
+
/**
|
|
106
|
+
* If there is any danger of a conflict with the namespace Cookies,
|
|
107
|
+
* the noConflict method will allow you to define a new namespace
|
|
108
|
+
* and preserve the original one. This is especially useful when
|
|
109
|
+
* running the script on third party sites e.g. as part of a widget
|
|
110
|
+
* or SDK. Note: The noConflict method is not necessary when using
|
|
111
|
+
* AMD or CommonJS, thus it is not exposed in those environments.
|
|
112
|
+
*/
|
|
113
|
+
noConflict?(): Cookies.CookiesStatic;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default Cookies;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import t from "./assign.js";
|
|
2
|
+
import l from "./converter.js";
|
|
3
|
+
function p(f, s) {
|
|
4
|
+
function u(n, i, e) {
|
|
5
|
+
if (!(typeof document > "u")) {
|
|
6
|
+
e = t({}, s, e), typeof e.expires == "number" && (e.expires = new Date(Date.now() + e.expires * 864e5)), e.expires && (e.expires = e.expires.toUTCString()), n = encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
7
|
+
var r = "";
|
|
8
|
+
for (var o in e)
|
|
9
|
+
e[o] && (r += "; " + o, e[o] !== !0 && (r += "=" + e[o].split(";")[0]));
|
|
10
|
+
return document.cookie = n + "=" + f.write(i, n) + r;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function d(n) {
|
|
14
|
+
if (!(typeof document > "u" || arguments.length && !n)) {
|
|
15
|
+
for (var i = document.cookie ? document.cookie.split("; ") : [], e = {}, r = 0; r < i.length; r++) {
|
|
16
|
+
var o = i[r].split("="), v = o.slice(1).join("=");
|
|
17
|
+
try {
|
|
18
|
+
var c = decodeURIComponent(o[0]);
|
|
19
|
+
if (c in e || (e[c] = f.read(v, c)), n === c)
|
|
20
|
+
break;
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return n ? e[n] : e;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return Object.create(
|
|
28
|
+
{
|
|
29
|
+
set: u,
|
|
30
|
+
get: d,
|
|
31
|
+
remove: function(n, i) {
|
|
32
|
+
u(
|
|
33
|
+
n,
|
|
34
|
+
"",
|
|
35
|
+
t({}, i, {
|
|
36
|
+
expires: -1
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
withAttributes: function(n) {
|
|
41
|
+
return p(this.converter, t({}, this.attributes, n));
|
|
42
|
+
},
|
|
43
|
+
withConverter: function(n) {
|
|
44
|
+
return p(t({}, this.converter, n), this.attributes);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
attributes: { value: Object.freeze(s) },
|
|
49
|
+
converter: { value: Object.freeze(f) }
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const x = p(l, { path: "/" });
|
|
54
|
+
export {
|
|
55
|
+
x as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const n = {
|
|
2
|
+
read: function(e) {
|
|
3
|
+
return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
4
|
+
},
|
|
5
|
+
write: function(e) {
|
|
6
|
+
return encodeURIComponent(e).replace(
|
|
7
|
+
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
8
|
+
decodeURIComponent
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
n as default
|
|
14
|
+
};
|
package/jsCookie.js
ADDED
package/lunar/lib/HolidayUtil.js
CHANGED
|
@@ -35,85 +35,84 @@ class s {
|
|
|
35
35
|
return (n < 10 ? "0" : "") + n;
|
|
36
36
|
}
|
|
37
37
|
static _findForward(n) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
38
|
+
const e = s._DATA_IN_USE.indexOf(n);
|
|
39
|
+
if (e < 0)
|
|
40
40
|
return null;
|
|
41
|
-
let
|
|
42
|
-
const r =
|
|
43
|
-
for (r > 0 && (
|
|
44
|
-
|
|
45
|
-
return
|
|
41
|
+
let t = s._DATA_IN_USE.substring(e);
|
|
42
|
+
const r = t.length % s._SIZE;
|
|
43
|
+
for (r > 0 && (t = t.substring(r)); t.indexOf(n) !== 0 && t.length >= s._SIZE; )
|
|
44
|
+
t = t.substring(s._SIZE);
|
|
45
|
+
return t;
|
|
46
46
|
}
|
|
47
47
|
static _findBackward(n) {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
48
|
+
const e = s._DATA_IN_USE.lastIndexOf(n);
|
|
49
|
+
if (e < 0)
|
|
50
50
|
return null;
|
|
51
|
-
const
|
|
52
|
-
let r = s._DATA_IN_USE.substring(0,
|
|
51
|
+
const t = n.length;
|
|
52
|
+
let r = s._DATA_IN_USE.substring(0, e + t), c = r.length;
|
|
53
53
|
const g = c % s._SIZE;
|
|
54
|
-
for (g > 0 && (r = r.substring(0, c - g)), c = r.length; c -
|
|
54
|
+
for (g > 0 && (r = r.substring(0, c - g)), c = r.length; c - t !== r.lastIndexOf(n) && c >= s._SIZE; )
|
|
55
55
|
r = r.substring(0, c - s._SIZE), c = r.length;
|
|
56
56
|
return r;
|
|
57
57
|
}
|
|
58
58
|
static _buildHolidayForward(n) {
|
|
59
|
-
const
|
|
60
|
-
return new E(
|
|
59
|
+
const e = n.substring(0, 8), t = s._NAMES_IN_USE[n.charCodeAt(8) - s._ZERO], r = n.charCodeAt(9) === s._ZERO, c = n.substring(10, 18);
|
|
60
|
+
return new E(e, t, r, c);
|
|
61
61
|
}
|
|
62
62
|
static _buildHolidayBackward(n) {
|
|
63
|
-
const
|
|
64
|
-
return new E(
|
|
63
|
+
const e = n.length, t = n.substring(e - 18, e - 10), r = s._NAMES_IN_USE[n.charCodeAt(e - 10) - s._ZERO], c = n.charCodeAt(e - 9) === s._ZERO, g = n.substring(e - 8);
|
|
64
|
+
return new E(t, r, c, g);
|
|
65
65
|
}
|
|
66
66
|
static _findHolidaysForward(n) {
|
|
67
|
-
const
|
|
68
|
-
let
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
71
|
-
for (;
|
|
72
|
-
|
|
73
|
-
return
|
|
67
|
+
const e = [];
|
|
68
|
+
let t = s._findForward(n);
|
|
69
|
+
if (t == null)
|
|
70
|
+
return e;
|
|
71
|
+
for (; t.indexOf(n) === 0; )
|
|
72
|
+
e.push(s._buildHolidayForward(t)), t = t.substring(s._SIZE);
|
|
73
|
+
return e;
|
|
74
74
|
}
|
|
75
75
|
static _findHolidaysBackward(n) {
|
|
76
|
-
const
|
|
77
|
-
let
|
|
78
|
-
if (
|
|
79
|
-
return
|
|
80
|
-
let r =
|
|
76
|
+
const e = [];
|
|
77
|
+
let t = s._findBackward(n);
|
|
78
|
+
if (t == null)
|
|
79
|
+
return e;
|
|
80
|
+
let r = t.length;
|
|
81
81
|
const c = n.length;
|
|
82
|
-
for (; r - c ===
|
|
83
|
-
|
|
84
|
-
return
|
|
82
|
+
for (; r - c === t.lastIndexOf(n); )
|
|
83
|
+
e.push(s._buildHolidayBackward(t)), t = t.substring(0, r - s._SIZE), r = t.length;
|
|
84
|
+
return e.reverse(), e;
|
|
85
85
|
}
|
|
86
|
-
static getHoliday(n,
|
|
86
|
+
static getHoliday(n, e = 0, t = 0) {
|
|
87
87
|
let r;
|
|
88
|
-
return
|
|
89
|
-
n + s._padding(
|
|
88
|
+
return e == 0 || t == 0 ? r = s._findHolidaysForward((n + "").replace(/-/g, "")) : r = s._findHolidaysForward(
|
|
89
|
+
n + s._padding(e) + s._padding(t)
|
|
90
90
|
), r.length < 1 ? null : r[0];
|
|
91
91
|
}
|
|
92
|
-
static getHolidays(n,
|
|
93
|
-
return
|
|
92
|
+
static getHolidays(n, e = 0) {
|
|
93
|
+
return e == 0 ? s._findHolidaysForward(
|
|
94
94
|
(n + "").replace(/-/g, "")
|
|
95
95
|
) : s._findHolidaysForward(
|
|
96
|
-
n + s._padding(
|
|
96
|
+
n + s._padding(e)
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
|
-
static getHolidaysByTarget(n,
|
|
100
|
-
return
|
|
99
|
+
static getHolidaysByTarget(n, e = 0) {
|
|
100
|
+
return e == 0 ? s._findHolidaysBackward(
|
|
101
101
|
(n + "").replace(/-/g, "")
|
|
102
102
|
) : s._findHolidaysBackward(
|
|
103
|
-
n + s._padding(
|
|
103
|
+
n + s._padding(e)
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
static _fixNames(n) {
|
|
107
107
|
n && (s._NAMES_IN_USE = n);
|
|
108
108
|
}
|
|
109
109
|
static _fixData(n) {
|
|
110
|
-
if (!n)
|
|
111
|
-
|
|
112
|
-
const t = [];
|
|
110
|
+
if (!n) return;
|
|
111
|
+
const e = [];
|
|
113
112
|
for (; n.length >= s._SIZE; ) {
|
|
114
|
-
const
|
|
113
|
+
const t = n.substring(0, s._SIZE), r = t.substring(0, 8), c = s._TAG_REMOVE == t.substring(8, 9), g = s.getHoliday(r);
|
|
115
114
|
if (!g)
|
|
116
|
-
c ||
|
|
115
|
+
c || e.push(t);
|
|
117
116
|
else {
|
|
118
117
|
let u = -1;
|
|
119
118
|
for (let f = 0, a = s._NAMES_IN_USE.length; f < a; f++)
|
|
@@ -125,16 +124,16 @@ class s {
|
|
|
125
124
|
const f = r + String.fromCharCode(u + s._ZERO) + (g.isWork() ? "0" : "1") + g.getTarget().replace(/-/g, "");
|
|
126
125
|
s._DATA_IN_USE = s._DATA_IN_USE.replace(
|
|
127
126
|
new RegExp(f, "g"),
|
|
128
|
-
c ? "" :
|
|
127
|
+
c ? "" : t
|
|
129
128
|
);
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
n = n.substring(s._SIZE);
|
|
133
132
|
}
|
|
134
|
-
|
|
133
|
+
e.length > 0 && (s._DATA_IN_USE += e.join(""));
|
|
135
134
|
}
|
|
136
|
-
static fix(n,
|
|
137
|
-
|
|
135
|
+
static fix(n, e) {
|
|
136
|
+
e ? (s._fixNames(n), s._fixData(e)) : s._fixData(n);
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
export {
|
package/mitt/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function S(i = /* @__PURE__ */ new Map()) {
|
|
2
|
+
function d(e, o, t, n = !1, f = !1) {
|
|
3
|
+
const c = { handler: o, context: t, once: n }, s = i.get(e);
|
|
4
|
+
s ? s.add(c) : i.set(e, /* @__PURE__ */ new Set([c])), f && a(e);
|
|
5
|
+
}
|
|
6
|
+
function u(e, o, t) {
|
|
7
|
+
d(e, o, t, !0);
|
|
8
|
+
}
|
|
9
|
+
function l(e, o, t) {
|
|
10
|
+
const n = i.get(e);
|
|
11
|
+
n && (o ? new Set(n).forEach((f) => {
|
|
12
|
+
f.handler === o && (t === void 0 || f.context === t) && n.delete(f);
|
|
13
|
+
}) : t ? new Set(n).forEach((f) => {
|
|
14
|
+
f.context === t && n.delete(f);
|
|
15
|
+
}) : n.clear(), n.size || r(e));
|
|
16
|
+
}
|
|
17
|
+
function r(e) {
|
|
18
|
+
e ? i.delete(e) : i.clear();
|
|
19
|
+
}
|
|
20
|
+
function a(e, o, ...t) {
|
|
21
|
+
const n = i.get(e);
|
|
22
|
+
n && new Set(n).forEach((f) => {
|
|
23
|
+
const { handler: c, context: s, once: h } = f;
|
|
24
|
+
h && l(e, c, s), c.call(s, o, ...t);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
on: d,
|
|
29
|
+
once: u,
|
|
30
|
+
off: l,
|
|
31
|
+
offAll: r,
|
|
32
|
+
emit: a
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
S as default
|
|
37
|
+
};
|
package/mitt.js
ADDED