@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,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* convert all properties in an interface to a number
|
|
3
|
+
*/
|
|
4
|
+
export type Numberify<T> = {
|
|
5
|
+
[P in keyof T]: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A representation of additive color mixing.
|
|
9
|
+
* Projection of primary color lights on a white screen shows secondary
|
|
10
|
+
* colors where two overlap; the combination of all three of red, green,
|
|
11
|
+
* and blue in equal intensities makes white.
|
|
12
|
+
*/
|
|
13
|
+
export interface RGB {
|
|
14
|
+
r: number | string;
|
|
15
|
+
g: number | string;
|
|
16
|
+
b: number | string;
|
|
17
|
+
}
|
|
18
|
+
export interface RGBA extends RGB {
|
|
19
|
+
a: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The HSL model describes colors in terms of hue, saturation,
|
|
23
|
+
* and lightness (also called luminance).
|
|
24
|
+
* @link https://en.wikibooks.org/wiki/Color_Models:_RGB,_HSV,_HSL#HSL
|
|
25
|
+
*/
|
|
26
|
+
export interface HSL {
|
|
27
|
+
h: number | string;
|
|
28
|
+
s: number | string;
|
|
29
|
+
l: number | string;
|
|
30
|
+
}
|
|
31
|
+
export interface HSLA extends HSL {
|
|
32
|
+
a: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The HSV, or HSB, model describes colors in terms of
|
|
36
|
+
* hue, saturation, and value (brightness).
|
|
37
|
+
* @link https://en.wikibooks.org/wiki/Color_Models:_RGB,_HSV,_HSL#HSV
|
|
38
|
+
*/
|
|
39
|
+
export interface HSV {
|
|
40
|
+
h: number | string;
|
|
41
|
+
s: number | string;
|
|
42
|
+
v: number | string;
|
|
43
|
+
}
|
|
44
|
+
export interface HSVA extends HSV {
|
|
45
|
+
a: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The CMYK color model is a subtractive color model used in the printing process.
|
|
49
|
+
* It described four ink palettes: Cyan, Magenta, Yellow, and Black.
|
|
50
|
+
* @link https://en.wikipedia.org/wiki/CMYK_color_model
|
|
51
|
+
*/
|
|
52
|
+
export interface CMYK {
|
|
53
|
+
c: number | string;
|
|
54
|
+
m: number | string;
|
|
55
|
+
y: number | string;
|
|
56
|
+
k: number | string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './conversion.js';
|
|
2
|
+
export * from './css-color-names.js';
|
|
3
|
+
export * from './format-input.js';
|
|
4
|
+
export * from './from-ratio.js';
|
|
5
|
+
export * from './index.js';
|
|
6
|
+
export * from './interfaces.js';
|
|
7
|
+
export * from './random.js';
|
|
8
|
+
export * from './readability.js';
|
|
9
|
+
export * from './to-ms-filter.js';
|
|
10
|
+
export * from './util.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TinyColor } from './index.js';
|
|
2
|
+
export interface RandomOptions {
|
|
3
|
+
seed?: number;
|
|
4
|
+
hue?: number | string | 'red' | 'orange' | 'yellow' | 'green' | 'blue' | 'purple' | 'pink' | 'monochrome';
|
|
5
|
+
luminosity?: 'random' | 'bright' | 'dark' | 'light';
|
|
6
|
+
alpha?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface RandomCountOptions extends RandomOptions {
|
|
9
|
+
count?: number | null;
|
|
10
|
+
}
|
|
11
|
+
export declare function random(options?: RandomOptions): TinyColor;
|
|
12
|
+
export declare function random(options?: RandomCountOptions): TinyColor[];
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export interface ColorBound {
|
|
17
|
+
name: string;
|
|
18
|
+
hueRange: [number, number] | null;
|
|
19
|
+
lowerBounds: Array<[number, number]>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export declare const bounds: ColorBound[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ColorInput, TinyColor } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* AKA `contrast`
|
|
4
|
+
*
|
|
5
|
+
* Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
6
|
+
*/
|
|
7
|
+
export declare function readability(color1: ColorInput, color2: ColorInput): number;
|
|
8
|
+
export interface WCAG2Parms {
|
|
9
|
+
level?: 'AA' | 'AAA';
|
|
10
|
+
size?: 'large' | 'small';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
14
|
+
* The third argument is an object.
|
|
15
|
+
* the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
16
|
+
* the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
17
|
+
* If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
18
|
+
*
|
|
19
|
+
* Example
|
|
20
|
+
* ```ts
|
|
21
|
+
* new TinyColor().isReadable('#000', '#111') => false
|
|
22
|
+
* new TinyColor().isReadable('#000', '#111', { level: 'AA', size: 'large' }) => false
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function isReadable(color1: ColorInput, color2: ColorInput, wcag2?: WCAG2Parms): boolean;
|
|
26
|
+
export interface WCAG2FallbackParms extends WCAG2Parms {
|
|
27
|
+
includeFallbackColors?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Given a base color and a list of possible foreground or background
|
|
31
|
+
* colors for that base, returns the most readable color.
|
|
32
|
+
* Optionally returns Black or White if the most readable color is unreadable.
|
|
33
|
+
*
|
|
34
|
+
* @param baseColor - the base color.
|
|
35
|
+
* @param colorList - array of colors to pick the most readable one from.
|
|
36
|
+
* @param args - and object with extra arguments
|
|
37
|
+
*
|
|
38
|
+
* Example
|
|
39
|
+
* ```ts
|
|
40
|
+
* new TinyColor().mostReadable('#123', ['#124", "#125'], { includeFallbackColors: false }).toHexString(); // "#112255"
|
|
41
|
+
* new TinyColor().mostReadable('#123', ['#124", "#125'],{ includeFallbackColors: true }).toHexString(); // "#ffffff"
|
|
42
|
+
* new TinyColor().mostReadable('#a8015a', ["#faf3f3"], { includeFallbackColors:true, level: 'AAA', size: 'large' }).toHexString(); // "#faf3f3"
|
|
43
|
+
* new TinyColor().mostReadable('#a8015a', ["#faf3f3"], { includeFallbackColors:true, level: 'AAA', size: 'small' }).toHexString(); // "#ffffff"
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function mostReadable(baseColor: ColorInput, colorList: ColorInput[], args?: WCAG2FallbackParms): TinyColor | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { names } from './css-color-names.js';
|
|
2
|
+
import { inputToRGB, isValidCSSUnit, stringInputToObject } from './format-input.js';
|
|
3
|
+
import { fromRatio, legacyRandom } from './from-ratio.js';
|
|
4
|
+
import { TinyColor } from './index.js';
|
|
5
|
+
import { random } from './random.js';
|
|
6
|
+
import { mostReadable, readability } from './readability.js';
|
|
7
|
+
import { toMsFilter } from './to-ms-filter.js';
|
|
8
|
+
export interface TinyColorUMD {
|
|
9
|
+
TinyColor: typeof TinyColor;
|
|
10
|
+
readability: typeof readability;
|
|
11
|
+
random: typeof random;
|
|
12
|
+
names: typeof names;
|
|
13
|
+
fromRatio: typeof fromRatio;
|
|
14
|
+
legacyRandom: typeof legacyRandom;
|
|
15
|
+
toMsFilter: typeof toMsFilter;
|
|
16
|
+
inputToRGB: typeof inputToRGB;
|
|
17
|
+
stringInputToObject: typeof stringInputToObject;
|
|
18
|
+
isValidCSSUnit: typeof isValidCSSUnit;
|
|
19
|
+
mostReadable: typeof mostReadable;
|
|
20
|
+
}
|
|
21
|
+
declare const tinycolorumd: TinyColorUMD;
|
|
22
|
+
export default tinycolorumd;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Take input from [0, n] and return it as [0, 1]
|
|
3
|
+
* @hidden
|
|
4
|
+
*/
|
|
5
|
+
export declare function bound01(n: any, max: number): number;
|
|
6
|
+
/**
|
|
7
|
+
* Force a number between 0 and 1
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export declare function clamp01(val: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
13
|
+
* <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export declare function isOnePointZero(n: string | number): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Check to see if string passed in is a percentage
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export declare function isPercentage(n: string | number): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
export declare function boundAlpha(a?: number | string): number;
|
|
27
|
+
/**
|
|
28
|
+
* Replace a decimal with it's percentage value
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export declare function convertToPercentage(n: number | string): number | string;
|
|
32
|
+
/**
|
|
33
|
+
* Force a hex value to have 2 characters
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
export declare function pad2(c: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function findNodeBy(root: any, key: any, value: any, childrenKey?: string): any;
|
|
2
|
+
export function getItemBy(root: any, key: any, value: any, childrenKey?: string): any;
|
|
3
|
+
export function getItemBy3(root: any, key: any, value: any, childrenKey?: string): any;
|
|
4
|
+
export function getItemByID(root: any, value: any): any;
|
|
5
|
+
export function getLabelFromDictionaryByValue(a: any, value: any, 保底?: boolean): any;
|
|
6
|
+
export function getChildWithParentBy(root: any, key: any, value: any, childrenKey?: string): null | undefined;
|
|
7
|
+
export function getItemBy2(root: any, key: any, value: any, childrenKey?: string): any;
|
|
8
|
+
export default getItemBy;
|
|
9
|
+
export { default as searchTree } from "./searchTree";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Primitive = string | number | boolean | symbol | null | undefined;
|
|
2
|
+
type ConditionValue<T = unknown> = Primitive | ((value: T) => boolean) | RegExp;
|
|
3
|
+
interface SearchOptions {
|
|
4
|
+
strategy?: 'BFS' | 'DFS';
|
|
5
|
+
childrenKey?: string;
|
|
6
|
+
strict?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface TreeNode {
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
children?: TreeNode[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 非递归树搜索算法
|
|
14
|
+
* @param {TreeNode[]} treeData - 树数据
|
|
15
|
+
* @param {Record<string, ConditionValue>} searchCondition - 搜索条件对象
|
|
16
|
+
* @param {SearchOptions} [options={}] - 配置选项
|
|
17
|
+
* @returns {TreeNode | null} 找到的节点或null
|
|
18
|
+
*/
|
|
19
|
+
declare function searchTree(treeData: TreeNode[], searchCondition: Record<string, ConditionValue>, options?: SearchOptions): TreeNode | null;
|
|
20
|
+
export default searchTree;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/turbo-stream";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type DecodePlugin = (type: string, ...data: unknown[]) => {
|
|
2
|
+
value: unknown;
|
|
3
|
+
} | false | null | undefined;
|
|
4
|
+
export type DecodeOptions = {
|
|
5
|
+
plugins?: DecodePlugin[];
|
|
6
|
+
};
|
|
7
|
+
export declare function decode<T>(stream: ReadableStream<string>, { plugins }?: DecodeOptions): Promise<T>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const ASYNC_FRAME_TYPE_PROMISE = 1;
|
|
2
|
+
declare const ASYNC_FRAME_TYPE_ITERABLE = 2;
|
|
3
|
+
type AsyncFrame = [
|
|
4
|
+
type: typeof ASYNC_FRAME_TYPE_PROMISE,
|
|
5
|
+
id: number,
|
|
6
|
+
promise: PromiseLike<unknown>
|
|
7
|
+
] | [
|
|
8
|
+
type: typeof ASYNC_FRAME_TYPE_ITERABLE,
|
|
9
|
+
id: number,
|
|
10
|
+
iterable: AsyncIterable<unknown>
|
|
11
|
+
];
|
|
12
|
+
export type EncodePlugin = (value: unknown) => [string, ...unknown[]] | false | null | undefined;
|
|
13
|
+
export type EncodeOptions = {
|
|
14
|
+
plugins?: EncodePlugin[];
|
|
15
|
+
redactErrors?: boolean | string;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
};
|
|
18
|
+
export declare function encode(value: unknown, { plugins, redactErrors, signal }?: EncodeOptions): ReadableStream<string>;
|
|
19
|
+
export declare function encodeSync(value: unknown, chunks: {
|
|
20
|
+
push(...chunk: string[]): void;
|
|
21
|
+
}, refs: WeakMap<object, number>, promises: WeakMap<object, number>, asyncFrames: {
|
|
22
|
+
push(frame: AsyncFrame): void;
|
|
23
|
+
}, counters: {
|
|
24
|
+
refId: number;
|
|
25
|
+
promiseId: number;
|
|
26
|
+
}, plugins: EncodePlugin[], redactErrors: boolean | string): void;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export declare const STR_ARRAY_BUFFER = "A";
|
|
2
|
+
export declare const STR_ASYNC_ITERABLE = "*";
|
|
3
|
+
export declare const STR_BIG_INT_64_ARRAY = "J";
|
|
4
|
+
export declare const STR_BIG_UINT_64_ARRAY = "j";
|
|
5
|
+
export declare const STR_BIGINT = "b";
|
|
6
|
+
export declare const STR_BLOB = "K";
|
|
7
|
+
export declare const STR_DATA_VIEW = "V";
|
|
8
|
+
export declare const STR_DATE = "D";
|
|
9
|
+
export declare const STR_ERROR = "E";
|
|
10
|
+
export declare const STR_FAILURE = "!";
|
|
11
|
+
export declare const STR_FALSE = "false";
|
|
12
|
+
export declare const STR_FILE = "k";
|
|
13
|
+
export declare const STR_FLOAT_32_ARRAY = "H";
|
|
14
|
+
export declare const STR_FLOAT_64_ARRAY = "h";
|
|
15
|
+
export declare const STR_FORM_DATA = "F";
|
|
16
|
+
export declare const STR_INFINITY = "I";
|
|
17
|
+
export declare const STR_INT_16_ARRAY = "L";
|
|
18
|
+
export declare const STR_INT_32_ARRAY = "G";
|
|
19
|
+
export declare const STR_INT_8_ARRAY = "O";
|
|
20
|
+
export declare const STR_MAP = "M";
|
|
21
|
+
export declare const STR_NaN = "NaN";
|
|
22
|
+
export declare const STR_NEGATIVE_INFINITY = "i";
|
|
23
|
+
export declare const STR_NEGATIVE_ZERO = "z";
|
|
24
|
+
export declare const STR_NULL = "null";
|
|
25
|
+
export declare const STR_PLUGIN = "P";
|
|
26
|
+
export declare const STR_PROMISE = "$";
|
|
27
|
+
export declare const STR_READABLE_STREAM = "R";
|
|
28
|
+
export declare const STR_REDACTED = "<redacted>";
|
|
29
|
+
export declare const STR_REFERENCE_SYMBOL = "@";
|
|
30
|
+
export declare const STR_REGEXP = "r";
|
|
31
|
+
export declare const STR_SET = "S";
|
|
32
|
+
export declare const STR_SUCCESS = ":";
|
|
33
|
+
export declare const STR_SYMBOL = "s";
|
|
34
|
+
export declare const STR_TRUE = "true";
|
|
35
|
+
export declare const STR_UINT_16_ARRAY = "l";
|
|
36
|
+
export declare const STR_UINT_32_ARRAY = "g";
|
|
37
|
+
export declare const STR_UINT_8_ARRAY = "o";
|
|
38
|
+
export declare const STR_UINT_8_ARRAY_CLAMPED = "C";
|
|
39
|
+
export declare const STR_UNDEFINED = "u";
|
|
40
|
+
export declare const STR_URL = "U";
|
|
41
|
+
declare let SUPPORTS_FILE: boolean;
|
|
42
|
+
export { SUPPORTS_FILE };
|
|
43
|
+
export declare class WaitGroup {
|
|
44
|
+
#private;
|
|
45
|
+
p: number;
|
|
46
|
+
add(): void;
|
|
47
|
+
done(): void;
|
|
48
|
+
wait(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
export declare class Deferred<T> {
|
|
51
|
+
promise: Promise<T>;
|
|
52
|
+
resolve: (value: T) => void;
|
|
53
|
+
reject: (error: unknown) => void;
|
|
54
|
+
constructor();
|
|
55
|
+
}
|
|
56
|
+
export declare class DeferredAsyncIterable<T> {
|
|
57
|
+
#private;
|
|
58
|
+
iterable: AsyncIterable<T>;
|
|
59
|
+
constructor();
|
|
60
|
+
resolve(): void;
|
|
61
|
+
reject(error: unknown): void;
|
|
62
|
+
yield(value: T): void;
|
|
63
|
+
}
|
|
64
|
+
export declare class DeferredReadableStream<T> extends DeferredAsyncIterable<T> {
|
|
65
|
+
readable: ReadableStream<T>;
|
|
66
|
+
}
|
|
67
|
+
export declare class TurboBlob extends Blob {
|
|
68
|
+
#private;
|
|
69
|
+
promise?: Promise<ArrayBuffer>;
|
|
70
|
+
constructor();
|
|
71
|
+
constructor(from: TurboBlob, start: number | undefined, end: number | undefined, contentType: string | undefined);
|
|
72
|
+
get size(): number;
|
|
73
|
+
set size(value: number);
|
|
74
|
+
get type(): string;
|
|
75
|
+
set type(value: string);
|
|
76
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
77
|
+
bytes(): Promise<Uint8Array>;
|
|
78
|
+
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
79
|
+
stream(): ReadableStream<Uint8Array>;
|
|
80
|
+
text(): Promise<string>;
|
|
81
|
+
}
|
|
82
|
+
declare const FileBaseClass: {
|
|
83
|
+
new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
|
|
84
|
+
prototype: File;
|
|
85
|
+
} | {
|
|
86
|
+
new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
|
|
87
|
+
prototype: Blob;
|
|
88
|
+
};
|
|
89
|
+
export declare class TurboFile extends FileBaseClass {
|
|
90
|
+
#private;
|
|
91
|
+
promise?: Promise<ArrayBuffer>;
|
|
92
|
+
constructor();
|
|
93
|
+
constructor(from: TurboFile, start: number | undefined, end: number | undefined, contentType: string | undefined);
|
|
94
|
+
get name(): string;
|
|
95
|
+
set name(value: string);
|
|
96
|
+
get lastModified(): number;
|
|
97
|
+
set lastModified(value: number);
|
|
98
|
+
get size(): number;
|
|
99
|
+
set size(value: number);
|
|
100
|
+
get type(): string;
|
|
101
|
+
set type(value: string);
|
|
102
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
103
|
+
bytes(): Promise<Uint8Array>;
|
|
104
|
+
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
105
|
+
stream(): ReadableStream<Uint8Array>;
|
|
106
|
+
text(): Promise<string>;
|
|
107
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
export { default as compareColorByRange } from "./compareColorByRange";
|
|
2
|
+
export namespace blue {
|
|
3
|
+
namespace name {
|
|
4
|
+
let zh: string;
|
|
5
|
+
let en: string;
|
|
6
|
+
}
|
|
7
|
+
let value: string;
|
|
8
|
+
}
|
|
9
|
+
export const colorPresets: {
|
|
10
|
+
key: string;
|
|
11
|
+
name: {
|
|
12
|
+
zh: string;
|
|
13
|
+
en: string;
|
|
14
|
+
};
|
|
15
|
+
primary: string;
|
|
16
|
+
light: TinyColor[];
|
|
17
|
+
dark: TinyColor[];
|
|
18
|
+
}[];
|
|
19
|
+
export const colors: {
|
|
20
|
+
name: {
|
|
21
|
+
zh: string;
|
|
22
|
+
en: string;
|
|
23
|
+
};
|
|
24
|
+
value: string;
|
|
25
|
+
}[];
|
|
26
|
+
export namespace cyan {
|
|
27
|
+
export namespace name_1 {
|
|
28
|
+
let zh_1: string;
|
|
29
|
+
export { zh_1 as zh };
|
|
30
|
+
let en_1: string;
|
|
31
|
+
export { en_1 as en };
|
|
32
|
+
}
|
|
33
|
+
export { name_1 as name };
|
|
34
|
+
let value_1: string;
|
|
35
|
+
export { value_1 as value };
|
|
36
|
+
}
|
|
37
|
+
export function generate(options?: {}): TinyColor[];
|
|
38
|
+
export function generateDark(options?: {}): TinyColor[];
|
|
39
|
+
export namespace gold {
|
|
40
|
+
export namespace name_2 {
|
|
41
|
+
let zh_2: string;
|
|
42
|
+
export { zh_2 as zh };
|
|
43
|
+
let en_2: string;
|
|
44
|
+
export { en_2 as en };
|
|
45
|
+
}
|
|
46
|
+
export { name_2 as name };
|
|
47
|
+
let value_2: string;
|
|
48
|
+
export { value_2 as value };
|
|
49
|
+
}
|
|
50
|
+
export namespace gray {
|
|
51
|
+
export namespace name_3 {
|
|
52
|
+
let zh_3: string;
|
|
53
|
+
export { zh_3 as zh };
|
|
54
|
+
let en_3: string;
|
|
55
|
+
export { en_3 as en };
|
|
56
|
+
}
|
|
57
|
+
export { name_3 as name };
|
|
58
|
+
let value_3: string;
|
|
59
|
+
export { value_3 as value };
|
|
60
|
+
}
|
|
61
|
+
export namespace grayPresets {
|
|
62
|
+
export let key: string;
|
|
63
|
+
import name_4 = gray.name;
|
|
64
|
+
export { name_4 as name };
|
|
65
|
+
import primary = gray.value;
|
|
66
|
+
export { primary };
|
|
67
|
+
export let light: TinyColor[];
|
|
68
|
+
export let dark: TinyColor[];
|
|
69
|
+
}
|
|
70
|
+
export namespace green {
|
|
71
|
+
export namespace name_5 {
|
|
72
|
+
let zh_4: string;
|
|
73
|
+
export { zh_4 as zh };
|
|
74
|
+
let en_4: string;
|
|
75
|
+
export { en_4 as en };
|
|
76
|
+
}
|
|
77
|
+
export { name_5 as name };
|
|
78
|
+
let value_4: string;
|
|
79
|
+
export { value_4 as value };
|
|
80
|
+
}
|
|
81
|
+
export const LENGTH: 10;
|
|
82
|
+
export namespace lime {
|
|
83
|
+
export namespace name_6 {
|
|
84
|
+
let zh_5: string;
|
|
85
|
+
export { zh_5 as zh };
|
|
86
|
+
let en_5: string;
|
|
87
|
+
export { en_5 as en };
|
|
88
|
+
}
|
|
89
|
+
export { name_6 as name };
|
|
90
|
+
let value_5: string;
|
|
91
|
+
export { value_5 as value };
|
|
92
|
+
}
|
|
93
|
+
export namespace magenta {
|
|
94
|
+
export namespace name_7 {
|
|
95
|
+
let zh_6: string;
|
|
96
|
+
export { zh_6 as zh };
|
|
97
|
+
let en_6: string;
|
|
98
|
+
export { en_6 as en };
|
|
99
|
+
}
|
|
100
|
+
export { name_7 as name };
|
|
101
|
+
let value_6: string;
|
|
102
|
+
export { value_6 as value };
|
|
103
|
+
}
|
|
104
|
+
export namespace orange {
|
|
105
|
+
export namespace name_8 {
|
|
106
|
+
let zh_7: string;
|
|
107
|
+
export { zh_7 as zh };
|
|
108
|
+
let en_7: string;
|
|
109
|
+
export { en_7 as en };
|
|
110
|
+
}
|
|
111
|
+
export { name_8 as name };
|
|
112
|
+
let value_7: string;
|
|
113
|
+
export { value_7 as value };
|
|
114
|
+
}
|
|
115
|
+
export namespace orangered {
|
|
116
|
+
export namespace name_9 {
|
|
117
|
+
let zh_8: string;
|
|
118
|
+
export { zh_8 as zh };
|
|
119
|
+
let en_8: string;
|
|
120
|
+
export { en_8 as en };
|
|
121
|
+
}
|
|
122
|
+
export { name_9 as name };
|
|
123
|
+
let value_8: string;
|
|
124
|
+
export { value_8 as value };
|
|
125
|
+
}
|
|
126
|
+
export function palette(options?: {}): TinyColor;
|
|
127
|
+
export function paletteDark(options?: {}): TinyColor;
|
|
128
|
+
export namespace pinkpurple {
|
|
129
|
+
export namespace name_10 {
|
|
130
|
+
let zh_9: string;
|
|
131
|
+
export { zh_9 as zh };
|
|
132
|
+
let en_9: string;
|
|
133
|
+
export { en_9 as en };
|
|
134
|
+
}
|
|
135
|
+
export { name_10 as name };
|
|
136
|
+
let value_9: string;
|
|
137
|
+
export { value_9 as value };
|
|
138
|
+
}
|
|
139
|
+
export namespace primary {
|
|
140
|
+
export namespace name_11 {
|
|
141
|
+
let zh_10: string;
|
|
142
|
+
export { zh_10 as zh };
|
|
143
|
+
let en_10: string;
|
|
144
|
+
export { en_10 as en };
|
|
145
|
+
}
|
|
146
|
+
export { name_11 as name };
|
|
147
|
+
let value_10: string;
|
|
148
|
+
export { value_10 as value };
|
|
149
|
+
}
|
|
150
|
+
export namespace purple {
|
|
151
|
+
export namespace name_12 {
|
|
152
|
+
let zh_11: string;
|
|
153
|
+
export { zh_11 as zh };
|
|
154
|
+
let en_11: string;
|
|
155
|
+
export { en_11 as en };
|
|
156
|
+
}
|
|
157
|
+
export { name_12 as name };
|
|
158
|
+
let value_11: string;
|
|
159
|
+
export { value_11 as value };
|
|
160
|
+
}
|
|
161
|
+
export namespace red {
|
|
162
|
+
export namespace name_13 {
|
|
163
|
+
let zh_12: string;
|
|
164
|
+
export { zh_12 as zh };
|
|
165
|
+
let en_12: string;
|
|
166
|
+
export { en_12 as en };
|
|
167
|
+
}
|
|
168
|
+
export { name_13 as name };
|
|
169
|
+
let value_12: string;
|
|
170
|
+
export { value_12 as value };
|
|
171
|
+
}
|
|
172
|
+
export namespace yellow {
|
|
173
|
+
export namespace name_14 {
|
|
174
|
+
let zh_13: string;
|
|
175
|
+
export { zh_13 as zh };
|
|
176
|
+
let en_13: string;
|
|
177
|
+
export { en_13 as en };
|
|
178
|
+
}
|
|
179
|
+
export { name_14 as name };
|
|
180
|
+
let value_13: string;
|
|
181
|
+
export { value_13 as value };
|
|
182
|
+
}
|
|
183
|
+
import TinyColor from '../tinycolor';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { buildAbsoluteURL };
|
|
3
|
+
export { parseURL };
|
|
4
|
+
export { normalizePath };
|
|
5
|
+
export { buildURLFromParts };
|
|
6
|
+
}
|
|
7
|
+
export default _default;
|
|
8
|
+
export function buildAbsoluteURL(baseURL: any, relativeURL: any, opts: any): any;
|
|
9
|
+
export function buildURLFromParts(parts: any): any;
|
|
10
|
+
export function normalizePath(path: any): any;
|
|
11
|
+
export function parseURL(url: any): {
|
|
12
|
+
scheme: string;
|
|
13
|
+
netLoc: string;
|
|
14
|
+
path: string;
|
|
15
|
+
params: string;
|
|
16
|
+
query: string;
|
|
17
|
+
fragment: string;
|
|
18
|
+
} | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function i(r = [34797, 15747172]) {
|
|
2
|
+
return (n = 1) => {
|
|
3
|
+
const o = r, t = Math.log(256) / Math.log(2), e = o[0] >>> t * 2 & 255, g = o[0] >>> t * 1 & 255, l = o[0] >>> t * 0 & 255, c = o[1] >>> t * 2 & 255, s = o[1] >>> t * 1 & 255, f = o[1] >>> t * 0 & 255, a = c - (c - e) * n, b = s - (s - g) * n, h = f - (f - l) * n;
|
|
4
|
+
return `rgb(${a},${b},${h})`;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
i as default
|
|
9
|
+
};
|