@unicom-cloud/utils 0.1.15 → 0.1.17

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.
Files changed (90) hide show
  1. package/class-name/index.js +5 -5
  2. package/constant/index.js +24 -2
  3. package/constant/platform.js +13 -12
  4. package/constant.js +24 -2
  5. package/content-disposition/index.js +3 -3
  6. package/date/convertTime.js +4 -4
  7. package/event-emitter/index.js +2 -4
  8. package/filesize/types/constants.d.ts +81 -0
  9. package/filesize/types/filesize.d.ts +97 -0
  10. package/index.js +66 -60
  11. package/js-cookie/index.d.ts +116 -0
  12. package/js-cookie/index.js +4 -0
  13. package/js-cookie/src/api.js +56 -0
  14. package/js-cookie/src/assign.js +11 -0
  15. package/js-cookie/src/converter.js +14 -0
  16. package/jsCookie.js +4 -0
  17. package/lunar/lib/Holiday.js +2 -6
  18. package/lunar/lib/HolidayUtil.js +113 -100
  19. package/lunar/lib/I18n.js +395 -975
  20. package/lunar/lib/JieQi.js +12 -16
  21. package/lunar/lib/Lunar.js +224 -672
  22. package/lunar/lib/LunarMonth.js +35 -98
  23. package/lunar/lib/LunarTime.js +24 -103
  24. package/lunar/lib/LunarUtil.js +426 -1728
  25. package/lunar/lib/LunarYear.js +473 -566
  26. package/lunar/lib/ShouXingUtil.js +6714 -6690
  27. package/lunar/lib/Solar.js +24 -49
  28. package/lunar/lib/SolarHalfYear.js +0 -2
  29. package/lunar/lib/SolarMonth.js +4 -6
  30. package/lunar/lib/SolarSeason.js +0 -2
  31. package/lunar/lib/SolarUtil.js +238 -226
  32. package/lunar/lib/SolarWeek.js +7 -11
  33. package/lunar/lib/SolarYear.js +0 -1
  34. package/nzh/nzh.d.ts +74 -0
  35. package/package.json +1 -1
  36. package/query-string/base.d.ts +717 -0
  37. package/query-string/base.js +268 -0
  38. package/query-string/index.d.ts +16 -0
  39. package/query-string/index.js +4 -0
  40. package/query-string/splitOnFirst.js +14 -0
  41. package/queryString.js +4 -0
  42. package/random/index.js +56 -35
  43. package/snapdom/src/api/preCache.js +51 -28
  44. package/snapdom/src/core/cache.js +1 -4
  45. package/snapdom/src/core/capture.js +45 -44
  46. package/snapdom/src/core/clone.js +82 -66
  47. package/snapdom/src/core/prepare.js +168 -46
  48. package/snapdom/src/modules/background.js +29 -19
  49. package/snapdom/src/modules/fonts.js +146 -91
  50. package/snapdom/src/modules/images.js +14 -9
  51. package/snapdom/src/modules/pseudo.js +55 -58
  52. package/snapdom/src/modules/styles.js +22 -22
  53. package/snapdom/src/modules/svgDefs.js +39 -20
  54. package/snapdom/src/utils/cssTools.js +58 -51
  55. package/snapdom/src/utils/helpers.js +197 -140
  56. package/snapdom/types/snapdom.d.ts +101 -0
  57. package/tinycolor/src/conversion.js +1 -1
  58. package/tinycolor/src/index.js +2 -19
  59. package/turbo-stream/src/encode.js +5 -8
  60. package/turbo-stream/src/shared.js +117 -119
  61. package/types/constant/index.d.ts +11 -0
  62. package/types/constant/platform.d.ts +1 -0
  63. package/types/index.d.ts +3 -0
  64. package/types/js-cookie/index.d.ts +1 -0
  65. package/types/js-cookie/src/api.d.mts +2 -0
  66. package/types/js-cookie/src/assign.d.mts +1 -0
  67. package/types/js-cookie/src/converter.d.mts +5 -0
  68. package/types/lunar/lib/Lunar.d.ts +0 -98
  69. package/types/lunar/lib/LunarMonth.d.ts +0 -12
  70. package/types/lunar/lib/LunarTime.d.ts +0 -22
  71. package/types/lunar/lib/LunarUtil.d.ts +0 -90
  72. package/types/lunar/lib/LunarYear.d.ts +0 -30
  73. package/types/lunar/lib/Solar.d.ts +0 -5
  74. package/types/query-string/base.d.ts +11 -0
  75. package/types/query-string/index.d.ts +2 -0
  76. package/types/query-string/splitOnFirst.d.ts +1 -0
  77. package/types/random/index.d.ts +14 -23
  78. package/types/snapdom/src/api/preCache.d.ts +2 -5
  79. package/types/snapdom/src/core/cache.d.ts +0 -3
  80. package/types/snapdom/src/core/clone.d.ts +1 -1
  81. package/types/snapdom/src/modules/background.d.ts +16 -6
  82. package/types/snapdom/src/modules/fonts.d.ts +5 -1
  83. package/types/snapdom/src/modules/pseudo.d.ts +1 -1
  84. package/types/snapdom/src/modules/styles.d.ts +1 -1
  85. package/types/snapdom/src/modules/svgDefs.d.ts +13 -13
  86. package/types/snapdom/src/utils/cssTools.d.ts +2 -10
  87. package/types/snapdom/src/utils/helpers.d.ts +13 -7
  88. package/types/tinycolor/src/conversion.d.ts +1 -1
  89. package/types/turbo-stream/src/shared.d.ts +3 -3
  90. package/url-toolkit/src/url-toolkit.d.ts +22 -0
