@puresnake/snake-ui 0.0.0-stage → 0.0.1

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 (279) hide show
  1. package/LICENSE +21 -0
  2. package/changelog.md +1 -0
  3. package/components/snake-activity-list/snake-activity-list.vue +365 -0
  4. package/components/snake-activity-list/types.ts +29 -0
  5. package/components/snake-auxiliary-segmentation/snake-auxiliary-segmentation.vue +44 -0
  6. package/components/snake-auxiliary-segmentation/types.ts +5 -0
  7. package/components/snake-button/snake-button.vue +357 -0
  8. package/components/snake-button/types.ts +103 -0
  9. package/components/snake-button-sort/snake-button-sort.vue +72 -0
  10. package/components/snake-button-sort/types.ts +22 -0
  11. package/components/snake-calendar/snake-calendar.vue +998 -0
  12. package/components/snake-calendar/types.ts +189 -0
  13. package/components/snake-cell-group/snake-cell-group.vue +55 -0
  14. package/components/snake-cell-group/types.ts +19 -0
  15. package/components/snake-cell-item/snake-cell-item.vue +159 -0
  16. package/components/snake-cell-item/types.ts +66 -0
  17. package/components/snake-checkbox/snake-checkbox.vue +264 -0
  18. package/components/snake-checkbox/types.ts +70 -0
  19. package/components/snake-checkbox-group/snake-checkbox-group.vue +154 -0
  20. package/components/snake-checkbox-group/types.ts +52 -0
  21. package/components/snake-cms/blocks/v2/cms-v2-carousel.vue +87 -0
  22. package/components/snake-cms/blocks/v2/cms-v2-coupon.vue +25 -0
  23. package/components/snake-cms/blocks/v2/cms-v2-custom.vue +12 -0
  24. package/components/snake-cms/blocks/v2/cms-v2-divider.vue +33 -0
  25. package/components/snake-cms/blocks/v2/cms-v2-floatbutton.vue +28 -0
  26. package/components/snake-cms/blocks/v2/cms-v2-goods-list.vue +150 -0
  27. package/components/snake-cms/blocks/v2/cms-v2-hotzone.vue +41 -0
  28. package/components/snake-cms/blocks/v2/cms-v2-images.vue +41 -0
  29. package/components/snake-cms/blocks/v2/cms-v2-magiccube.vue +93 -0
  30. package/components/snake-cms/blocks/v2/cms-v2-notice.vue +80 -0
  31. package/components/snake-cms/blocks/v2/cms-v2-popup.vue +46 -0
  32. package/components/snake-cms/blocks/v2/cms-v2-richtext.vue +18 -0
  33. package/components/snake-cms/blocks/v2/cms-v2-search.vue +115 -0
  34. package/components/snake-cms/blocks/v2/cms-v2-video.vue +25 -0
  35. package/components/snake-cms/blocks/v2/shared.ts +84 -0
  36. package/components/snake-cms/snake-cms.vue +409 -0
  37. package/components/snake-cms/types.ts +50 -0
  38. package/components/snake-commodity-search/snake-commodity-search.vue +234 -0
  39. package/components/snake-commodity-search/types.ts +11 -0
  40. package/components/snake-config-provider/snake-config-provider.vue +61 -0
  41. package/components/snake-config-provider/types.ts +22 -0
  42. package/components/snake-count-down/snake-count-down.vue +231 -0
  43. package/components/snake-count-down/types.ts +103 -0
  44. package/components/snake-coupon/snake-coupon.vue +209 -0
  45. package/components/snake-coupon/types.ts +21 -0
  46. package/components/snake-custom-module/snake-custom-module.vue +25 -0
  47. package/components/snake-custom-module/types.ts +11 -0
  48. package/components/snake-drop-menu/snake-drop-menu.vue +123 -0
  49. package/components/snake-drop-menu/types.ts +95 -0
  50. package/components/snake-drop-menu-item/snake-drop-menu-item.vue +181 -0
  51. package/components/snake-drop-menu-item/types.ts +48 -0
  52. package/components/snake-empty/snake-empty.vue +100 -0
  53. package/components/snake-empty/types.ts +48 -0
  54. package/components/snake-filter-sorts/filter-page.vue +695 -0
  55. package/components/snake-filter-sorts/snake-filter-sorts.vue +185 -0
  56. package/components/snake-filter-sorts/types.ts +57 -0
  57. package/components/snake-floating-bubble/snake-floating-bubble.vue +157 -0
  58. package/components/snake-floating-bubble/types.ts +43 -0
  59. package/components/snake-follow/snake-follow.vue +18 -0
  60. package/components/snake-follow/types.ts +2 -0
  61. package/components/snake-form/snake-form.vue +124 -0
  62. package/components/snake-form/types.ts +96 -0
  63. package/components/snake-form-item/snake-form-item.vue +331 -0
  64. package/components/snake-form-item/types.ts +70 -0
  65. package/components/snake-goods-list/snake-goods-list.vue +792 -0
  66. package/components/snake-goods-list/types.ts +55 -0
  67. package/components/snake-graphic-navigation/snake-graphic-navigation.vue +198 -0
  68. package/components/snake-graphic-navigation/types.ts +43 -0
  69. package/components/snake-icon/icon-names.ts +222 -0
  70. package/components/snake-icon/snake-icon.vue +220 -0
  71. package/components/snake-icon/types.ts +45 -0
  72. package/components/snake-image/snake-image.vue +230 -0
  73. package/components/snake-image/types.ts +70 -0
  74. package/components/snake-images/snake-images.vue +80 -0
  75. package/components/snake-images/types.ts +5 -0
  76. package/components/snake-index-anchor/snake-index-anchor.vue +83 -0
  77. package/components/snake-index-anchor/types.ts +14 -0
  78. package/components/snake-index-list/anchor-registry.ts +80 -0
  79. package/components/snake-index-list/snake-index-list.vue +259 -0
  80. package/components/snake-index-list/types.ts +115 -0
  81. package/components/snake-index-list-panel/snake-index-list-panel.vue +277 -0
  82. package/components/snake-index-list-panel/types.ts +10 -0
  83. package/components/snake-input/snake-input.vue +225 -0
  84. package/components/snake-input/types.ts +99 -0
  85. package/components/snake-jump-applet/snake-jump-applet.vue +99 -0
  86. package/components/snake-jump-applet/types.ts +17 -0
  87. package/components/snake-line/snake-line.vue +42 -0
  88. package/components/snake-line/types.ts +30 -0
  89. package/components/snake-line-progress/snake-line-progress.vue +105 -0
  90. package/components/snake-line-progress/types.ts +26 -0
  91. package/components/snake-link/snake-link.vue +74 -0
  92. package/components/snake-link/types.ts +30 -0
  93. package/components/snake-list-switching/components/tree-select/index.vue +156 -0
  94. package/components/snake-list-switching/snake-list-switching.vue +1285 -0
  95. package/components/snake-list-switching/types.ts +11 -0
  96. package/components/snake-loading/snake-loading.vue +241 -0
  97. package/components/snake-loading/types.ts +34 -0
  98. package/components/snake-loadmore/snake-loadmore.vue +103 -0
  99. package/components/snake-loadmore/types.ts +56 -0
  100. package/components/snake-magic-cube/snake-magic-cube.vue +622 -0
  101. package/components/snake-magic-cube/types.ts +5 -0
  102. package/components/snake-modal/snake-modal.vue +434 -0
  103. package/components/snake-modal/types.ts +71 -0
  104. package/components/snake-navbar/snake-navbar.vue +194 -0
  105. package/components/snake-navbar/types.ts +54 -0
  106. package/components/snake-no-network/snake-no-network.vue +125 -0
  107. package/components/snake-no-network/types.ts +27 -0
  108. package/components/snake-notice/snake-notice.vue +44 -0
  109. package/components/snake-notice/types.ts +5 -0
  110. package/components/snake-notice-bar/snake-notice-bar.vue +336 -0
  111. package/components/snake-notice-bar/types.ts +82 -0
  112. package/components/snake-overlay/snake-overlay.vue +73 -0
  113. package/components/snake-overlay/types.ts +35 -0
  114. package/components/snake-page-popup/snake-page-popup.vue +146 -0
  115. package/components/snake-page-popup/types.ts +28 -0
  116. package/components/snake-parse/audio/audio.vue +286 -0
  117. package/components/snake-parse/audio/context.js +11 -0
  118. package/components/snake-parse/audio/index.js +34 -0
  119. package/components/snake-parse/node/node.vue +830 -0
  120. package/components/snake-parse/parser.js +1480 -0
  121. package/components/snake-parse/snake-parse.vue +548 -0
  122. package/components/snake-parse/static/app-plus/snake-parse/js/handler.js +109 -0
  123. package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.js +0 -0
  124. package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.min.js +1 -0
  125. package/components/snake-parse/static/app-plus/snake-parse/local.html +3 -0
  126. package/components/snake-parse/style/index.js +132 -0
  127. package/components/snake-parse/style/parser.js +175 -0
  128. package/components/snake-parse/types.ts +49 -0
  129. package/components/snake-picture-ads/snake-picture-ads.vue +292 -0
  130. package/components/snake-picture-ads/types.ts +5 -0
  131. package/components/snake-popup/snake-popup.vue +348 -0
  132. package/components/snake-popup/types.ts +88 -0
  133. package/components/snake-qr-code/qrcode.ts +1214 -0
  134. package/components/snake-qr-code/snake-qr-code.vue +408 -0
  135. package/components/snake-qr-code/types.ts +78 -0
  136. package/components/snake-radio/snake-radio.vue +271 -0
  137. package/components/snake-radio/types.ts +64 -0
  138. package/components/snake-radio-group/snake-radio-group.vue +98 -0
  139. package/components/snake-radio-group/types.ts +48 -0
  140. package/components/snake-read-more/snake-read-more.vue +140 -0
  141. package/components/snake-read-more/types.ts +53 -0
  142. package/components/snake-rich-text/snake-rich-text.vue +24 -0
  143. package/components/snake-rich-text/types.ts +5 -0
  144. package/components/snake-root-portal/snake-root-portal.vue +92 -0
  145. package/components/snake-root-portal/types.ts +9 -0
  146. package/components/snake-search/snake-search.vue +202 -0
  147. package/components/snake-search/types.ts +84 -0
  148. package/components/snake-select/snake-select.vue +371 -0
  149. package/components/snake-select/types.ts +75 -0
  150. package/components/snake-skeleton/snake-skeleton.vue +104 -0
  151. package/components/snake-skeleton/types.ts +32 -0
  152. package/components/snake-skeleton-item/snake-skeleton-item.vue +90 -0
  153. package/components/snake-skeleton-item/types.ts +30 -0
  154. package/components/snake-slider/snake-slider.vue +249 -0
  155. package/components/snake-slider/types.ts +59 -0
  156. package/components/snake-sticky/snake-sticky.vue +178 -0
  157. package/components/snake-sticky/types.ts +48 -0
  158. package/components/snake-subsection/snake-subsection.vue +188 -0
  159. package/components/snake-subsection/types.ts +54 -0
  160. package/components/snake-swiper/snake-swiper.vue +229 -0
  161. package/components/snake-swiper/types.ts +79 -0
  162. package/components/snake-switch/snake-switch.vue +100 -0
  163. package/components/snake-switch/types.ts +41 -0
  164. package/components/snake-tabbar/snake-tabbar.vue +306 -0
  165. package/components/snake-tabbar/types.ts +93 -0
  166. package/components/snake-tabs/snake-tabs.vue +305 -0
  167. package/components/snake-tabs/types.ts +79 -0
  168. package/components/snake-text/snake-text.vue +292 -0
  169. package/components/snake-text/types.ts +100 -0
  170. package/components/snake-textarea/snake-textarea.vue +171 -0
  171. package/components/snake-textarea/types.ts +79 -0
  172. package/components/snake-toast/snake-toast.vue +330 -0
  173. package/components/snake-toast/types.ts +55 -0
  174. package/components/snake-tooltip/position.ts +33 -0
  175. package/components/snake-tooltip/snake-tooltip.vue +339 -0
  176. package/components/snake-tooltip/types.ts +80 -0
  177. package/components/snake-transition/snake-transition.vue +315 -0
  178. package/components/snake-transition/types.ts +65 -0
  179. package/components/snake-upload/snake-upload.vue +1801 -0
  180. package/components/snake-upload/types.ts +256 -0
  181. package/components/snake-videos/snake-videos.vue +122 -0
  182. package/components/snake-videos/types.ts +7 -0
  183. package/iconfont.css +881 -0
  184. package/index.d.ts +7 -0
  185. package/index.scss +26 -0
  186. package/index.ts +94 -0
  187. package/libs/cms/blocks.ts +103 -0
  188. package/libs/cms/config.ts +25 -0
  189. package/libs/cms/index.ts +7 -0
  190. package/libs/cms/normalize.ts +135 -0
  191. package/libs/cms/resolve.ts +12 -0
  192. package/libs/cms/types.ts +164 -0
  193. package/libs/cms/use-commerce.ts +385 -0
  194. package/libs/cms/v2.ts +193 -0
  195. package/libs/config/index.ts +4 -0
  196. package/libs/config/modal.ts +93 -0
  197. package/libs/config/state.ts +33 -0
  198. package/libs/config/theme.ts +351 -0
  199. package/libs/config/toast.ts +71 -0
  200. package/libs/config/types.ts +135 -0
  201. package/libs/config/zIndex.ts +44 -0
  202. package/libs/css/color.scss +105 -0
  203. package/libs/css/common.scss +171 -0
  204. package/libs/css/style.h5.scss +7 -0
  205. package/libs/css/style.mp.scss +7 -0
  206. package/libs/css/style.theme.scss +70 -0
  207. package/libs/css/style.vue.scss +140 -0
  208. package/libs/form/async-validator.min.d.ts +75 -0
  209. package/libs/form/async-validator.min.js +3 -0
  210. package/libs/form/index.ts +3 -0
  211. package/libs/form/path.ts +40 -0
  212. package/libs/form/types.ts +51 -0
  213. package/libs/form/validate.ts +149 -0
  214. package/libs/foundation.ts +96 -0
  215. package/libs/function/$parent.ts +33 -0
  216. package/libs/function/clipboard.ts +13 -0
  217. package/libs/function/color.ts +55 -0
  218. package/libs/function/debounce.ts +34 -0
  219. package/libs/function/deepClone.ts +30 -0
  220. package/libs/function/deepMerge.ts +25 -0
  221. package/libs/function/emitter.ts +30 -0
  222. package/libs/function/format.ts +27 -0
  223. package/libs/function/getParent.ts +53 -0
  224. package/libs/function/getRect.ts +29 -0
  225. package/libs/function/guid.ts +11 -0
  226. package/libs/function/index.ts +31 -0
  227. package/libs/function/queryParams.ts +73 -0
  228. package/libs/function/random.ts +6 -0
  229. package/libs/function/randomArray.ts +14 -0
  230. package/libs/function/route.ts +155 -0
  231. package/libs/function/sleep.ts +7 -0
  232. package/libs/function/style.ts +58 -0
  233. package/libs/function/styleUtils.ts +83 -0
  234. package/libs/function/system.ts +14 -0
  235. package/libs/function/test.ts +202 -0
  236. package/libs/function/throttle.ts +36 -0
  237. package/libs/function/timeFormat.ts +27 -0
  238. package/libs/function/timeFrom.ts +27 -0
  239. package/libs/function/toast.ts +10 -0
  240. package/libs/function/trim.ts +11 -0
  241. package/libs/function/type2icon.ts +11 -0
  242. package/libs/function/unit.ts +45 -0
  243. package/libs/hooks/index.ts +11 -0
  244. package/libs/hooks/useChildren.ts +125 -0
  245. package/libs/hooks/useColor.ts +5 -0
  246. package/libs/hooks/useDebounce.ts +5 -0
  247. package/libs/hooks/useLocale.ts +13 -0
  248. package/libs/hooks/useModal.ts +131 -0
  249. package/libs/hooks/useParent.ts +62 -0
  250. package/libs/hooks/useRect.ts +44 -0
  251. package/libs/hooks/useRouter.ts +5 -0
  252. package/libs/hooks/useTheme.ts +31 -0
  253. package/libs/hooks/useThrottle.ts +5 -0
  254. package/libs/hooks/useToast.ts +116 -0
  255. package/libs/index.ts +18 -0
  256. package/libs/request/auto-http.ts +1 -0
  257. package/libs/request/index.ts +343 -0
  258. package/libs/runtime/accessors.ts +55 -0
  259. package/libs/runtime/context.ts +40 -0
  260. package/libs/runtime/index.ts +18 -0
  261. package/libs/runtime/types.ts +49 -0
  262. package/libs/util/calendar.ts +6 -0
  263. package/locale/index.ts +130 -0
  264. package/locale/lang/en-US.ts +67 -0
  265. package/locale/lang/zh-CN.ts +67 -0
  266. package/package.json +130 -5
  267. package/plugins/index.ts +1 -0
  268. package/plugins/root/README.md +86 -0
  269. package/plugins/root/index.ts +123 -0
  270. package/plugins/root/page.ts +77 -0
  271. package/plugins/root/root.ts +53 -0
  272. package/plugins/root/utils.ts +137 -0
  273. package/readme.md +79 -0
  274. package/theme.scss +118 -0
  275. package/types/components.d.ts +236 -0
  276. package/types/global.d.ts +21 -0
  277. package/types/index.d.ts +6 -0
  278. package/types/uni-app.d.ts +16 -0
  279. package/README.md +0 -3
