@unicom-cloud/utils 0.1.11 → 0.1.13

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 (122) hide show
  1. package/date/index.js +22 -0
  2. package/date.js +9 -0
  3. package/filesize/src/constants.js +22 -22
  4. package/filesize/src/filesize.js +32 -33
  5. package/index.js +56 -54
  6. package/lunar/index.js +36 -0
  7. package/lunar/lib/Holiday.js +42 -0
  8. package/lunar/lib/HolidayUtil.js +128 -0
  9. package/lunar/lib/I18n.js +1005 -0
  10. package/lunar/lib/JieQi.js +40 -0
  11. package/lunar/lib/Lunar.js +1035 -0
  12. package/lunar/lib/LunarMonth.js +150 -0
  13. package/lunar/lib/LunarTime.js +138 -0
  14. package/lunar/lib/LunarUtil.js +1752 -0
  15. package/lunar/lib/LunarYear.js +616 -0
  16. package/lunar/lib/ShouXingUtil.js +6915 -0
  17. package/lunar/lib/Solar.js +311 -0
  18. package/lunar/lib/SolarHalfYear.js +45 -0
  19. package/lunar/lib/SolarMonth.js +55 -0
  20. package/lunar/lib/SolarSeason.js +42 -0
  21. package/lunar/lib/SolarUtil.js +256 -0
  22. package/lunar/lib/SolarWeek.js +153 -0
  23. package/lunar/lib/SolarYear.js +35 -0
  24. package/lunar/lib/index.js +35 -0
  25. package/lunar.js +36 -0
  26. package/package.json +1 -1
  27. package/snapdom/src/api/preCache.js +27 -37
  28. package/snapdom/src/api/snapdom.js +75 -58
  29. package/snapdom/src/core/cache.js +19 -8
  30. package/snapdom/src/core/capture.js +49 -48
  31. package/snapdom/src/core/clone.js +96 -31
  32. package/snapdom/src/core/prepare.js +43 -37
  33. package/snapdom/src/modules/background.js +29 -20
  34. package/snapdom/src/modules/fonts.js +94 -104
  35. package/snapdom/src/modules/iconFonts.js +28 -0
  36. package/snapdom/src/modules/images.js +6 -6
  37. package/snapdom/src/modules/pseudo.js +52 -50
  38. package/snapdom/src/modules/styles.js +26 -6
  39. package/snapdom/src/modules/svgDefs.js +26 -0
  40. package/snapdom/src/utils/cssTools.js +41 -41
  41. package/snapdom/src/utils/helpers.js +128 -84
  42. package/tinycolor/index.js +46 -0
  43. package/tinycolor/src/conversion.js +143 -0
  44. package/tinycolor/src/css-color-names.js +153 -0
  45. package/tinycolor/src/format-input.js +77 -0
  46. package/tinycolor/src/from-ratio.js +21 -0
  47. package/tinycolor/src/index.js +404 -0
  48. package/tinycolor/src/random.js +221 -0
  49. package/tinycolor/src/readability.js +37 -0
  50. package/tinycolor/src/to-ms-filter.js +15 -0
  51. package/tinycolor/src/util.js +32 -0
  52. package/tinycolor.js +46 -0
  53. package/tree/index.js +10 -8
  54. package/tree/search/index.js +90 -0
  55. package/tree.js +9 -7
  56. package/types/date/index.d.ts +4 -0
  57. package/types/filesize/src/constants.d.ts +12 -12
  58. package/types/filesize/src/filesize.d.ts +63 -22
  59. package/types/index.d.ts +4 -3
  60. package/types/lunar/index.d.ts +3 -0
  61. package/types/lunar/lib/Holiday.d.ts +17 -0
  62. package/types/lunar/lib/HolidayUtil.d.ts +23 -0
  63. package/types/lunar/lib/I18n.d.ts +23 -0
  64. package/types/lunar/lib/JieQi.d.ts +15 -0
  65. package/types/lunar/lib/Lunar.d.ts +245 -0
  66. package/types/lunar/lib/LunarMonth.d.ts +35 -0
  67. package/types/lunar/lib/LunarTime.d.ts +40 -0
  68. package/types/lunar/lib/LunarUtil.d.ts +128 -0
  69. package/types/lunar/lib/LunarYear.d.ts +61 -0
  70. package/types/lunar/lib/ShouXingUtil.d.ts +38 -0
  71. package/types/lunar/lib/Solar.d.ts +51 -0
  72. package/types/lunar/lib/SolarHalfYear.d.ts +15 -0
  73. package/types/lunar/lib/SolarMonth.d.ts +16 -0
  74. package/types/lunar/lib/SolarSeason.d.ts +15 -0
  75. package/types/lunar/lib/SolarUtil.d.ts +20 -0
  76. package/types/lunar/lib/SolarWeek.d.ts +23 -0
  77. package/types/lunar/lib/SolarYear.d.ts +12 -0
  78. package/types/lunar/lib/index.d.ts +17 -0
  79. package/types/snapdom/src/core/cache.d.ts +17 -11
  80. package/types/snapdom/src/core/capture.d.ts +4 -0
  81. package/types/snapdom/src/core/clone.d.ts +4 -5
  82. package/types/snapdom/src/core/prepare.d.ts +8 -1
  83. package/types/snapdom/src/modules/background.d.ts +1 -2
  84. package/types/snapdom/src/modules/fonts.d.ts +1 -3
  85. package/types/snapdom/src/modules/iconFonts.d.ts +2 -0
  86. package/types/snapdom/src/modules/pseudo.d.ts +1 -3
  87. package/types/snapdom/src/modules/styles.d.ts +1 -10
  88. package/types/snapdom/src/modules/svgDefs.d.ts +19 -0
  89. package/types/snapdom/src/utils/cssTools.d.ts +1 -2
  90. package/types/snapdom/src/utils/helpers.d.ts +1 -1
  91. package/types/tinycolor/index.d.ts +2 -0
  92. package/types/tinycolor/src/conversion.d.ts +79 -0
  93. package/types/tinycolor/src/css-color-names.d.ts +4 -0
  94. package/types/tinycolor/src/format-input.d.ts +38 -0
  95. package/types/tinycolor/src/from-ratio.d.ts +14 -0
  96. package/types/tinycolor/src/index.d.ts +214 -0
  97. package/types/tinycolor/src/interfaces.d.ts +57 -0
  98. package/types/tinycolor/src/public_api.d.ts +10 -0
  99. package/types/tinycolor/src/random.d.ts +24 -0
  100. package/types/tinycolor/src/readability.d.ts +46 -0
  101. package/types/tinycolor/src/to-ms-filter.d.ts +5 -0
  102. package/types/tinycolor/src/umd_api.d.ts +22 -0
  103. package/types/tinycolor/src/util.d.ts +36 -0
  104. package/types/tree/index.d.ts +1 -0
  105. package/types/tree/search/index.d.ts +80 -0
  106. package/types/ui-color/compareColorByRange.d.ts +2 -0
  107. package/types/ui-color/index.d.ts +208 -0
  108. package/ui-color/compareColorByRange.js +9 -0
  109. package/ui-color/index.js +162 -0
  110. package/uiColor.js +29 -0
  111. package/convertTime.js +0 -4
  112. package/dayjs/index.js +0 -15
  113. package/dayjs.js +0 -5
  114. package/lunar-converter/index.js +0 -641
  115. package/lunarConverter.js +0 -4
  116. package/search-tree/index.js +0 -54
  117. package/searchTree.js +0 -4
  118. package/types/dayjs/index.d.ts +0 -1
  119. package/types/lunar-converter/index.d.ts +0 -113
  120. package/types/search-tree/index.d.ts +0 -20
  121. /package/{convert-time/index.js → date/convertTime.js} +0 -0
  122. /package/types/{convert-time/index.d.ts → date/convertTime.d.ts} +0 -0
