@zfqh/uview-x 0.0.0-stage → 0.0.2

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 (93) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +127 -3
  4. package/components/uv-badge/props.ts +83 -0
  5. package/components/uv-badge/uv-badge.vue +186 -0
  6. package/components/uv-button/props.ts +148 -0
  7. package/components/uv-button/uv-button.vue +565 -0
  8. package/components/uv-checkbox/props.ts +83 -0
  9. package/components/uv-checkbox/uv-checkbox.vue +403 -0
  10. package/components/uv-checkbox-group/props.ts +97 -0
  11. package/components/uv-checkbox-group/uv-checkbox-group.vue +163 -0
  12. package/components/uv-code/props.ts +48 -0
  13. package/components/uv-code/uv-code.vue +156 -0
  14. package/components/uv-dialog/props.ts +56 -0
  15. package/components/uv-dialog/uv-dialog.vue +492 -0
  16. package/components/uv-form/props.ts +59 -0
  17. package/components/uv-form/uv-form.vue +256 -0
  18. package/components/uv-form/valid.ts +1344 -0
  19. package/components/uv-form-item/props.ts +62 -0
  20. package/components/uv-form-item/uv-form-item.vue +335 -0
  21. package/components/uv-icon/icons.ts +161 -0
  22. package/components/uv-icon/props.ts +91 -0
  23. package/components/uv-icon/uv-icon.vue +208 -0
  24. package/components/uv-icon/uvicons.ttf +0 -0
  25. package/components/uv-input/props.ts +185 -0
  26. package/components/uv-input/uv-input.vue +431 -0
  27. package/components/uv-line/props.ts +42 -0
  28. package/components/uv-line/uv-line.vue +75 -0
  29. package/components/uv-line-progress/props.ts +43 -0
  30. package/components/uv-line-progress/uv-line-progress.vue +166 -0
  31. package/components/uv-loading-icon/props.ts +78 -0
  32. package/components/uv-loading-icon/uv-loading-icon.vue +226 -0
  33. package/components/uv-overlay/props.ts +38 -0
  34. package/components/uv-overlay/uv-overlay.vue +120 -0
  35. package/components/uv-popup/props.ts +101 -0
  36. package/components/uv-popup/uv-popup.vue +371 -0
  37. package/components/uv-safe-bottom/props.ts +18 -0
  38. package/components/uv-safe-bottom/uv-safe-bottom.vue +120 -0
  39. package/components/uv-status-bar/props.ts +22 -0
  40. package/components/uv-status-bar/uv-status-bar.vue +121 -0
  41. package/components/uv-tabs/props.ts +84 -0
  42. package/components/uv-tabs/uv-tabs.vue +432 -0
  43. package/components/uv-transition/props.ts +38 -0
  44. package/components/uv-transition/uv-transition.vue +170 -0
  45. package/hooks/index.ts +5 -0
  46. package/hooks/useDebounce.ts +35 -0
  47. package/hooks/useI18n.ts +95 -0
  48. package/hooks/useThrottle.ts +38 -0
  49. package/index.ts +23 -0
  50. package/libs/dayjs/index.ts +217 -0
  51. package/libs/index.ts +4 -0
  52. package/libs/luch-request/adapters/index.ts +133 -0
  53. package/libs/luch-request/core/InterceptorManager.ts +52 -0
  54. package/libs/luch-request/core/Request.ts +202 -0
  55. package/libs/luch-request/core/buildFullPath.ts +21 -0
  56. package/libs/luch-request/core/defaults.ts +34 -0
  57. package/libs/luch-request/core/dispatchRequest.ts +7 -0
  58. package/libs/luch-request/core/mergeConfig.ts +127 -0
  59. package/libs/luch-request/core/settle.ts +17 -0
  60. package/libs/luch-request/helpers/buildURL.ts +65 -0
  61. package/libs/luch-request/helpers/combineURLs.ts +15 -0
  62. package/libs/luch-request/helpers/isAbsoluteURL.ts +15 -0
  63. package/libs/luch-request/index.d.ts +197 -0
  64. package/libs/luch-request/index.ts +3 -0
  65. package/libs/luch-request/utils/clone.ts +265 -0
  66. package/libs/luch-request/utils.ts +136 -0
  67. package/locales/en.ts +78 -0
  68. package/locales/index.ts +169 -0
  69. package/locales/zh-Hans.ts +78 -0
  70. package/package.json +42 -4
  71. package/styles/color.scss +33 -0
  72. package/styles/common.scss +134 -0
  73. package/styles/components.scss +19 -0
  74. package/styles/index.scss +7 -0
  75. package/styles/theme.scss +44 -0
  76. package/styles/var.module.scss +32 -0
  77. package/styles/vue.scss +39 -0
  78. package/theme.scss +2 -0
  79. package/types/index.d.ts +66 -0
  80. package/utils/colorGradient.ts +139 -0
  81. package/utils/compat.ts +165 -0
  82. package/utils/compress.ts +34 -0
  83. package/utils/config.ts +95 -0
  84. package/utils/debounce.ts +7 -0
  85. package/utils/digit.ts +157 -0
  86. package/utils/function.ts +771 -0
  87. package/utils/http.ts +5 -0
  88. package/utils/index.ts +57 -0
  89. package/utils/locale.ts +296 -0
  90. package/utils/platform.ts +71 -0
  91. package/utils/route.ts +142 -0
  92. package/utils/test.ts +256 -0
  93. package/utils/throttle.ts +7 -0