@@ -10,30 +10,8 @@ export declare class LunarTime {
10
10
  getZhi(): string;
11
11
  getGanZhi(): string;
12
12
  getShengXiao(): string;
13
- getPositionXi(): string;
14
- getPositionXiDesc(): string;
15
- getPositionYangGui(): string;
16
- getPositionYangGuiDesc(): string;
17
- getPositionYinGui(): string;
18
- getPositionYinGuiDesc(): string;
19
- getPositionFu(sect?: number): string;
20
- getPositionFuDesc(sect?: number): string;
21
- getPositionCai(): string;
22
- getPositionCaiDesc(): string;
23
- getNaYin(): string;
24
- getTianShen(): string;
25
- getTianShenType(): string;
26
- getTianShenLuck(): string;
27
- getChong(): string;
28
- getSha(): string;
29
- getChongShengXiao(): string;
30
- getChongDesc(): string;
31
13
  getChongGan(): string;
32
14
  getChongGanTie(): string;
33
- getYi(): string[];
34
- getJi(): string[];
35
- getXun(): string;
36
- getXunKong(): string;
37
15
  getMinHm(): string;
38
16
  getMaxHm(): string;
39
17
  toString(): string;
@@ -1,125 +1,35 @@
1
1
  export declare class LunarUtil {
2
2
  static BASE_MONTH_ZHI_INDEX: number;
3
- static XUN: string[];
4
- static XUN_KONG: string[];
5
- static CHANG_SHENG: string[];
6
- static MONTH_ZHI: string[];
7
3
  static JIE_QI: string[];
8
4
  static JIE_QI_IN_USE: string[];
9
- static LIU_YAO: string[];
10
- static HOU: string[];
11
- static WU_HOU: string[];
12
5
  static GAN: string[];
13
- static POSITION_XI: string[];
14
- static POSITION_YANG_GUI: string[];
15
- static POSITION_YIN_GUI: string[];
16
- static POSITION_FU: string[];
17
- static POSITION_FU_2: string[];
18
- static POSITION_CAI: string[];
19
- static POSITION_TAI_SUI_YEAR: string[];
20
- static POSITION_GAN: string[];
21
- static POSITION_ZHI: string[];
22
- static POSITION_TAI_DAY: string[];
23
- static POSITION_TAI_MONTH: string[];
24
6
  static ZHI: string[];
25
- static ZHI_XING: string[];
26
7
  static JIA_ZI: string[];
27
8
  static CHANG_SHENG_OFFSET: {
28
9
  [key: string]: number;
29
10
  };
30
- static TIAN_SHEN: string[];
31
11
  static ZHI_TIAN_SHEN_OFFSET: {
32
12
  [key: string]: number;
33
13
  };
34
- static TIAN_SHEN_TYPE: {
35
- [key: string]: string;
36
- };
37
- static TIAN_SHEN_TYPE_LUCK: {
38
- [key: string]: string;
39
- };
40
- static LU: {
41
- [key: string]: string;
42
- };
43
- static PENGZU_GAN: string[];
44
- static PENGZU_ZHI: string[];
45
14
  static NUMBER: string[];
46
15
  static MONTH: string[];
47
16
  static SEASON: string[];
48
17
  static SHENGXIAO: string[];
49
18
  static DAY: string[];
50
19
  static YUE_XIANG: string[];
51
- static XIU: {
52
- [key: string]: string;
53
- };
54
- static XIU_LUCK: {
55
- [key: string]: string;
56
- };
57
- static XIU_SONG: {
58
- [key: string]: string;
59
- };
60
- static ZHENG: {
61
- [key: string]: string;
62
- };
63
- static ANIMAL: {
64
- [key: string]: string;
65
- };
66
- static GONG: {
67
- [key: string]: string;
68
- };
69
- static SHOU: {
70
- [key: string]: string;
71
- };
72
20
  static FESTIVAL: {
73
21
  [key: string]: string;
74
22
  };
75
23
  static OTHER_FESTIVAL: {
76
24
  [key: string]: string[];
77
25
  };
78
- static CHONG: string[];
79
26
  static CHONG_GAN: string[];
80
27
  static CHONG_GAN_TIE: string[];
81
- static CHONG_GAN_4: string[];
82
- static HE_GAN_5: string[];
83
- static HE_ZHI_6: string[];
84
- static SHA: {
85
- [key: string]: string;
86
- };
87
- static POSITION_DESC: {
88
- [key: string]: string;
89
- };
90
- static NAYIN: {
91
- [key: string]: string;
92
- };
93
- static WU_XING_GAN: {
94
- [key: string]: string;
95
- };
96
- static WU_XING_ZHI: {
97
- [key: string]: string;
98
- };
99
- static SHI_SHEN: {
100
- [key: string]: string;
101
- };
102
- static ZHI_HIDE_GAN: {
103
- [key: string]: string[];
104
- };
105
- private static YI_JI;
106
- private static DAY_YI_JI;
107
- private static TIME_YI_JI;
108
- private static SHEN_SHA;
109
- private static DAY_SHEN_SHA;
110
28
  static getTimeZhiIndex(hm: string): number;
111
29
  static convertTime(hm: string): string;
112
30
  static getJiaZiIndex(ganZhi: string): number;
113
31
  static hex(n: number): string;
114
- static getDayYi(monthGanZhi: string, dayGanZhi: string): string[];
115
- static getDayJi(monthGanZhi: string, dayGanZhi: string): string[];
116
- static getDayJiShen(lunarMonth: number, dayGanZhi: string): string[];
117
- static getDayXiongSha(lunarMonth: number, dayGanZhi: string): string[];
118
- static getTimeYi(dayGanZhi: string, timeGanZhi: string): string[];
119
- static getTimeJi(dayGanZhi: string, timeGanZhi: string): string[];
120
32
  static getXunIndex(ganZhi: string): number;
121
- static getXun(ganZhi: string): string;
122
- static getXunKong(ganZhi: string): string;
123
33
  static find(s: string, arr: Array<string>): {
124
34
  index: number;
125
35
  value: string;
@@ -27,35 +27,5 @@ export declare class LunarYear {
27
27
  getLeapMonth(): number;
28
28
  toString(): string;
29
29
  toFullString(): string;
30
- private _getZaoByGan;
31
- private _getZaoByZhi;
32
- getTouLiang(): string;
33
- getCaoZi(): string;
34
- getGengTian(): string;
35
- getHuaShou(): string;
36
- getZhiShui(): string;
37
- getTuoGu(): string;
38
- getQiangMi(): string;
39
- getKanCan(): string;
40
- getGongZhu(): string;
41
- getJiaTian(): string;
42
- getFenBing(): string;
43
- getDeJin(): string;
44
- getRenBing(): string;
45
- getRenChu(): string;
46
- getYuan(): string;
47
- getYun(): string;
48
- getPositionXi(): string;
49
- getPositionXiDesc(): string;
50
- getPositionYangGui(): string;
51
- getPositionYangGuiDesc(): string;
52
- getPositionYinGui(): string;
53
- getPositionYinGuiDesc(): string;
54
- getPositionFu(sect?: number): string;
55
- getPositionFuDesc(sect?: number): string;
56
- getPositionCai(): string;
57
- getPositionCaiDesc(): string;
58
- getPositionTaiSui(): string;
59
- getPositionTaiSuiDesc(): string;
60
30
  next(n: number): LunarYear;
61
31
  }
@@ -28,11 +28,6 @@ export declare class Solar {
28
28
  getOtherFestivals(): string[];
29
29
  getXingzuo(): string;
30
30
  getXingZuo(): string;
31
- /**
32
- * 获取薪资比例(感谢 https://gitee.com/smr1987)
33
- * @returns 1 | 2 | 3 薪资比例
34
- */
35
- getSalaryRate(): number;
36
31
  toYmd(): string;
37
32
  toYmdHms(): string;
38
33
  toString(): string;
@@ -0,0 +1,11 @@
1
+ export function extract(input: any): any;
2
+ export function parse(query: any, options: any): any;
3
+ export function stringify(object: any, options: any): string;
4
+ export function parseUrl(url: any, options: any): {
5
+ fragmentIdentifier?: any;
6
+ url: string;
7
+ query: any;
8
+ };
9
+ export function stringifyUrl(object: any, options: any): string;
10
+ export function pick(input: any, filter: any, options: any): string;
11
+ export function exclude(input: any, filter: any, options: any): string;
@@ -0,0 +1,2 @@
1
+ export default queryString;
2
+ import * as queryString from './base.js';
@@ -0,0 +1 @@
1
+ export default function splitOnFirst(string: any, separator: any): string[];
@@ -1,21 +1,4 @@
1
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
2
  export function county(p: any): string;
20
3
  export function company(): string;
21
4
  export function project(): string;
@@ -26,15 +9,23 @@ declare namespace _default {
26
9
  export function id(): number;
27
10
  export function increment(step: any): number;
28
11
  export { image };
12
+ export { address };
13
+ export { web };
14
+ export { name };
15
+ export { text };
16
+ export function boolean(): boolean;
17
+ export function sex(): string;
18
+ export { sample as pick };
19
+ export { number };
29
20
  }
30
21
  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
22
  import time from './time';
38
23
  import constellation from './constellation';
39
24
  import licensePlate from './licensePlate';
40
25
  import image from './image';
26
+ import address from './address';
27
+ import web from './web';
28
+ import name from './name';
29
+ import text from './text';
30
+ import sample from 'lodash/sample';
31
+ import number from './number';
@@ -1,8 +1,5 @@
1
1
  /**
2
2
  * Preloads images, background images, and optionally fonts into cache before DOM capture.
3
- *
4
- * @param {Document|Element} [root=document] - The root node to search for resources
5
- * @param {Object} [options={}] - Pre-caching options
6
- * @returns {Promise<void>} Resolves when all resources are pre-cached
3
+ * Nunca deja promesas rechazadas sin manejar (evita unhandled rejections).
7
4
  */
8
- export function preCache(root?: Document | Element, options?: Object): Promise<void>;
5
+ export function preCache(root?: Document, options?: {}): Promise<void>;
@@ -8,9 +8,6 @@ export namespace cache {
8
8
  export let font: Set<any>;
9
9
  export let snapshot: WeakMap<WeakKey, any>;
10
10
  export let snapshotKey: Map<any, any>;
11
- export let preStyleMap: Map<any, any>;
12
- export let preStyle: WeakMap<WeakKey, any>;
13
- export let preNodeMap: Map<any, any>;
14
11
  export { resetCache as reset };
15
12
  }
16
13
  declare function resetCache(): void;
@@ -7,4 +7,4 @@
7
7
  * @param {Node} [originalRoot] - Original root element being captured
8
8
  * @returns {Node|null} Cloned node with styles and shadow DOM content, or null for empty text nodes or filtered elements
9
9
  */
10
- export function deepClone(node: Node, compress: boolean, options?: Object, originalRoot?: Node): Node | null;
10
+ export function deepClone(node: Node, styleMap: any, styleCache: any, nodeMap: any, compress: boolean, options?: Object, originalRoot?: Node): Node | null;
@@ -1,9 +1,19 @@
1
1
  /**
2
- * Converts all background images in the cloned element tree to data URLs.
2
+ * Recursively inlines background-related images and masks from the source element to its clone.
3
3
  *
4
- * @param {Element} source - Original element
5
- * @param {Element} clone - Cloned element
6
- * @param {Object} [options={}] - Options for image processing
7
- * @returns {Promise<void>} Promise that resolves when all background images are processed
4
+ * This function walks through the source DOM tree and its clone, copying inline styles for
5
+ * background images, masks, and border images to ensure the clone retains all visual image
6
+ * resources inline (e.g., data URLs), avoiding external dependencies.
7
+ *
8
+ * It also preserves the `background-color` property if it is not transparent.
9
+ *
10
+ * Special handling is done for `border-image` related properties: the
11
+ * `border-image-slice`, `border-image-width`, `border-image-outset`, and `border-image-repeat`
12
+ * are only copied if `border-image` or `border-image-source` are present and active.
13
+ *
14
+ * @param {HTMLElement} source The original source element from which styles are read.
15
+ * @param {HTMLElement} clone The cloned element to which inline styles are applied.
16
+ * @param {Object} [options={}] Optional parameters passed to image inlining functions.
17
+ * @returns {Promise<void>} Resolves when all inlining operations (including async image fetches) complete.
8
18
  */
9
- export function inlineBackgroundImages(source: Element, clone: Element, options?: Object): Promise<void>;
19
+ export function inlineBackgroundImages(source: HTMLElement, clone: HTMLElement, styleCache: any, options?: Object): Promise<void>;
@@ -16,8 +16,12 @@ export function iconToImage(unicodeChar: string, fontFamily: string, fontWeight:
16
16
  * @export
17
17
  * @param {Object} options
18
18
  * @param {boolean} [options.preCached=false] - Whether to use pre-cached resources
19
+ * @param {Object} [options.localFonts=[]] - Additional local fonts to embed
20
+ * @param {string} [options.useProxy=''] - Optional proxy for font fetching
19
21
  * @returns {Promise<string>} The inlined CSS for custom fonts
20
22
  */
21
- export function embedCustomFonts({ preCached }?: {
23
+ export function embedCustomFonts({ preCached, localFonts, useProxy, }?: {
22
24
  preCached?: boolean | undefined;
25
+ localFonts?: Object | undefined;
26
+ useProxy?: string | undefined;
23
27
  }): Promise<string>;
@@ -7,4 +7,4 @@
7
7
  * @param {boolean} embedFonts - Whether to embed icon fonts as images
8
8
  * @returns {Promise} Promise that resolves when all pseudo-elements are processed
9
9
  */
10
- export function inlinePseudoElements(source: Element, clone: Element, compress: boolean, embedFonts: boolean | undefined, useProxy: any): Promise<any>;
10
+ export function inlinePseudoElements(source: Element, clone: Element, styleMap: any, styleCache: any, options: any): Promise<any>;
@@ -1 +1 @@
1
- export function inlineAllStyles(source: any, clone: any, compress: any): void;
1
+ export function inlineAllStyles(source: any, clone: any, styleMap: any, cache: any, compress: any): void;
@@ -1,19 +1,19 @@
1
1
  /**
2
- * Inlines external `<defs>` used by `<use xlink:href="#...">` or `<use href="#...">` inside SVGs,
3
- * copying only the necessary definitions into each individual cloned SVG.
2
+ * Ensures that all external <symbol> or <defs> elements referenced by <use>
3
+ * inside the given root element are inlined into it.
4
4
  *
5
- * This is needed because cloned SVGs using `<use>` may reference elements like `<symbol>`, `<path>`, etc.,
6
- * defined elsewhere in the document (e.g., in a shared `<defs>` block that is not part of the cloned subtree).
5
+ * This is necessary when capturing or exporting an SVG fragment that relies on
6
+ * definitions existing elsewhere in the document, ensuring it remains
7
+ * self-contained and renders correctly.
7
8
  *
8
- * The function finds all `<use>` elements within `root`, extracts the referenced IDs,
9
- * and embeds the required definitions at the top of each SVG.
9
+ * Process:
10
+ * 1. Collect all IDs referenced by <use> elements in the root.
11
+ * 2. Look up those IDs in the global document (outside the root).
12
+ * 3. Create or reuse a hidden <svg> container inside the root to hold inlined defs.
13
+ * 4. Only insert missing <symbol>/<defs> elements that are not already present.
10
14
  *
11
- * @function inlineExternalDef
12
- * @param {ParentNode} root - The root node containing cloned SVGs (usually the result of a DOM snapshot).
13
- * @returns {void}
15
+ * Existing definitions in the root are never modified or removed.
14
16
  *
15
- * @example
16
- * const { clone } = await prepareClone(element);
17
- * inlineExternalDef(clone);
17
+ * @param {HTMLElement} rootElement - The root element being processed (typically the cloned DOM fragment).
18
18
  */
19
- export function inlineExternalDef(root: ParentNode): void;
19
+ export function inlineExternalDefsAndSymbols(rootElement: HTMLElement): void;
@@ -6,15 +6,7 @@ export function precacheCommonTags(): void;
6
6
  * @returns {Object} Object containing default values for all CSS properties
7
7
  */
8
8
  export function getDefaultStyleForTag(tagName: string): Object;
9
- /**
10
- * Creates a unique key from an element's computed style that differs from defaults.
11
- *
12
- * @param {Object} snapshot - Computed style snapshot
13
- * @param {string} tagName - The tag name of the element
14
- * @param {boolean} [compress=false] - Whether to compress style keys
15
- * @returns {string} Semi-colon separated list of non-default properties
16
- */
17
- export function getStyleKey(snapshot: Object, tagName: string, compress?: boolean): string;
9
+ export function getStyleKey(snapshot: any, tagName: any, compress?: boolean): string;
18
10
  /**
19
11
  * Collects all unique tag names used in the DOM tree rooted at the given node.
20
12
  *
@@ -34,4 +26,4 @@ export function generateDedupedBaseCSS(usedTagNames: string[]): string;
34
26
  *
35
27
  * @returns {Map} Map of style keys to class names
36
28
  */
37
- export function generateCSSClasses(): Map<any, any>;
29
+ export function generateCSSClasses(styleMap: any): Map<any, any>;
@@ -49,14 +49,20 @@ export function extractURL(value: string): string | null;
49
49
  */
50
50
  export function isIconFont(familyOrUrl: string): boolean;
51
51
  /**
52
- *
53
- *
54
- * @export
55
- * @param {*} src
56
- * @param {number} [timeout=3000]
57
- * @return {*}
52
+ * Fetch a resource with optional proxy fallback.
53
+ * @param {string} url - Resource URL
54
+ * @param {Object} [options]
55
+ * @param {string} [options.useProxy=''] - Proxy prefix
56
+ * @returns {Promise<Response>} The fetched response
58
57
  */
59
- export function fetchImage(src: any, { timeout, useProxy }?: number): any;
58
+ export function fetchResource(url: string, { useProxy }?: {
59
+ useProxy?: string | undefined;
60
+ }): Promise<Response>;
61
+ export function fetchImage(src: any, { timeout, useProxy, errorTTL }?: {
62
+ timeout?: number | undefined;
63
+ useProxy?: string | undefined;
64
+ errorTTL?: number | undefined;
65
+ }): any;
60
66
  /**
61
67
  *
62
68
  *
@@ -25,7 +25,7 @@ export declare function hslToRgb(h: number | string, s: number | string, l: numb
25
25
  * *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
26
26
  * *Returns:* { h, s, v } in [0,1]
27
27
  */
28
- export declare function rgbToHsv(r: number, g: number, b: number): Numberify<HSV>;
28
+ export declare function rgbToHsv(r?: number, g?: number, b?: number): Numberify<HSV>;
29
29
  /**
30
30
  * Converts an HSV color value to RGB.
31
31
  *
@@ -80,11 +80,11 @@ export declare class TurboBlob extends Blob {
80
80
  text(): Promise<string>;
81
81
  }
82
82
  declare const FileBaseClass: {
83
- new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
84
- prototype: File;
85
- } | {
86
83
  new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
87
84
  prototype: Blob;
85
+ } | {
86
+ new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
87
+ prototype: File;
88
88
  };
89
89
  export declare class TurboFile extends FileBaseClass {
90
90
  #private;
@@ -0,0 +1,22 @@
1
+ export as namespace URLToolkit;
2
+
3
+ export type URLParts = {
4
+ scheme: string;
5
+ netLoc: string;
6
+ path: string;
7
+ params: string;
8
+ query: string;
9
+ fragment: string;
10
+ };
11
+
12
+ export function buildAbsoluteURL(
13
+ baseURL: string,
14
+ relativeURL: string,
15
+ opts?: { alwaysNormalize?: boolean },
16
+ ): string;
17
+
18
+ export function parseURL(url: string): URLParts | null;
19
+
20
+ export function normalizePath(path: string): string;
21
+
22
+ export function buildURLFromParts(parts: URLParts): string;