@unicom-cloud/utils 0.1.10 → 0.1.12
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/caseName.js +11 -0
- package/className.js +5 -0
- package/clipboardCopy.js +6 -0
- package/constant.js +4 -0
- package/contentDisposition.js +7 -0
- package/cookie.js +7 -0
- package/date/convertTime.js +61 -0
- package/date/index.js +22 -0
- package/date.js +9 -0
- package/decimal.js +5 -0
- package/eventEmitter.js +4 -0
- package/file.js +6 -0
- package/filesize.js +8 -0
- package/index.js +56 -46
- package/invariant.js +4 -0
- package/is.js +92 -0
- package/lunar/index.js +36 -0
- package/lunar/lib/Holiday.js +42 -0
- package/lunar/lib/HolidayUtil.js +128 -0
- package/lunar/lib/I18n.js +1005 -0
- package/lunar/lib/JieQi.js +40 -0
- package/lunar/lib/Lunar.js +1035 -0
- package/lunar/lib/LunarMonth.js +150 -0
- package/lunar/lib/LunarTime.js +138 -0
- package/lunar/lib/LunarUtil.js +1752 -0
- package/lunar/lib/LunarYear.js +616 -0
- package/lunar/lib/ShouXingUtil.js +6915 -0
- package/lunar/lib/Solar.js +311 -0
- package/lunar/lib/SolarHalfYear.js +45 -0
- package/lunar/lib/SolarMonth.js +55 -0
- package/lunar/lib/SolarSeason.js +42 -0
- package/lunar/lib/SolarUtil.js +256 -0
- package/lunar/lib/SolarWeek.js +153 -0
- package/lunar/lib/SolarYear.js +35 -0
- package/lunar/lib/index.js +35 -0
- package/lunar.js +36 -0
- package/math.js +9 -0
- package/md5.js +4 -0
- package/mock.js +8 -0
- package/normalizeWheel.js +6 -0
- package/number-to-chinese/index.js +72 -0
- package/numberToChinese.js +4 -0
- package/nzh.js +4 -0
- package/object-keys-sort/index.js +7 -0
- package/objectKeysSort.js +2 -5
- package/package.json +1 -1
- package/random.js +15 -0
- package/screenfull.js +4 -0
- package/snapdom/src/api/preCache.js +26 -36
- package/snapdom/src/api/snapdom.js +78 -61
- package/snapdom/src/core/capture.js +54 -54
- package/snapdom/src/core/prepare.js +46 -37
- package/snapdom/src/modules/fonts.js +90 -92
- package/snapdom/src/modules/iconFonts.js +28 -0
- package/snapdom/src/modules/images.js +6 -6
- package/snapdom/src/modules/pseudo.js +51 -49
- package/snapdom/src/modules/styles.js +27 -7
- package/snapdom/src/modules/svgDefs.js +26 -0
- package/snapdom/src/utils/helpers.js +150 -103
- package/snapdom.js +6 -0
- package/tinycolor/index.js +46 -0
- package/tinycolor/src/conversion.js +143 -0
- package/tinycolor/src/css-color-names.js +153 -0
- package/tinycolor/src/format-input.js +77 -0
- package/tinycolor/src/from-ratio.js +21 -0
- package/tinycolor/src/index.js +404 -0
- package/tinycolor/src/random.js +221 -0
- package/tinycolor/src/readability.js +37 -0
- package/tinycolor/src/to-ms-filter.js +15 -0
- package/tinycolor/src/util.js +32 -0
- package/tinycolor.js +46 -0
- package/tree/index.js +10 -8
- package/tree/searchTree.js +54 -0
- package/tree.js +13 -0
- package/turboStream.js +6 -0
- package/types/case-name/index.d.ts +11 -0
- package/types/class-name/index.d.ts +2 -0
- package/types/clipboard-copy/index.d.ts +2 -0
- package/types/constant/address.d.ts +14 -0
- package/types/constant/chineseCharacters.d.ts +2 -0
- package/types/constant/constellations.d.ts +2 -0
- package/types/constant/domain.d.ts +2 -0
- package/types/constant/identity.d.ts +2 -0
- package/types/constant/index.d.ts +1 -0
- package/types/constant/keyboardCode.d.ts +158 -0
- package/types/constant/licensePlate.d.ts +2 -0
- package/types/constant/name.d.ts +4 -0
- package/types/constant/platform.d.ts +11 -0
- package/types/constant/protocol.d.ts +2 -0
- package/types/constant/ui.d.ts +14 -0
- package/types/content-disposition/index.d.ts +10 -0
- package/types/cookie/index.d.ts +4 -0
- package/types/cookie/src/index.d.ts +114 -0
- package/types/date/convertTime.d.ts +32 -0
- package/types/date/index.d.ts +4 -0
- package/types/decimal/decimal.d.ts +4 -0
- package/types/decimal/index.d.ts +1 -0
- package/types/event-emitter/index.d.ts +17 -0
- package/types/file/fileToURL.d.ts +2 -0
- package/types/file/index.d.ts +3 -0
- package/types/file/saveAs.d.ts +2 -0
- package/types/filesize/index.d.ts +2 -0
- package/types/filesize/src/constants.d.ts +42 -0
- package/types/filesize/src/filesize.d.ts +47 -0
- package/types/index.d.ts +25 -0
- package/types/invariant/index.d.ts +2 -0
- package/types/is/index.d.ts +53 -0
- package/types/lunar/index.d.ts +3 -0
- package/types/lunar/lib/Holiday.d.ts +17 -0
- package/types/lunar/lib/HolidayUtil.d.ts +23 -0
- package/types/lunar/lib/I18n.d.ts +23 -0
- package/types/lunar/lib/JieQi.d.ts +15 -0
- package/types/lunar/lib/Lunar.d.ts +245 -0
- package/types/lunar/lib/LunarMonth.d.ts +35 -0
- package/types/lunar/lib/LunarTime.d.ts +40 -0
- package/types/lunar/lib/LunarUtil.d.ts +128 -0
- package/types/lunar/lib/LunarYear.d.ts +61 -0
- package/types/lunar/lib/ShouXingUtil.d.ts +38 -0
- package/types/lunar/lib/Solar.d.ts +51 -0
- package/types/lunar/lib/SolarHalfYear.d.ts +15 -0
- package/types/lunar/lib/SolarMonth.d.ts +16 -0
- package/types/lunar/lib/SolarSeason.d.ts +15 -0
- package/types/lunar/lib/SolarUtil.d.ts +20 -0
- package/types/lunar/lib/SolarWeek.d.ts +23 -0
- package/types/lunar/lib/SolarYear.d.ts +12 -0
- package/types/lunar/lib/index.d.ts +17 -0
- package/types/math/index.d.ts +11 -0
- package/types/md5/index.d.ts +2 -0
- package/types/mock/MockWebSocket.d.ts +17 -0
- package/types/mock/MockXMLHttpRequest.d.ts +17 -0
- package/types/mock/index.d.ts +2 -0
- package/types/normalize-wheel/ExecutionEnvironment.d.ts +9 -0
- package/types/normalize-wheel/UserAgent_DEPRECATED.d.ts +86 -0
- package/types/normalize-wheel/index.d.ts +115 -0
- package/types/normalize-wheel/isEventSupported.d.ts +16 -0
- package/types/number-to-chinese/index.d.ts +11 -0
- package/types/nzh/cn.d.ts +8 -0
- package/types/nzh/hk.d.ts +8 -0
- package/types/nzh/index.d.ts +1 -0
- package/types/nzh/nzh.d.ts +36 -0
- package/types/nzh/src/autoGet.d.ts +8 -0
- package/types/nzh/src/index.d.ts +34 -0
- package/types/nzh/src/langs/cn_b.d.ts +10 -0
- package/types/nzh/src/langs/cn_s.d.ts +7 -0
- package/types/nzh/src/langs/hk_b.d.ts +10 -0
- package/types/nzh/src/langs/hk_s.d.ts +7 -0
- package/types/nzh/src/utils.d.ts +65 -0
- package/types/object-keys-sort/index.d.ts +4 -0
- package/types/random/address.d.ts +8 -0
- package/types/random/constellation.d.ts +2 -0
- package/types/random/image.d.ts +5 -0
- package/types/random/index.d.ts +40 -0
- package/types/random/licensePlate.d.ts +2 -0
- package/types/random/name.d.ts +9 -0
- package/types/random/number.d.ts +6 -0
- package/types/random/text.d.ts +13 -0
- package/types/random/time.d.ts +2 -0
- package/types/random/web.d.ts +11 -0
- package/types/screenfull/index.d.ts +10 -0
- package/types/snapdom/index.d.ts +1 -0
- package/types/snapdom/src/api/preCache.d.ts +8 -0
- package/types/snapdom/src/api/snapdom.d.ts +26 -0
- package/types/snapdom/src/core/cache.d.ts +11 -0
- package/types/snapdom/src/core/capture.d.ts +17 -0
- package/types/snapdom/src/core/clone.d.ts +11 -0
- package/types/snapdom/src/core/prepare.d.ts +8 -0
- package/types/snapdom/src/index.browser.d.ts +1 -0
- package/types/snapdom/src/index.d.ts +2 -0
- package/types/snapdom/src/modules/background.d.ts +10 -0
- package/types/snapdom/src/modules/fonts.d.ts +23 -0
- package/types/snapdom/src/modules/iconFonts.d.ts +2 -0
- package/types/snapdom/src/modules/images.d.ts +8 -0
- package/types/snapdom/src/modules/pseudo.d.ts +12 -0
- package/types/snapdom/src/modules/styles.d.ts +1 -0
- package/types/snapdom/src/modules/svgDefs.d.ts +19 -0
- package/types/snapdom/src/utils/cssTools.d.ts +38 -0
- package/types/snapdom/src/utils/helpers.d.ts +71 -0
- package/types/tinycolor/index.d.ts +2 -0
- package/types/tinycolor/src/conversion.d.ts +79 -0
- package/types/tinycolor/src/css-color-names.d.ts +4 -0
- package/types/tinycolor/src/format-input.d.ts +38 -0
- package/types/tinycolor/src/from-ratio.d.ts +14 -0
- package/types/tinycolor/src/index.d.ts +214 -0
- package/types/tinycolor/src/interfaces.d.ts +57 -0
- package/types/tinycolor/src/public_api.d.ts +10 -0
- package/types/tinycolor/src/random.d.ts +24 -0
- package/types/tinycolor/src/readability.d.ts +46 -0
- package/types/tinycolor/src/to-ms-filter.d.ts +5 -0
- package/types/tinycolor/src/umd_api.d.ts +22 -0
- package/types/tinycolor/src/util.d.ts +36 -0
- package/types/tree/index.d.ts +9 -0
- package/types/tree/searchTree.d.ts +20 -0
- package/types/turbo-stream/index.d.ts +1 -0
- package/types/turbo-stream/src/decode.d.ts +7 -0
- package/types/turbo-stream/src/encode.d.ts +27 -0
- package/types/turbo-stream/src/shared.d.ts +107 -0
- package/types/turbo-stream/src/turbo-stream.d.ts +4 -0
- package/types/ui-color/compareColorByRange.d.ts +2 -0
- package/types/ui-color/index.d.ts +183 -0
- package/types/url-toolkit/index.d.ts +2 -0
- package/types/url-toolkit/src/url-toolkit.d.ts +18 -0
- package/ui-color/compareColorByRange.js +9 -0
- package/ui-color/index.js +155 -0
- package/uiColor.js +28 -0
- package/urlToolkit.js +8 -0
- package/dayjs/index.js +0 -15
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SolarMonth } from './SolarMonth';
|
|
2
|
+
export declare class SolarYear {
|
|
3
|
+
private readonly _year;
|
|
4
|
+
static fromYear(year: number): SolarYear;
|
|
5
|
+
static fromDate(date: Date): SolarYear;
|
|
6
|
+
constructor(year: number);
|
|
7
|
+
getYear(): number;
|
|
8
|
+
next(years: number): SolarYear;
|
|
9
|
+
getMonths(): SolarMonth[];
|
|
10
|
+
toString(): string;
|
|
11
|
+
toFullString(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Holiday } from './Holiday';
|
|
2
|
+
import { HolidayUtil } from './HolidayUtil';
|
|
3
|
+
import { JieQi } from './JieQi';
|
|
4
|
+
import { Lunar } from './Lunar';
|
|
5
|
+
import { LunarUtil } from './LunarUtil';
|
|
6
|
+
import { Solar } from './Solar';
|
|
7
|
+
import { SolarUtil } from './SolarUtil';
|
|
8
|
+
import { SolarHalfYear } from './SolarHalfYear';
|
|
9
|
+
import { SolarMonth } from './SolarMonth';
|
|
10
|
+
import { SolarSeason } from './SolarSeason';
|
|
11
|
+
import { SolarWeek } from './SolarWeek';
|
|
12
|
+
import { SolarYear } from './SolarYear';
|
|
13
|
+
import { I18n } from './I18n';
|
|
14
|
+
import { LunarMonth } from './LunarMonth';
|
|
15
|
+
import { LunarTime } from './LunarTime';
|
|
16
|
+
import { LunarYear } from './LunarYear';
|
|
17
|
+
export { Holiday, HolidayUtil, I18n, JieQi, Lunar, LunarMonth, LunarTime, LunarUtil, LunarYear, Solar, SolarHalfYear, SolarMonth, SolarSeason, SolarUtil, SolarWeek, SolarYear, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function plus(a: any, b: any): any;
|
|
2
|
+
export function minus(a: any, b: any): any;
|
|
3
|
+
export function times(a: any, b: any): any;
|
|
4
|
+
export function div(a: any, b: any): any;
|
|
5
|
+
declare namespace _default {
|
|
6
|
+
export { plus };
|
|
7
|
+
export { minus };
|
|
8
|
+
export { times };
|
|
9
|
+
export { div };
|
|
10
|
+
}
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const WebSocketNative: {
|
|
2
|
+
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
3
|
+
prototype: WebSocket;
|
|
4
|
+
readonly CONNECTING: 0;
|
|
5
|
+
readonly OPEN: 1;
|
|
6
|
+
readonly CLOSING: 2;
|
|
7
|
+
readonly CLOSED: 3;
|
|
8
|
+
};
|
|
9
|
+
export class MockWebSocket extends EventTarget {
|
|
10
|
+
static add(url: any, template: any, other: any): void;
|
|
11
|
+
constructor(url: any, protocols: any);
|
|
12
|
+
get readyState(): any;
|
|
13
|
+
close(code: any, reason: any): void;
|
|
14
|
+
send(data: any): void;
|
|
15
|
+
#private;
|
|
16
|
+
}
|
|
17
|
+
export default MockWebSocket;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const XMLHttpRequestNative: {
|
|
2
|
+
new (): XMLHttpRequest;
|
|
3
|
+
prototype: XMLHttpRequest;
|
|
4
|
+
readonly UNSENT: 0;
|
|
5
|
+
readonly OPENED: 1;
|
|
6
|
+
readonly HEADERS_RECEIVED: 2;
|
|
7
|
+
readonly LOADING: 3;
|
|
8
|
+
readonly DONE: 4;
|
|
9
|
+
};
|
|
10
|
+
export class MockXMLHttpRequest extends XMLHttpRequest {
|
|
11
|
+
static add(url: any, method: string | undefined, template: any, other: any): void;
|
|
12
|
+
constructor(v: any);
|
|
13
|
+
open(method: any, url: any, async?: boolean, username?: null, password?: null): void;
|
|
14
|
+
send(body: any): void;
|
|
15
|
+
#private;
|
|
16
|
+
}
|
|
17
|
+
export default MockXMLHttpRequest;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default ExecutionEnvironment;
|
|
2
|
+
declare namespace ExecutionEnvironment {
|
|
3
|
+
export { canUseDOM };
|
|
4
|
+
export let canUseWorkers: boolean;
|
|
5
|
+
export let canUseEventListeners: boolean;
|
|
6
|
+
export let canUseViewport: boolean;
|
|
7
|
+
export let isInWorker: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const canUseDOM: boolean;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export default UserAgent_DEPRECATED;
|
|
2
|
+
declare namespace UserAgent_DEPRECATED {
|
|
3
|
+
/**
|
|
4
|
+
* Check if the UA is Internet Explorer.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @return float|NaN Version number (if match) or NaN.
|
|
8
|
+
*/
|
|
9
|
+
function ie(): any;
|
|
10
|
+
/**
|
|
11
|
+
* Check if we're in Internet Explorer compatibility mode.
|
|
12
|
+
*
|
|
13
|
+
* @return bool true if in compatibility mode, false if
|
|
14
|
+
* not compatibility mode or not ie
|
|
15
|
+
*/
|
|
16
|
+
function ieCompatibilityMode(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the browser is 64-bit IE. Really, this is kind of weak sauce; we
|
|
19
|
+
* only need this because Skype can't handle 64-bit IE yet. We need to remove
|
|
20
|
+
* this when we don't need it -- tracked by #601957.
|
|
21
|
+
*/
|
|
22
|
+
function ie64(): any;
|
|
23
|
+
/**
|
|
24
|
+
* Check if the UA is Firefox.
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* @return float|NaN Version number (if match) or NaN.
|
|
28
|
+
*/
|
|
29
|
+
function firefox(): any;
|
|
30
|
+
/**
|
|
31
|
+
* Check if the UA is Opera.
|
|
32
|
+
*
|
|
33
|
+
*
|
|
34
|
+
* @return float|NaN Version number (if match) or NaN.
|
|
35
|
+
*/
|
|
36
|
+
function opera(): any;
|
|
37
|
+
/**
|
|
38
|
+
* Check if the UA is WebKit.
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* @return float|NaN Version number (if match) or NaN.
|
|
42
|
+
*/
|
|
43
|
+
function webkit(): any;
|
|
44
|
+
/**
|
|
45
|
+
* For Push
|
|
46
|
+
* WILL BE REMOVED VERY SOON. Use UserAgent_DEPRECATED.webkit
|
|
47
|
+
*/
|
|
48
|
+
function safari(): any;
|
|
49
|
+
/**
|
|
50
|
+
* Check if the UA is a Chrome browser.
|
|
51
|
+
*
|
|
52
|
+
*
|
|
53
|
+
* @return float|NaN Version number (if match) or NaN.
|
|
54
|
+
*/
|
|
55
|
+
function chrome(): any;
|
|
56
|
+
/**
|
|
57
|
+
* Check if the user is running Windows.
|
|
58
|
+
*
|
|
59
|
+
* @return bool `true' if the user's OS is Windows.
|
|
60
|
+
*/
|
|
61
|
+
function windows(): any;
|
|
62
|
+
/**
|
|
63
|
+
* Check if the user is running Mac OS X.
|
|
64
|
+
*
|
|
65
|
+
* @return float|bool Returns a float if a version number is detected,
|
|
66
|
+
* otherwise true/false.
|
|
67
|
+
*/
|
|
68
|
+
function osx(): any;
|
|
69
|
+
/**
|
|
70
|
+
* Check if the user is running Linux.
|
|
71
|
+
*
|
|
72
|
+
* @return bool `true' if the user's OS is some flavor of Linux.
|
|
73
|
+
*/
|
|
74
|
+
function linux(): any;
|
|
75
|
+
/**
|
|
76
|
+
* Check if the user is running on an iPhone or iPod platform.
|
|
77
|
+
*
|
|
78
|
+
* @return bool `true' if the user is running some flavor of the
|
|
79
|
+
* iPhone OS.
|
|
80
|
+
*/
|
|
81
|
+
function iphone(): any;
|
|
82
|
+
function mobile(): any;
|
|
83
|
+
function nativeApp(): any;
|
|
84
|
+
function android(): any;
|
|
85
|
+
function ipad(): any;
|
|
86
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export default normalizeWheel;
|
|
2
|
+
/**
|
|
3
|
+
* Mouse wheel (and 2-finger trackpad) support on the web sucks. It is
|
|
4
|
+
* complicated, thus this doc is long and (hopefully) detailed enough to answer
|
|
5
|
+
* your questions.
|
|
6
|
+
*
|
|
7
|
+
* If you need to react to the mouse wheel in a predictable way, this code is
|
|
8
|
+
* like your bestest friend. * hugs *
|
|
9
|
+
*
|
|
10
|
+
* As of today, there are 4 DOM event types you can listen to:
|
|
11
|
+
*
|
|
12
|
+
* 'wheel' -- Chrome(31+), FF(17+), IE(9+)
|
|
13
|
+
* 'mousewheel' -- Chrome, IE(6+), Opera, Safari
|
|
14
|
+
* 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother!
|
|
15
|
+
* 'DOMMouseScroll' -- FF(0.9.7+) since 2003
|
|
16
|
+
*
|
|
17
|
+
* So what to do? The is the best:
|
|
18
|
+
*
|
|
19
|
+
* normalizeWheel.getEventType();
|
|
20
|
+
*
|
|
21
|
+
* In your event callback, use this code to get sane interpretation of the
|
|
22
|
+
* deltas. This code will return an object with properties:
|
|
23
|
+
*
|
|
24
|
+
* spinX -- normalized spin speed (use for zoom) - x plane
|
|
25
|
+
* spinY -- " - y plane
|
|
26
|
+
* pixelX -- normalized distance (to pixels) - x plane
|
|
27
|
+
* pixelY -- " - y plane
|
|
28
|
+
*
|
|
29
|
+
* Wheel values are provided by the browser assuming you are using the wheel to
|
|
30
|
+
* scroll a web page by a number of lines or pixels (or pages). Values can vary
|
|
31
|
+
* significantly on different platforms and browsers, forgetting that you can
|
|
32
|
+
* scroll at different speeds. Some devices (like trackpads) emit more events
|
|
33
|
+
* at smaller increments with fine granularity, and some emit massive jumps with
|
|
34
|
+
* linear speed or acceleration.
|
|
35
|
+
*
|
|
36
|
+
* This code does its best to normalize the deltas for you:
|
|
37
|
+
*
|
|
38
|
+
* - spin is trying to normalize how far the wheel was spun (or trackpad
|
|
39
|
+
* dragged). This is super useful for zoom support where you want to
|
|
40
|
+
* throw away the chunky scroll steps on the PC and make those equal to
|
|
41
|
+
* the slow and smooth tiny steps on the Mac. Key data: This code tries to
|
|
42
|
+
* resolve a single slow step on a wheel to 1.
|
|
43
|
+
*
|
|
44
|
+
* - pixel is normalizing the desired scroll delta in pixel units. You'll
|
|
45
|
+
* get the crazy differences between browsers, but at least it'll be in
|
|
46
|
+
* pixels!
|
|
47
|
+
*
|
|
48
|
+
* - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This
|
|
49
|
+
* should translate to positive value zooming IN, negative zooming OUT.
|
|
50
|
+
* This matches the newer 'wheel' event.
|
|
51
|
+
*
|
|
52
|
+
* Why are there spinX, spinY (or pixels)?
|
|
53
|
+
*
|
|
54
|
+
* - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
|
|
55
|
+
* with a mouse. It results in side-scrolling in the browser by default.
|
|
56
|
+
*
|
|
57
|
+
* - spinY is what you expect -- it's the classic axis of a mouse wheel.
|
|
58
|
+
*
|
|
59
|
+
* - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and
|
|
60
|
+
* probably is by browsers in conjunction with fancy 3D controllers .. but
|
|
61
|
+
* you know.
|
|
62
|
+
*
|
|
63
|
+
* Implementation info:
|
|
64
|
+
*
|
|
65
|
+
* Examples of 'wheel' event if you scroll slowly (down) by one step with an
|
|
66
|
+
* average mouse:
|
|
67
|
+
*
|
|
68
|
+
* OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120)
|
|
69
|
+
* OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12)
|
|
70
|
+
* OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A)
|
|
71
|
+
* Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120)
|
|
72
|
+
* Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120)
|
|
73
|
+
*
|
|
74
|
+
* On the trackpad:
|
|
75
|
+
*
|
|
76
|
+
* OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6)
|
|
77
|
+
* OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A)
|
|
78
|
+
*
|
|
79
|
+
* On other/older browsers.. it's more complicated as there can be multiple and
|
|
80
|
+
* also missing delta values.
|
|
81
|
+
*
|
|
82
|
+
* The 'wheel' event is more standard:
|
|
83
|
+
*
|
|
84
|
+
* http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
|
|
85
|
+
*
|
|
86
|
+
* The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
|
|
87
|
+
* deltaX, deltaY and deltaZ. Some browsers provide other values to maintain
|
|
88
|
+
* backward compatibility with older events. Those other values help us
|
|
89
|
+
* better normalize spin speed. Example of what the browsers provide:
|
|
90
|
+
*
|
|
91
|
+
* | event.wheelDelta | event.detail
|
|
92
|
+
* ------------------+------------------+--------------
|
|
93
|
+
* Safari v5/OS X | -120 | 0
|
|
94
|
+
* Safari v5/Win7 | -120 | 0
|
|
95
|
+
* Chrome v17/OS X | -120 | 0
|
|
96
|
+
* Chrome v17/Win7 | -120 | 0
|
|
97
|
+
* IE9/Win7 | -120 | undefined
|
|
98
|
+
* Firefox v4/OS X | undefined | 1
|
|
99
|
+
* Firefox v4/Win7 | undefined | 3
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
declare function normalizeWheel(event: any): {
|
|
103
|
+
spinX: number;
|
|
104
|
+
spinY: number;
|
|
105
|
+
pixelX: number;
|
|
106
|
+
pixelY: number;
|
|
107
|
+
};
|
|
108
|
+
declare namespace normalizeWheel {
|
|
109
|
+
/**
|
|
110
|
+
* The best combination if you prefer spinX + spinY normalization. It favors
|
|
111
|
+
* the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with
|
|
112
|
+
* 'wheel' event, making spin speed determination impossible.
|
|
113
|
+
*/
|
|
114
|
+
function getEventType(): "wheel" | "DOMMouseScroll" | "mousewheel";
|
|
115
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default isEventSupported;
|
|
2
|
+
/**
|
|
3
|
+
* Checks if an event is supported in the current execution environment.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: This will not work correctly for non-generic events such as `change`,
|
|
6
|
+
* `reset`, `load`, `error`, and `select`.
|
|
7
|
+
*
|
|
8
|
+
* Borrows from Modernizr.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} eventNameSuffix Event name, e.g. "click".
|
|
11
|
+
* @param {?boolean} capture Check if the capture phase is supported.
|
|
12
|
+
* @return {boolean} True if the event is supported.
|
|
13
|
+
* @internal
|
|
14
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
15
|
+
*/
|
|
16
|
+
declare function isEventSupported(eventNameSuffix: string, capture: boolean | null): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface NumberToChineseOptions {
|
|
2
|
+
mode?: 'normal' | 'money';
|
|
3
|
+
negativeSymbol?: string;
|
|
4
|
+
decimalDigits?: number;
|
|
5
|
+
trailingZeros?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 数字转中文主函数
|
|
9
|
+
*/
|
|
10
|
+
declare function numberToChinese(num: number, options?: NumberToChineseOptions): string;
|
|
11
|
+
export default numberToChinese;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
encodeS: (num: any, options: any) => string;
|
|
3
|
+
encodeB: (num: any, options: any) => string;
|
|
4
|
+
decodeS: (...args: any[]) => string | number;
|
|
5
|
+
decodeB: (...args: any[]) => string | number;
|
|
6
|
+
toMoney: (num: any, options: any) => string;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
encodeS: (num: any, options: any) => string;
|
|
3
|
+
encodeB: (num: any, options: any) => string;
|
|
4
|
+
decodeS: (...args: any[]) => string | number;
|
|
5
|
+
decodeB: (...args: any[]) => string | number;
|
|
6
|
+
toMoney: (num: any, options: any) => string;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default Nzh;
|
|
2
|
+
declare function Nzh(lang: any): void;
|
|
3
|
+
declare class Nzh {
|
|
4
|
+
constructor(lang: any);
|
|
5
|
+
lang: any;
|
|
6
|
+
encode: (...args: any[]) => string;
|
|
7
|
+
decode: (...args: any[]) => string | number;
|
|
8
|
+
toMoney: (...args: any[]) => string;
|
|
9
|
+
}
|
|
10
|
+
declare namespace Nzh {
|
|
11
|
+
export { langs };
|
|
12
|
+
export let cn: {
|
|
13
|
+
encodeS: (num: any, options: any) => string;
|
|
14
|
+
encodeB: (num: any, options: any) => string;
|
|
15
|
+
decodeS: (...args: any[]) => string | number;
|
|
16
|
+
decodeB: (...args: any[]) => string | number;
|
|
17
|
+
toMoney: (num: any, options: any) => string;
|
|
18
|
+
};
|
|
19
|
+
export let hk: {
|
|
20
|
+
encodeS: (num: any, options: any) => string;
|
|
21
|
+
encodeB: (num: any, options: any) => string;
|
|
22
|
+
decodeS: (...args: any[]) => string | number;
|
|
23
|
+
decodeB: (...args: any[]) => string | number;
|
|
24
|
+
toMoney: (num: any, options: any) => string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
declare namespace langs {
|
|
28
|
+
export { cn_s as s };
|
|
29
|
+
export { cn_b as b };
|
|
30
|
+
export { hk_s };
|
|
31
|
+
export { hk_b };
|
|
32
|
+
}
|
|
33
|
+
import cn_s from './src/langs/cn_s';
|
|
34
|
+
import cn_b from './src/langs/cn_b';
|
|
35
|
+
import hk_s from './src/langs/hk_s';
|
|
36
|
+
import hk_b from './src/langs/hk_b';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function getNzhObjByLang(lang_s: any, lang_b: any): {
|
|
2
|
+
encodeS: (num: any, options: any) => string;
|
|
3
|
+
encodeB: (num: any, options: any) => string;
|
|
4
|
+
decodeS: (...args: any[]) => string | number;
|
|
5
|
+
decodeB: (...args: any[]) => string | number;
|
|
6
|
+
toMoney: (num: any, options: any) => string;
|
|
7
|
+
};
|
|
8
|
+
export default getNzhObjByLang;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 阿拉伯数字转中文数字
|
|
3
|
+
*
|
|
4
|
+
* @param {String} num 阿拉伯数字/字符串 , 科学记数法字符串
|
|
5
|
+
* @param {Object} opration 转换配置
|
|
6
|
+
* {
|
|
7
|
+
* ww: {万万化单位 | false}
|
|
8
|
+
* tenMin: {十的口语化 | false}
|
|
9
|
+
* }
|
|
10
|
+
* @returns String
|
|
11
|
+
*/
|
|
12
|
+
export function CL(num: string, options: any): string;
|
|
13
|
+
/**
|
|
14
|
+
* 中文数字转阿拉伯数字
|
|
15
|
+
*
|
|
16
|
+
* @param {string} cnnumb 中文数字字符串
|
|
17
|
+
* @returns Number
|
|
18
|
+
*/
|
|
19
|
+
export function unCL(cnnumb: string, options: any): string | number;
|
|
20
|
+
/**
|
|
21
|
+
* 阿拉伯数字转金额
|
|
22
|
+
*
|
|
23
|
+
* @param {String} num 阿拉伯数字/字符串 , 科学记数法字符串
|
|
24
|
+
* @param {Object} options 转换配置
|
|
25
|
+
* {
|
|
26
|
+
* ww:{万万化开关 | true},
|
|
27
|
+
* unOmitYuan: {整数为0时不省略元| false},
|
|
28
|
+
* complete:{完整金额格式 | false},
|
|
29
|
+
* outSymbol:{是否输出金额符号 | true}
|
|
30
|
+
* forceZheng:{以转换结果加“整” | false}
|
|
31
|
+
* }
|
|
32
|
+
* @returns String
|
|
33
|
+
*/
|
|
34
|
+
export function toMoney(num: string, options: Object): string;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 科学计数法转十进制
|
|
3
|
+
*
|
|
4
|
+
* @param {string} num 科学记数法字符串
|
|
5
|
+
* @returns string
|
|
6
|
+
*/
|
|
7
|
+
export function e2ten(num: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* 分析数字字符串
|
|
10
|
+
*
|
|
11
|
+
* @param {string} num NumberString
|
|
12
|
+
* @returns object
|
|
13
|
+
*/
|
|
14
|
+
export function getNumbResult(num: string): {
|
|
15
|
+
int: string;
|
|
16
|
+
decimal: string;
|
|
17
|
+
minus: boolean;
|
|
18
|
+
num: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* 数组归一 (按索引覆盖合并数组,并清空被合并的数组)
|
|
22
|
+
*
|
|
23
|
+
* @param {array} baseArray 基础数组
|
|
24
|
+
* @param {...array} array1
|
|
25
|
+
* @returns array
|
|
26
|
+
*/
|
|
27
|
+
export function centerArray(baseArray: array, ...args: array[]): array;
|
|
28
|
+
/**
|
|
29
|
+
* 检查对像属性 (非原型链)
|
|
30
|
+
*
|
|
31
|
+
* @param {object} obj
|
|
32
|
+
* @param {string} key
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
export function hasAttr(obj: object, key: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 扩展对像(浅复制)
|
|
38
|
+
*
|
|
39
|
+
* @param {object} obj
|
|
40
|
+
* @param {object} obj1
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export function extend(obj: object, ...args: any[]): any;
|
|
44
|
+
/**
|
|
45
|
+
* 获取真实数位
|
|
46
|
+
*
|
|
47
|
+
* @param {number} index 中文单位的索引
|
|
48
|
+
*/
|
|
49
|
+
export function getDigit(index: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* 往数组头部插入0
|
|
52
|
+
*
|
|
53
|
+
* @param {array} arr
|
|
54
|
+
* @param {number} n
|
|
55
|
+
*/
|
|
56
|
+
export function unshiftZero(arr: array, n: number): void;
|
|
57
|
+
/**
|
|
58
|
+
* 清理多余"零"
|
|
59
|
+
*
|
|
60
|
+
* @param {any} str
|
|
61
|
+
* @param {any} zero "零"字符
|
|
62
|
+
* @param {any} type 清理模式 ^ - 开头, $ - 结尾, nto1 - 多个连续变一个
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
export function clearZero(str: any, zero: any, type: any): any;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { number };
|
|
3
|
+
export let natural: (min?: number, max?: number) => number;
|
|
4
|
+
export let integer: (min?: number, max?: number) => number;
|
|
5
|
+
export let float: (min: any, max: any) => number;
|
|
6
|
+
export function boolean(): boolean;
|
|
7
|
+
export function sex(): string;
|
|
8
|
+
export { sample as pick };
|
|
9
|
+
export { text };
|
|
10
|
+
export let ctitle: (min: any, max: any) => string;
|
|
11
|
+
export let cparagraph: (min: any, max: any) => string;
|
|
12
|
+
export let csentence: (min: any, max: any) => string;
|
|
13
|
+
export let cword: (pool: any, min: any, max: any, ...args: any[]) => string;
|
|
14
|
+
export { name };
|
|
15
|
+
export let cname: () => string;
|
|
16
|
+
export { web };
|
|
17
|
+
export let phone: () => string;
|
|
18
|
+
export { address };
|
|
19
|
+
export function county(p: any): string;
|
|
20
|
+
export function company(): string;
|
|
21
|
+
export function project(): string;
|
|
22
|
+
export { time };
|
|
23
|
+
export { constellation };
|
|
24
|
+
export { licensePlate };
|
|
25
|
+
export function uuid(): string;
|
|
26
|
+
export function id(): number;
|
|
27
|
+
export function increment(step: any): number;
|
|
28
|
+
export { image };
|
|
29
|
+
}
|
|
30
|
+
export default _default;
|
|
31
|
+
import number from './number';
|
|
32
|
+
import sample from 'lodash/sample';
|
|
33
|
+
import text from './text';
|
|
34
|
+
import name from './name';
|
|
35
|
+
import web from './web';
|
|
36
|
+
import address from './address';
|
|
37
|
+
import time from './time';
|
|
38
|
+
import constellation from './constellation';
|
|
39
|
+
import licensePlate from './licensePlate';
|
|
40
|
+
import image from './image';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default name;
|
|
2
|
+
declare namespace name {
|
|
3
|
+
function first(): string | undefined;
|
|
4
|
+
function last(): string | undefined;
|
|
5
|
+
function name(middle: any): string;
|
|
6
|
+
function cfirst(): string | undefined;
|
|
7
|
+
function clast(): string | undefined;
|
|
8
|
+
function cname(): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default text;
|
|
2
|
+
declare namespace text {
|
|
3
|
+
function paragraph(min: any, max: any): string;
|
|
4
|
+
function cparagraph(min: any, max: any): string;
|
|
5
|
+
function sentence(min: any, max: any): string;
|
|
6
|
+
function csentence(min: any, max: any): string;
|
|
7
|
+
function word(min: any, max: any): string;
|
|
8
|
+
function cword(pool: any, min: any, max: any, ...args: any[]): string;
|
|
9
|
+
function title(min: any, max: any): string;
|
|
10
|
+
function ctitle(min: any, max: any): string;
|
|
11
|
+
function character(pool: any): any;
|
|
12
|
+
function string(pool: any, min: any, max: any, ...args: any[]): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default web;
|
|
2
|
+
declare namespace web {
|
|
3
|
+
function url(v: any, host: any): string;
|
|
4
|
+
function protocol(): string | undefined;
|
|
5
|
+
function domain(v: any): string;
|
|
6
|
+
function tld(): string | undefined;
|
|
7
|
+
function email(domain: any): string;
|
|
8
|
+
function phone(): string;
|
|
9
|
+
function ip(): string;
|
|
10
|
+
function port(): number;
|
|
11
|
+
}
|