@@ -1,113 +0,0 @@
1
- interface LunarDate {
2
- year: number;
3
- month: number;
4
- day: number;
5
- chineseMonth: string;
6
- chineseDay: string;
7
- isLeapMonth: boolean;
8
- zodiac: string;
9
- ganZhiYear: string;
10
- solarTerm: string | null;
11
- festivals: string[];
12
- }
13
- declare class LunarConverter {
14
- private static readonly MIN;
15
- private static readonly MAX;
16
- private static readonly LUNAR_INFO;
17
- private static readonly SOLAR_TERMS;
18
- private static readonly LUNAR_HOLIDAYS;
19
- private static readonly SOLAR_HOLIDAYS;
20
- private static readonly SPECIAL_HOLIDAYS;
21
- /**
22
- * 查找某月中第N个星期X的日期
23
- * @param year 年份
24
- * @param month 月份(1-12)
25
- * @param weekday 星期几(0-6,0表示周日)
26
- * @param nth 第几个(1-5)
27
- * @returns 日期
28
- */
29
- private static findNthWeekdayInMonth;
30
- private static readonly GAN;
31
- private static readonly ZHI;
32
- private static readonly ZODIAC;
33
- private static readonly CHINESE_NUMBERS;
34
- private static readonly CHINESE_DAY_NAMES;
35
- private static readonly CHINESE_MONTH_NAMES;
36
- private static customSolarHolidays;
37
- private static customLunarHolidays;
38
- /**
39
- * 添加自定义公历节日
40
- * @param month 月份(1-12)
41
- * @param day 日期
42
- * @param name 节日名称
43
- */
44
- static addCustomSolarHoliday(month: number, day: number, name: string): void;
45
- /**
46
- * 添加自定义农历节日
47
- * @param month 月份(1-12)
48
- * @param day 日期
49
- * @param name 节日名称
50
- */
51
- static addCustomLunarHoliday(month: number, day: number, name: string): void;
52
- /**
53
- * 移除自定义公历节日
54
- * @param month 月份(1-12)
55
- * @param day 日期
56
- */
57
- static removeCustomSolarHoliday(month: number, day: number): void;
58
- /**
59
- * 移除自定义农历节日
60
- * @param month 月份(1-12)
61
- * @param day 日期
62
- */
63
- static removeCustomLunarHoliday(month: number, day: number): void;
64
- /**
65
- * 公历转农历(主方法)
66
- * @param year 公历年份
67
- * @param month 公历月份(1-12)
68
- * @param day 公历日期(1-31)
69
- * @returns 农历日期对象
70
- */
71
- static solarToLunar(year: number, month: number, day: number): LunarDate;
72
- /**
73
- * 获取所有节日(农历、公历和自定义节日)
74
- */
75
- private static getFestivals;
76
- /**
77
- * 获取农历年的总天数
78
- */
79
- private static getLunarYearDays;
80
- /**
81
- * 获取农历每月的天数信息
82
- */
83
- private static getLunarMonthInfo;
84
- /**
85
- * 获取闰月月份(没有闰月返回0)
86
- */
87
- private static getLeapMonth;
88
- /**
89
- * 获取节气
90
- */
91
- private static getSolarTerm;
92
- /**
93
- * 获取农历月份的天数
94
- */
95
- private static getLunarMonthDays;
96
- /**
97
- * 数字日期转中文
98
- */
99
- private static dayToChinese;
100
- /**
101
- * 数字月份转中文(处理闰月)
102
- */
103
- private static monthToChinese;
104
- /**
105
- * 获取生肖
106
- */
107
- private static getZodiac;
108
- /**
109
- * 获取天干地支
110
- */
111
- private static getGanZhi;
112
- }
113
- export default LunarConverter;
@@ -1,20 +0,0 @@
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;
File without changes