@@ -0,0 +1,315 @@
1
+ <template>
2
+ <view
3
+ v-if="rendered"
4
+ class="snake-transition"
5
+ :class="[customClass, phaseClass]"
6
+ :style="rootStyle"
7
+ @animationend="onAnimationEnd"
8
+ @click="emit('click', $event)"
9
+ >
10
+ <slot />
11
+ </view>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ /**
16
+ * @component Transition
17
+ * @description 跨端内容进出场动画,Overlay 和 Popup 均使用该组件。离场完成前节点会继续保留,因此不会出现弹层瞬间消失的问题。
18
+ * @see /components/transition
19
+ */
20
+
21
+ import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
22
+ import type { TransitionDuration, TransitionEmits, TransitionProps } from './types';
23
+
24
+ defineOptions({ name: 'Transition', options: { virtualHost: true, styleIsolation: 'shared' } });
25
+
26
+ const props = withDefaults(defineProps<TransitionProps>(), {
27
+ show: true,
28
+ name: 'fade',
29
+ duration: 300,
30
+ timingFunction: 'cubic-bezier(0.2, 0.8, 0.2, 1)',
31
+ delay: 0,
32
+ appear: false,
33
+ customClass: '',
34
+ customStyle: ''
35
+ });
36
+ const emit = defineEmits<TransitionEmits>();
37
+
38
+ type Phase = 'enter' | 'leave' | '';
39
+ const rendered = ref(props.show);
40
+ const phase = ref<Phase>('');
41
+ const initialized = ref(false);
42
+ let fallbackTimer: ReturnType<typeof setTimeout> | undefined;
43
+
44
+ const durations = computed(() => {
45
+ if (typeof props.duration === 'number') return { enter: props.duration, leave: props.duration };
46
+ const value = props.duration as TransitionDuration;
47
+ return { enter: value.enter ?? 300, leave: value.leave ?? value.enter ?? 300 };
48
+ });
49
+ const currentDuration = computed(() => (phase.value === 'leave' ? durations.value.leave : durations.value.enter));
50
+ const rootStyle = computed(() => [
51
+ {
52
+ animationDuration: `${currentDuration.value}ms`,
53
+ animationDelay: `${props.delay}ms`,
54
+ animationTimingFunction: props.timingFunction
55
+ },
56
+ props.customStyle
57
+ ]);
58
+ const phaseClass = computed(() => (phase.value ? `snake-transition--${props.name}-${phase.value}` : ''));
59
+
60
+ function clearFallback() {
61
+ if (fallbackTimer) clearTimeout(fallbackTimer);
62
+ fallbackTimer = undefined;
63
+ }
64
+
65
+ function complete(expected: Exclude<Phase, ''>) {
66
+ if (phase.value !== expected) return;
67
+ clearFallback();
68
+ phase.value = '';
69
+ if (expected === 'enter') emit('after-enter');
70
+ else {
71
+ rendered.value = false;
72
+ emit('after-leave');
73
+ }
74
+ }
75
+
76
+ function scheduleFallback(expected: Exclude<Phase, ''>) {
77
+ clearFallback();
78
+ fallbackTimer = setTimeout(() => complete(expected), currentDuration.value + props.delay + 50);
79
+ }
80
+
81
+ async function startEnter() {
82
+ if (phase.value === 'leave') emit('leave-cancelled');
83
+ else if (phase.value === 'enter') return;
84
+ rendered.value = true;
85
+ phase.value = '';
86
+ emit('before-enter');
87
+ await nextTick();
88
+ phase.value = 'enter';
89
+ emit('enter');
90
+ scheduleFallback('enter');
91
+ }
92
+
93
+ function startLeave() {
94
+ if (!rendered.value) return;
95
+ if (phase.value === 'enter') emit('enter-cancelled');
96
+ else if (phase.value === 'leave') return;
97
+ emit('before-leave');
98
+ phase.value = 'leave';
99
+ emit('leave');
100
+ scheduleFallback('leave');
101
+ }
102
+
103
+ function onAnimationEnd() {
104
+ if (phase.value) complete(phase.value);
105
+ }
106
+
107
+ watch(
108
+ () => props.show,
109
+ show => {
110
+ if (!initialized.value) {
111
+ initialized.value = true;
112
+ rendered.value = show;
113
+ if (show && props.appear) void startEnter();
114
+ return;
115
+ }
116
+ if (show) void startEnter();
117
+ else startLeave();
118
+ },
119
+ { immediate: true }
120
+ );
121
+
122
+ onBeforeUnmount(clearFallback);
123
+ </script>
124
+
125
+ <style scoped lang="scss">
126
+ .snake-transition {
127
+ animation-fill-mode: both;
128
+ }
129
+ .snake-transition--fade-enter {
130
+ animation-name: snake-fade-in;
131
+ }
132
+ .snake-transition--fade-leave {
133
+ animation-name: snake-fade-out;
134
+ }
135
+ .snake-transition--fade-up-enter,
136
+ .snake-transition--slide-up-enter {
137
+ animation-name: snake-up-in;
138
+ }
139
+ .snake-transition--fade-up-leave,
140
+ .snake-transition--slide-up-leave {
141
+ animation-name: snake-up-out;
142
+ }
143
+ .snake-transition--fade-down-enter,
144
+ .snake-transition--slide-down-enter {
145
+ animation-name: snake-down-in;
146
+ }
147
+ .snake-transition--fade-down-leave,
148
+ .snake-transition--slide-down-leave {
149
+ animation-name: snake-down-out;
150
+ }
151
+ .snake-transition--fade-left-enter,
152
+ .snake-transition--slide-left-enter {
153
+ animation-name: snake-left-in;
154
+ }
155
+ .snake-transition--fade-left-leave,
156
+ .snake-transition--slide-left-leave {
157
+ animation-name: snake-left-out;
158
+ }
159
+ .snake-transition--fade-right-enter,
160
+ .snake-transition--slide-right-enter {
161
+ animation-name: snake-right-in;
162
+ }
163
+ .snake-transition--fade-right-leave,
164
+ .snake-transition--slide-right-leave {
165
+ animation-name: snake-right-out;
166
+ }
167
+ .snake-transition--zoom-in-enter {
168
+ animation-name: snake-zoom-in;
169
+ }
170
+ .snake-transition--zoom-in-leave {
171
+ animation-name: snake-zoom-in-out;
172
+ }
173
+ .snake-transition--zoom-out-enter {
174
+ animation-name: snake-zoom-out;
175
+ }
176
+ .snake-transition--zoom-out-leave {
177
+ animation-name: snake-zoom-out-out;
178
+ }
179
+ @keyframes snake-fade-in {
180
+ from {
181
+ opacity: 0;
182
+ }
183
+ to {
184
+ opacity: 1;
185
+ }
186
+ }
187
+ @keyframes snake-fade-out {
188
+ from {
189
+ opacity: 1;
190
+ }
191
+ to {
192
+ opacity: 0;
193
+ }
194
+ }
195
+ @keyframes snake-up-in {
196
+ from {
197
+ opacity: 0;
198
+ transform: translate3d(0, 40rpx, 0);
199
+ }
200
+ to {
201
+ opacity: 1;
202
+ transform: none;
203
+ }
204
+ }
205
+ @keyframes snake-up-out {
206
+ from {
207
+ opacity: 1;
208
+ transform: none;
209
+ }
210
+ to {
211
+ opacity: 0;
212
+ transform: translate3d(0, 40rpx, 0);
213
+ }
214
+ }
215
+ @keyframes snake-down-in {
216
+ from {
217
+ opacity: 0;
218
+ transform: translate3d(0, -40rpx, 0);
219
+ }
220
+ to {
221
+ opacity: 1;
222
+ transform: none;
223
+ }
224
+ }
225
+ @keyframes snake-down-out {
226
+ from {
227
+ opacity: 1;
228
+ transform: none;
229
+ }
230
+ to {
231
+ opacity: 0;
232
+ transform: translate3d(0, -40rpx, 0);
233
+ }
234
+ }
235
+ @keyframes snake-left-in {
236
+ from {
237
+ opacity: 0;
238
+ transform: translate3d(40rpx, 0, 0);
239
+ }
240
+ to {
241
+ opacity: 1;
242
+ transform: none;
243
+ }
244
+ }
245
+ @keyframes snake-left-out {
246
+ from {
247
+ opacity: 1;
248
+ transform: none;
249
+ }
250
+ to {
251
+ opacity: 0;
252
+ transform: translate3d(40rpx, 0, 0);
253
+ }
254
+ }
255
+ @keyframes snake-right-in {
256
+ from {
257
+ opacity: 0;
258
+ transform: translate3d(-40rpx, 0, 0);
259
+ }
260
+ to {
261
+ opacity: 1;
262
+ transform: none;
263
+ }
264
+ }
265
+ @keyframes snake-right-out {
266
+ from {
267
+ opacity: 1;
268
+ transform: none;
269
+ }
270
+ to {
271
+ opacity: 0;
272
+ transform: translate3d(-40rpx, 0, 0);
273
+ }
274
+ }
275
+ @keyframes snake-zoom-in {
276
+ from {
277
+ opacity: 0;
278
+ transform: scale(0.85);
279
+ }
280
+ to {
281
+ opacity: 1;
282
+ transform: scale(1);
283
+ }
284
+ }
285
+ @keyframes snake-zoom-in-out {
286
+ from {
287
+ opacity: 1;
288
+ transform: scale(1);
289
+ }
290
+ to {
291
+ opacity: 0;
292
+ transform: scale(0.85);
293
+ }
294
+ }
295
+ @keyframes snake-zoom-out {
296
+ from {
297
+ opacity: 0;
298
+ transform: scale(1.1);
299
+ }
300
+ to {
301
+ opacity: 1;
302
+ transform: scale(1);
303
+ }
304
+ }
305
+ @keyframes snake-zoom-out-out {
306
+ from {
307
+ opacity: 1;
308
+ transform: scale(1);
309
+ }
310
+ to {
311
+ opacity: 0;
312
+ transform: scale(1.1);
313
+ }
314
+ }
315
+ </style>
@@ -0,0 +1,65 @@
1
+ import type { StyleValue } from '../../types/global';
2
+
3
+ /** TransitionPreset 类型定义。 */
4
+ export type TransitionPreset =
5
+ | 'fade'
6
+ | 'fade-up'
7
+ | 'fade-down'
8
+ | 'fade-left'
9
+ | 'fade-right'
10
+ | 'slide-up'
11
+ | 'slide-down'
12
+ | 'slide-left'
13
+ | 'slide-right'
14
+ | 'zoom-in'
15
+ | 'zoom-out';
16
+
17
+ /** TransitionDuration 类型定义。 */
18
+ export interface TransitionDuration {
19
+ /** enter 配置。 */
20
+ enter?: number;
21
+ /** leave 配置。 */
22
+ leave?: number;
23
+ }
24
+
25
+ /** Transition 组件的公开属性。 */
26
+ export interface TransitionProps {
27
+ /** 是否显示组件。 */
28
+ show?: boolean;
29
+ /** 数据项名称或唯一标识。 */
30
+ name?: TransitionPreset;
31
+ /** 动画持续时间。 */
32
+ duration?: number | TransitionDuration;
33
+ /** 动画缓动函数。 */
34
+ timingFunction?: string;
35
+ /** delay 配置。 */
36
+ delay?: number;
37
+ /** appear 配置。 */
38
+ appear?: boolean;
39
+ /** 根节点自定义类名。 */
40
+ customClass?: string;
41
+ /** 根节点自定义样式。 */
42
+ customStyle?: StyleValue;
43
+ }
44
+
45
+ /** Transition 组件的事件契约。 */
46
+ export type TransitionEmits = {
47
+ /** before-enter 事件携带的参数。 */
48
+ 'before-enter': [];
49
+ /** enter 事件携带的参数。 */
50
+ enter: [];
51
+ /** after-enter 事件携带的参数。 */
52
+ 'after-enter': [];
53
+ /** enter-cancelled 事件携带的参数。 */
54
+ 'enter-cancelled': [];
55
+ /** before-leave 事件携带的参数。 */
56
+ 'before-leave': [];
57
+ /** leave 事件携带的参数。 */
58
+ leave: [];
59
+ /** after-leave 事件携带的参数。 */
60
+ 'after-leave': [];
61
+ /** leave-cancelled 事件携带的参数。 */
62
+ 'leave-cancelled': [];
63
+ /** click 事件携带的参数。 */
64
+ click: [event: unknown];
65
+ };