@@ -0,0 +1,170 @@
1
+ <template>
2
+ <view
3
+ v-if="isShow"
4
+ class="uv-transition"
5
+ :class="rootClass"
6
+ :style="transitionStyle"
7
+ @tap="onClick"
8
+ >
9
+ <slot></slot>
10
+ </view>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'
15
+ import { $uv } from '../../utils'
16
+ import props from './props'
17
+
18
+ defineOptions({
19
+ name: 'uv-transition',
20
+ // #ifdef UNI-APP-X
21
+ styleIsolation: 'app-and-page',
22
+ // #endif
23
+ virtualHost: true,
24
+ })
25
+
26
+ /**
27
+ * transition 动画组件
28
+ * @description 使用 CSS transition 实现淡入/滑动/缩放过渡,替代旧版 uni.createAnimation。
29
+ * @tutorial https://www.uvui.cn/components/transition.html
30
+ * @property {Boolean} show 是否展示组件(默认 false)
31
+ * @property {Array|String} mode 内置过渡动画类型(默认 'fade')
32
+ * @property {String|Number} duration 动画执行时间,单位 ms(默认 300)
33
+ * @property {String} timingFunction 动画过渡函数(默认 'ease-out')
34
+ * @property {Object} customStyle 自定义样式
35
+ * @property {String} customClass 自定义类名
36
+ * @property {Boolean} cellChild nvue 兼容属性,x 下无效果
37
+ * @event {Function} click 点击组件触发
38
+ * @event {Function} change 过渡动画结束时触发
39
+ */
40
+ const p = defineProps(props)
41
+
42
+ const emit = defineEmits(['click', 'change'])
43
+
44
+ const isShow = ref(false)
45
+ const active = ref(false)
46
+ let timer: any = null
47
+ let openTimer: any = null
48
+
49
+ const durationTime = computed(() => Number(p.duration) || 0)
50
+
51
+ const rootClass = computed(() => {
52
+ if (Array.isArray(p.customClass)) return p.customClass
53
+ return p.customClass ? [p.customClass] : []
54
+ })
55
+
56
+ const modes = computed<string[]>(() => {
57
+ if (typeof p.mode === 'string') return [p.mode]
58
+ if (Array.isArray(p.mode)) return p.mode.filter((m: any) => typeof m === 'string')
59
+ return ['fade']
60
+ })
61
+
62
+ const hiddenStyle = computed(() => {
63
+ const transforms: string[] = []
64
+ let opacity = 1
65
+ for (const mode of modes.value) {
66
+ if (mode === 'fade') {
67
+ opacity = 0
68
+ } else if (mode === 'slide-top') {
69
+ transforms.push('translateY(-100%)')
70
+ } else if (mode === 'slide-right') {
71
+ transforms.push('translateX(100%)')
72
+ } else if (mode === 'slide-bottom') {
73
+ transforms.push('translateY(100%)')
74
+ } else if (mode === 'slide-left') {
75
+ transforms.push('translateX(-100%)')
76
+ } else if (mode === 'zoom-in') {
77
+ transforms.push('scale(0.8)')
78
+ } else if (mode === 'zoom-out') {
79
+ transforms.push('scale(1.2)')
80
+ }
81
+ }
82
+ return {
83
+ transform: transforms.length ? transforms.join(' ') : '',
84
+ opacity
85
+ }
86
+ })
87
+
88
+ const transitionStyle = computed(() => {
89
+ const hidden = hiddenStyle.value
90
+ const style: any = {
91
+ transitionProperty: 'transform, opacity',
92
+ transitionDuration: `${durationTime.value}ms`,
93
+ transitionTimingFunction: p.timingFunction,
94
+ transform: active.value ? '' : hidden.transform,
95
+ opacity: active.value ? 1 : hidden.opacity
96
+ }
97
+ return Object.assign(style, $uv.addStyle(p.customStyle))
98
+ })
99
+
100
+ const clearTimers = () => {
101
+ if (timer) {
102
+ clearTimeout(timer)
103
+ timer = null
104
+ }
105
+ if (openTimer) {
106
+ clearTimeout(openTimer)
107
+ openTimer = null
108
+ }
109
+ }
110
+
111
+ const open = () => {
112
+ clearTimers()
113
+ active.value = false
114
+ isShow.value = true
115
+ nextTick(() => {
116
+ openTimer = setTimeout(() => {
117
+ active.value = true
118
+ openTimer = null
119
+ timer = setTimeout(() => {
120
+ emit('change', { detail: true })
121
+ timer = null
122
+ }, durationTime.value)
123
+ }, 20)
124
+ })
125
+ }
126
+
127
+ const close = () => {
128
+ if (!isShow.value) return
129
+ clearTimers()
130
+ active.value = false
131
+ timer = setTimeout(() => {
132
+ isShow.value = false
133
+ emit('change', { detail: false })
134
+ timer = null
135
+ }, durationTime.value)
136
+ }
137
+
138
+ watch(
139
+ () => p.show,
140
+ (show: boolean) => {
141
+ if (show) {
142
+ open()
143
+ } else if (isShow.value) {
144
+ close()
145
+ }
146
+ },
147
+ { immediate: true }
148
+ )
149
+
150
+ onBeforeUnmount(() => {
151
+ clearTimers()
152
+ })
153
+
154
+ const onClick = () => {
155
+ emit('click', {
156
+ detail: isShow.value
157
+ })
158
+ }
159
+
160
+ defineExpose({
161
+ open,
162
+ close
163
+ })
164
+ </script>
165
+
166
+ <style lang="scss">
167
+ .uv-transition {
168
+ transition-property: transform, opacity;
169
+ }
170
+ </style>
package/hooks/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { useDebounce } from './useDebounce';
2
+ export { useThrottle } from './useThrottle';
3
+ export * from './useI18n';
4
+ export type { DebounceFunction } from './useDebounce';
5
+ export type { ThrottleFunction } from './useThrottle';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * 实例级防抖。
3
+ *
4
+ * @example
5
+ * const debounce = useDebounce()
6
+ * debounce(fn) // 使用实例 delay(默认 500)
7
+ * debounce(fn, 1000) // 调用层覆盖 delay
8
+ * const debounce300 = useDebounce(300)
9
+ *
10
+ * 每个 useDebounce() 返回独立闭包,多个实例互不干扰。
11
+ */
12
+ export type DebounceFunction = (
13
+ func: (...args: any[]) => void,
14
+ wait?: number,
15
+ immediate?: boolean
16
+ ) => void
17
+
18
+ export function useDebounce(delay = 500): DebounceFunction {
19
+ let timeout: ReturnType<typeof setTimeout> | null = null
20
+ return (func: (...args: any[]) => void, wait = delay, immediate = false) => {
21
+ if (timeout !== null) clearTimeout(timeout)
22
+ if (immediate) {
23
+ const callNow = !timeout
24
+ timeout = setTimeout(() => {
25
+ timeout = null
26
+ }, wait)
27
+ if (callNow) typeof func === 'function' && func()
28
+ } else {
29
+ timeout = setTimeout(() => {
30
+ timeout = null
31
+ typeof func === 'function' && func()
32
+ }, wait)
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,95 @@
1
+ import { computed } from 'vue';
2
+ import type { WritableComputedRef } from 'vue';
3
+ // #ifndef APP || MP
4
+ import { getCurrentInstance } from 'vue';
5
+ import { useI18n as vueUseI18n } from 'vue-i18n';
6
+ // #endif
7
+ import { appTranslate, getI18nGlobal, getI18nMessages, localeState, unwrapI18nValue } from '../utils/locale';
8
+ import type { I18nMessages } from '../utils/locale';
9
+
10
+ /** 页面内使用的 i18n hook 类型:与 vue-i18n 的 `useI18n` 保持一致 */
11
+ type UseI18n = typeof import('vue-i18n').useI18n;
12
+
13
+ /** 无 vue-i18n 实例时的降级返回值(只覆盖组件用到的常用字段) */
14
+ interface UseI18nFallback {
15
+ t: (key: string, values?: Record<string, string | number>) => string;
16
+ locale: WritableComputedRef<string>;
17
+ messages: I18nMessages;
18
+ }
19
+
20
+ /**
21
+ * 可写 locale:优先取 `uni.$i18n.global.locale`,无实例时读内部 `localeState`。
22
+ * setter 只更新实例 / 内部状态,**不**调用 `setLocale`、不写 storage(避免与 `setLocale` 互相触发)。
23
+ */
24
+ function createLocaleComputed(): WritableComputedRef<string> {
25
+ return computed<string>({
26
+ get: () => {
27
+ const global = getI18nGlobal();
28
+ return String(unwrapI18nValue(global?.locale) || localeState.value);
29
+ },
30
+ set: (value: string) => {
31
+ const global = getI18nGlobal();
32
+ if (!global) {
33
+ localeState.value = value;
34
+ return;
35
+ }
36
+ const target: unknown = global.locale;
37
+ // composition 模式下 global.locale 是 WritableComputedRef,必须写 .value;
38
+ // legacy 模式下才是字符串属性,这里做兼容。
39
+ if (target && typeof target === 'object' && 'value' in target) {
40
+ (target as { value: string }).value = value;
41
+ } else {
42
+ global.locale = value;
43
+ }
44
+ },
45
+ });
46
+ }
47
+
48
+ /**
49
+ * 降级实现:不依赖 vue-i18n 运行时,直接读 `uni.$i18n` 语言包 + 组件内置语言包。
50
+ *
51
+ * 小程序端 vue-i18n 为 runtime-only 构建(无消息编译器),App 端也不依赖 vue-i18n 注入;
52
+ * H5 未创建 / 未安装 i18n 实例时同样走这里,保证 `useI18n()` 不抛错。
53
+ */
54
+ function createFallbackI18n(): UseI18nFallback {
55
+ const locale = createLocaleComputed();
56
+ return {
57
+ t: (key: string, values?: Record<string, string | number>): string => {
58
+ // 读取 locale ref,保证切换语言后依赖它的 computed / 模板会重新求值
59
+ void locale.value;
60
+ return appTranslate(key, values);
61
+ },
62
+ locale,
63
+ messages: getI18nMessages(),
64
+ };
65
+ }
66
+
67
+ let _useI18n: UseI18n;
68
+
69
+ // #ifdef APP || MP
70
+ /**
71
+ * App / 小程序端:不依赖 vue-i18n 运行时,提供 `t` / `locale`(可写 computed)/ `messages`。
72
+ * `t` 会读取 `locale` ref,保证 setLocale 切换语言后使用方重新求值。
73
+ */
74
+ _useI18n = function () {
75
+ return createFallbackI18n();
76
+ } as unknown as UseI18n;
77
+ // #endif
78
+
79
+ // #ifndef APP || MP
80
+ /**
81
+ * H5 端:
82
+ * - 已 `app.use(i18n)`(存在 `globalProperties.$i18n`)时调用 vue-i18n 的 `useI18n(...args)`;
83
+ * - 未安装 / 未创建实例时降级为包内实现,不抛错。
84
+ */
85
+ _useI18n = function (...args: unknown[]) {
86
+ const instance = getCurrentInstance();
87
+ const i18n = instance ? instance.appContext.config.globalProperties.$i18n : undefined;
88
+ if (i18n) {
89
+ return (vueUseI18n as unknown as (...rest: unknown[]) => unknown)(...args);
90
+ }
91
+ return createFallbackI18n();
92
+ } as unknown as UseI18n;
93
+ // #endif
94
+
95
+ export const useI18n: UseI18n = _useI18n;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 实例级节流。
3
+ *
4
+ * @example
5
+ * const throttle = useThrottle()
6
+ * throttle(fn) // 使用实例 delay(默认 500)
7
+ * throttle(fn, 1000) // 调用层覆盖 delay
8
+ * const throttle300 = useThrottle(300)
9
+ *
10
+ * 每个 useThrottle() 返回独立闭包,多个实例互不干扰。
11
+ */
12
+ export type ThrottleFunction = (
13
+ func: (...args: any[]) => void,
14
+ wait?: number,
15
+ immediate?: boolean
16
+ ) => void
17
+
18
+ export function useThrottle(delay = 500): ThrottleFunction {
19
+ let timer: ReturnType<typeof setTimeout> | null = null
20
+ let flag = false
21
+ return (func: (...args: any[]) => void, wait = delay, immediate = true) => {
22
+ if (immediate) {
23
+ if (!flag) {
24
+ flag = true
25
+ typeof func === 'function' && func()
26
+ timer = setTimeout(() => {
27
+ flag = false
28
+ }, wait)
29
+ }
30
+ } else if (!flag) {
31
+ flag = true
32
+ timer = setTimeout(() => {
33
+ flag = false
34
+ typeof func === 'function' && func()
35
+ }, wait)
36
+ }
37
+ }
38
+ }
package/index.ts ADDED
@@ -0,0 +1,23 @@
1
+ import type { App } from 'vue';
2
+ import { $uv } from './utils';
3
+
4
+ export * from './utils';
5
+ export * from './hooks';
6
+ export * from './libs';
7
+
8
+ // 与 uv-ui 对齐:入口模块被引入后,脚本中即可使用 uni.$uv。
9
+ // 这样商户项目里(先 import 包、再 import 含 uni.$uv.setConfig 的配置模块)的求值顺序不变。
10
+ uni.$uv = $uv;
11
+
12
+ /**
13
+ * 注册 uview-x 插件。
14
+ *
15
+ * - 仅挂到 `app.config.globalProperties.$uv`,模板中可直接使用 `$uv`;
16
+ * - `uni.$uv` 已在入口模块顶层赋值(脚本中使用);
17
+ * - 不注册全局 mixin,也不提供 uv-ui 的 `mpShare` 等安装选项。
18
+ */
19
+ function install(app: App): void {
20
+ app.config.globalProperties.$uv = $uv;
21
+ }
22
+
23
+ export default { install };
@@ -0,0 +1,217 @@
1
+ // @ts-nocheck
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __commonJS = (cb, mod) => function __require() {
4
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5
+ };
6
+
7
+ var require_dayjs_min = __commonJS({
8
+ "uvuidayjs"(exports, module) {
9
+ !function(t, e) {
10
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
11
+ }(exports, function() {
12
+ "use strict";
13
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
14
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
15
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
16
+ } }, m = function(t2, e2, n2) {
17
+ var r2 = String(t2);
18
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
19
+ }, v = { s: m, z: function(t2) {
20
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
21
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
22
+ }, m: function t2(e2, n2) {
23
+ if (e2.date() < n2.date())
24
+ return -t2(n2, e2);
25
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
26
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
27
+ }, a: function(t2) {
28
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
29
+ }, p: function(t2) {
30
+ return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
31
+ }, u: function(t2) {
32
+ return void 0 === t2;
33
+ } }, g = "en", D = {};
34
+ D[g] = M;
35
+ var p = function(t2) {
36
+ return t2 instanceof _;
37
+ }, S = function t2(e2, n2, r2) {
38
+ var i2;
39
+ if (!e2)
40
+ return g;
41
+ if ("string" == typeof e2) {
42
+ var s2 = e2.toLowerCase();
43
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
44
+ var u2 = e2.split("-");
45
+ if (!i2 && u2.length > 1)
46
+ return t2(u2[0]);
47
+ } else {
48
+ var a2 = e2.name;
49
+ D[a2] = e2, i2 = a2;
50
+ }
51
+ return !r2 && i2 && (g = i2), i2 || !r2 && g;
52
+ }, w = function(t2, e2) {
53
+ if (p(t2))
54
+ return t2.clone();
55
+ var n2 = "object" == typeof e2 ? e2 : {};
56
+ return n2.date = t2, n2.args = arguments, new _(n2);
57
+ }, O = v;
58
+ O.l = S, O.i = p, O.w = function(t2, e2) {
59
+ return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
60
+ };
61
+ var _ = function() {
62
+ function M2(t2) {
63
+ this.$L = S(t2.locale, null, true), this.parse(t2);
64
+ }
65
+ var m2 = M2.prototype;
66
+ return m2.parse = function(t2) {
67
+ this.$d = function(t3) {
68
+ var e2 = t3.date, n2 = t3.utc;
69
+ if (null === e2)
70
+ return new Date(NaN);
71
+ if (O.u(e2))
72
+ return new Date();
73
+ if (e2 instanceof Date)
74
+ return new Date(e2);
75
+ if ("string" == typeof e2 && !/Z$/i.test(e2)) {
76
+ var r2 = e2.match($);
77
+ if (r2) {
78
+ var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
79
+ return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
80
+ }
81
+ }
82
+ return new Date(e2);
83
+ }(t2), this.$x = t2.x || {}, this.init();
84
+ }, m2.init = function() {
85
+ var t2 = this.$d;
86
+ this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
87
+ }, m2.$utils = function() {
88
+ return O;
89
+ }, m2.isValid = function() {
90
+ return !(this.$d.toString() === l);
91
+ }, m2.isSame = function(t2, e2) {
92
+ var n2 = w(t2);
93
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
94
+ }, m2.isAfter = function(t2, e2) {
95
+ return w(t2) < this.startOf(e2);
96
+ }, m2.isBefore = function(t2, e2) {
97
+ return this.endOf(e2) < w(t2);
98
+ }, m2.$g = function(t2, e2, n2) {
99
+ return O.u(t2) ? this[e2] : this.set(n2, t2);
100
+ }, m2.unix = function() {
101
+ return Math.floor(this.valueOf() / 1e3);
102
+ }, m2.valueOf = function() {
103
+ return this.$d.getTime();
104
+ }, m2.startOf = function(t2, e2) {
105
+ var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), l2 = function(t3, e3) {
106
+ var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
107
+ return r2 ? i2 : i2.endOf(a);
108
+ }, $2 = function(t3, e3) {
109
+ return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
110
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
111
+ switch (h2) {
112
+ case c:
113
+ return r2 ? l2(1, 0) : l2(31, 11);
114
+ case f:
115
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
116
+ case o:
117
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
118
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
119
+ case a:
120
+ case d:
121
+ return $2(v2 + "Hours", 0);
122
+ case u:
123
+ return $2(v2 + "Minutes", 1);
124
+ case s:
125
+ return $2(v2 + "Seconds", 2);
126
+ case i:
127
+ return $2(v2 + "Milliseconds", 3);
128
+ default:
129
+ return this.clone();
130
+ }
131
+ }, m2.endOf = function(t2) {
132
+ return this.startOf(t2, false);
133
+ }, m2.$set = function(t2, e2) {
134
+ var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
135
+ if (o2 === f || o2 === c) {
136
+ var y2 = this.clone().set(d, 1);
137
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
138
+ } else
139
+ l2 && this.$d[l2]($2);
140
+ return this.init(), this;
141
+ }, m2.set = function(t2, e2) {
142
+ return this.clone().$set(t2, e2);
143
+ }, m2.get = function(t2) {
144
+ return this[O.p(t2)]();
145
+ }, m2.add = function(r2, h2) {
146
+ var d2, l2 = this;
147
+ r2 = Number(r2);
148
+ var $2 = O.p(h2), y2 = function(t2) {
149
+ var e2 = w(l2);
150
+ return O.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
151
+ };
152
+ if ($2 === f)
153
+ return this.set(f, this.$M + r2);
154
+ if ($2 === c)
155
+ return this.set(c, this.$y + r2);
156
+ if ($2 === a)
157
+ return y2(1);
158
+ if ($2 === o)
159
+ return y2(7);
160
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
161
+ return O.w(m3, this);
162
+ }, m2.subtract = function(t2, e2) {
163
+ return this.add(-1 * t2, e2);
164
+ }, m2.format = function(t2) {
165
+ var e2 = this, n2 = this.$locale();
166
+ if (!this.isValid())
167
+ return n2.invalidDate || l;
168
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
169
+ return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
170
+ }, c2 = function(t3) {
171
+ return O.s(s2 % 12 || 12, t3, "0");
172
+ }, d2 = n2.meridiem || function(t3, e3, n3) {
173
+ var r3 = t3 < 12 ? "AM" : "PM";
174
+ return n3 ? r3.toLowerCase() : r3;
175
+ }, $2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
176
+ return r2.replace(y, function(t3, e3) {
177
+ return e3 || $2[t3] || i2.replace(":", "");
178
+ });
179
+ }, m2.utcOffset = function() {
180
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
181
+ }, m2.diff = function(r2, d2, l2) {
182
+ var $2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, v2 = this - M3, g2 = O.m(this, M3);
183
+ return g2 = ($2 = {}, $2[c] = g2 / 12, $2[f] = g2, $2[h] = g2 / 3, $2[o] = (v2 - m3) / 6048e5, $2[a] = (v2 - m3) / 864e5, $2[u] = v2 / n, $2[s] = v2 / e, $2[i] = v2 / t, $2)[y2] || v2, l2 ? g2 : O.a(g2);
184
+ }, m2.daysInMonth = function() {
185
+ return this.endOf(f).$D;
186
+ }, m2.$locale = function() {
187
+ return D[this.$L];
188
+ }, m2.locale = function(t2, e2) {
189
+ if (!t2)
190
+ return this.$L;
191
+ var n2 = this.clone(), r2 = S(t2, e2, true);
192
+ return r2 && (n2.$L = r2), n2;
193
+ }, m2.clone = function() {
194
+ return O.w(this.$d, this);
195
+ }, m2.toDate = function() {
196
+ return new Date(this.valueOf());
197
+ }, m2.toJSON = function() {
198
+ return this.isValid() ? this.toISOString() : null;
199
+ }, m2.toISOString = function() {
200
+ return this.$d.toISOString();
201
+ }, m2.toString = function() {
202
+ return this.$d.toUTCString();
203
+ }, M2;
204
+ }(), T = _.prototype;
205
+ return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
206
+ T[t2[1]] = function(e2) {
207
+ return this.$g(e2, t2[0], t2[1]);
208
+ };
209
+ }), w.extend = function(t2, e2) {
210
+ return t2.$i || (t2(e2, _, w), t2.$i = true), w;
211
+ }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
212
+ return w(1e3 * t2);
213
+ }, w.en = D[g], w.Ls = D, w.p = {}, w;
214
+ });
215
+ }
216
+ });
217
+ export default require_dayjs_min();
package/libs/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ // libs 公共入口:仅汇总第三方库的可发布接口。
2
+ // 自有代码请放在 utils / hooks / injects / styles,libs 下不允许新增自有实现。
3
+ export { default as Request } from './luch-request'
4
+ export { default as dayjs } from './dayjs'