@noction/vue-bezier 1.0.5 → 1.0.6

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 (47) hide show
  1. package/README.md +1 -2
  2. package/dist/vue-bezier.js +422 -0
  3. package/dist/web-types.json +551 -1
  4. package/package.json +28 -19
  5. package/src/components/Collapse/CollapseTransition.vue +19 -14
  6. package/src/components/Fade/FadeTransition.vue +19 -19
  7. package/src/components/Scale/ScaleTransition.vue +18 -33
  8. package/src/components/Slide/SlideXLeftTransition.vue +18 -29
  9. package/src/components/Slide/SlideXRightTransition.vue +18 -31
  10. package/src/components/Slide/SlideYDownTransition.vue +18 -31
  11. package/src/components/Slide/SlideYUpTransition.vue +18 -31
  12. package/src/components/Zoom/ZoomCenterTransition.vue +18 -19
  13. package/src/components/Zoom/ZoomUpTransition.vue +19 -31
  14. package/src/components/Zoom/ZoomXTransition.vue +18 -29
  15. package/src/components/Zoom/ZoomYTransition.vue +17 -30
  16. package/src/{composable → composables}/buildComponentType.ts +2 -1
  17. package/src/composables/index.ts +4 -0
  18. package/src/composables/useHooks.ts +110 -0
  19. package/src/main.ts +48 -0
  20. package/src/types/index.ts +53 -0
  21. package/dist/Collapse/CollapseTransition.vue.d.ts +0 -14
  22. package/dist/Fade/FadeTransition.vue.d.ts +0 -13
  23. package/dist/Scale/ScaleTransition.vue.d.ts +0 -26
  24. package/dist/Slide/SlideXLeftTransition.vue.d.ts +0 -22
  25. package/dist/Slide/SlideXRightTransition.vue.d.ts +0 -22
  26. package/dist/Slide/SlideYDownTransition.vue.d.ts +0 -22
  27. package/dist/Slide/SlideYUpTransition.vue.d.ts +0 -22
  28. package/dist/Zoom/ZoomCenterTransition.vue.d.ts +0 -13
  29. package/dist/Zoom/ZoomUpTransition.vue.d.ts +0 -22
  30. package/dist/Zoom/ZoomXTransition.vue.d.ts +0 -22
  31. package/dist/Zoom/ZoomYTransition.vue.d.ts +0 -22
  32. package/dist/composable/buildComponentType.d.ts +0 -3
  33. package/dist/composable/buildEmits.d.ts +0 -2
  34. package/dist/composable/buildHooks.d.ts +0 -7
  35. package/dist/composable/buildProps.d.ts +0 -48
  36. package/dist/composable/buildTag.d.ts +0 -2
  37. package/dist/composable/index.d.ts +0 -6
  38. package/dist/index.d.ts +0 -17
  39. package/dist/vue-bezier.mjs +0 -456
  40. package/dist/vue-bezier.umd.js +0 -1
  41. package/src/composable/buildEmits.ts +0 -7
  42. package/src/composable/buildHooks.ts +0 -92
  43. package/src/composable/buildProps.ts +0 -52
  44. package/src/composable/buildTag.ts +0 -1
  45. package/src/composable/index.ts +0 -7
  46. package/src/global-shim.d.ts +0 -1
  47. package/src/index.ts +0 -62
package/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/@noction/vue-bezier.svg?style=flat)](https://npmjs.com/package/@noction/vue-bezier)
4
4
  [![NPM downloads](https://img.shields.io/npm/dm/@noction/vue-bezier.svg?style=flat)](https://npmjs.com/package/@noction/vue-bezier)
5
- [![codecov](https://codecov.io/gh/50rayn/@noction/vue-bezier/branch/master/graph/badge.svg?token=IJ9ZDYJ65Z)](https://codecov.io/gh/50rayn/@noction/vue-bezier)
6
- [![Featured on Openbase](https://badges.openbase.com/js/featured/@noction/vue-bezier.svg?token=hU9KYWV7h9YbmSVPtFbArzNxlWR8XfEc1pJhzSaLTp8=)](https://openbase.com/js/@noction/vue-bezier?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
5
+ [![codecov](https://codecov.io/gh/Noction/vue-bezier/branch/master/graph/badge.svg?token=IJ9ZDYJ65Z)](https://codecov.io/gh/Noction/vue-bezier)
7
6
 
8
7
  ## [Demo](https://noction.github.io/vue-bezier)
9
8
 
@@ -0,0 +1,422 @@
1
+ import { TransitionGroup as z, Transition as D, defineComponent as d, openBlock as f, createBlock as u, resolveDynamicComponent as c, unref as r, mergeProps as m, withCtx as p, renderSlot as g } from "vue";
2
+ const v = (a) => a.group ? z : D;
3
+ function b(a, o) {
4
+ return typeof a == "number" ? a : typeof a == "object" && a !== null ? a[o] ?? 0 : 0;
5
+ }
6
+ function w(a, o) {
7
+ const t = b(a.duration, "enter"), n = b(a.delay, "enter");
8
+ o.style.animationDuration = `${t}ms`, o.style.animationDelay = `${n}ms`, T(a, o);
9
+ }
10
+ function A(a, o) {
11
+ const t = b(a.duration, "leave"), n = b(a.delay, "leave");
12
+ o.style.animationDuration = `${t}ms`, o.style.animationDelay = `${n}ms`, T(a, o);
13
+ }
14
+ function $(a, o, t) {
15
+ B(a, o);
16
+ const n = b(a.duration, "leave"), i = b(a.delay, "leave");
17
+ setTimeout(t, n + i);
18
+ }
19
+ function _(a, o) {
20
+ a.styles && Object.entries(a.styles).forEach(([t]) => {
21
+ t in o.style && (o.style[t] = "");
22
+ }), o.style.animationDuration = "", o.style.animationDelay = "";
23
+ }
24
+ function T(a, o) {
25
+ S(a, o), a.styles && Object.entries(a.styles).forEach(([t, n]) => {
26
+ t in o.style && (o.style[t] = n);
27
+ });
28
+ }
29
+ function B(a, o) {
30
+ a.group && (o.style.position = "absolute");
31
+ }
32
+ function S(a, o) {
33
+ a.origin && (o.style.transformOrigin = a.origin);
34
+ }
35
+ const y = (a, o) => ({
36
+ onAfterEnter: (t) => {
37
+ _(a, t), o("after-enter", t);
38
+ },
39
+ onAfterLeave: (t) => {
40
+ _(a, t), o("after-leave", t);
41
+ },
42
+ onBeforeEnter: (t) => {
43
+ w(a, t), o("before-enter", t);
44
+ },
45
+ onBeforeLeave: (t) => {
46
+ A(a, t), o("before-leave", t);
47
+ },
48
+ onLeave: (t, n) => {
49
+ $(a, t, n), o("leave", t, n);
50
+ }
51
+ }), k = /* @__PURE__ */ d({
52
+ __name: "CollapseTransition",
53
+ props: {
54
+ delay: { default: 0 },
55
+ duration: { default: 300 },
56
+ group: { type: Boolean, default: !1 },
57
+ origin: { default: "" },
58
+ styles: { default: () => ({
59
+ animationFillMode: "both",
60
+ animationTimingFunction: "ease-out"
61
+ }) },
62
+ tag: { default: "span" }
63
+ },
64
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
65
+ setup(a, { emit: o }) {
66
+ const t = a, n = o, i = v(t), l = {
67
+ onAfterEnter(e) {
68
+ e.style.transition = "", e.style.height = "", e.style.overflow = e.dataset.oldOverflow, n("after-enter", e);
69
+ },
70
+ onAfterLeave(e) {
71
+ e.style.transition = "", e.style.height = "", e.style.overflow = e.dataset.oldOverflow, e.style.paddingTop = e.dataset.oldPaddingTop, e.style.paddingBottom = e.dataset.oldPaddingBottom, n("after-leave", e);
72
+ },
73
+ onBeforeEnter(e) {
74
+ const h = b(t.duration, "enter");
75
+ e.style.transition = s(h), e.dataset || (e.dataset = {}), e.dataset.oldPaddingTop = e.style.paddingTop, e.dataset.oldPaddingBottom = e.style.paddingBottom, e.style.height = "0", e.style.paddingTop = 0, e.style.paddingBottom = 0, T(t, e), n("before-enter", e);
76
+ },
77
+ onBeforeLeave(e) {
78
+ e.dataset || (e.dataset = {}), e.dataset.oldPaddingTop = e.style.paddingTop, e.dataset.oldPaddingBottom = e.style.paddingBottom, e.dataset.oldOverflow = e.style.overflow, e.style.height = `${e.scrollHeight}px`, e.style.overflow = "hidden", T(t, e), n("before-leave", e);
79
+ },
80
+ onEnter(e) {
81
+ e.dataset.oldOverflow = e.style.overflow, e.scrollHeight !== 0 ? (e.style.height = `${e.scrollHeight}px`, e.style.paddingTop = e.dataset.oldPaddingTop, e.style.paddingBottom = e.dataset.oldPaddingBottom) : (e.style.height = "", e.style.paddingTop = e.dataset.oldPaddingTop, e.style.paddingBottom = e.dataset.oldPaddingBottom), e.style.overflow = "hidden";
82
+ },
83
+ onLeave(e, h) {
84
+ const F = b(t.duration, "leave");
85
+ e.scrollHeight !== 0 && (e.style.transition = s(F), e.style.height = 0, e.style.paddingTop = 0, e.style.paddingBottom = 0), B(t, e), $(t, e, h), n("leave", e, h);
86
+ }
87
+ }, s = (e) => {
88
+ const h = e / 1e3;
89
+ return `${h}s height ease-in-out, ${h}s padding-top ease-in-out, ${h}s padding-bottom ease-in-out`;
90
+ };
91
+ return (e, h) => (f(), u(c(r(i)), m({
92
+ tag: t.tag
93
+ }, { ...e.$attrs, ...l }, { "move-class": "collapse-move" }), {
94
+ default: p(() => [
95
+ g(e.$slots, "default")
96
+ ]),
97
+ _: 3
98
+ }, 16, ["tag"]));
99
+ }
100
+ }), P = /* @__PURE__ */ d({
101
+ inheritAttrs: !1,
102
+ __name: "FadeTransition",
103
+ props: {
104
+ delay: { default: 0 },
105
+ duration: { default: 300 },
106
+ group: { type: Boolean, default: !1 },
107
+ origin: { default: "" },
108
+ styles: { default: () => ({
109
+ animationFillMode: "both",
110
+ animationTimingFunction: "ease-out"
111
+ }) },
112
+ tag: { default: "span" }
113
+ },
114
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
115
+ setup(a, { emit: o }) {
116
+ const t = a, n = o, i = v(t), l = y(t, n);
117
+ return (s, e) => (f(), u(c(r(i)), m({
118
+ tag: t.tag,
119
+ "enter-active-class": "fade-in",
120
+ "move-class": "fade-move",
121
+ "leave-active-class": "fade-out"
122
+ }, { ...s.$attrs, ...r(l) }), {
123
+ default: p(() => [
124
+ g(s.$slots, "default")
125
+ ]),
126
+ _: 3
127
+ }, 16, ["tag"]));
128
+ }
129
+ }), M = /* @__PURE__ */ d({
130
+ inheritAttrs: !1,
131
+ __name: "ScaleTransition",
132
+ props: {
133
+ delay: { default: 0 },
134
+ duration: { default: 300 },
135
+ group: { type: Boolean, default: !1 },
136
+ origin: { default: "top left" },
137
+ styles: { default: () => ({
138
+ animationFillMode: "both",
139
+ animationTimingFunction: "cubic-bezier(.25,.8,.50,1)"
140
+ }) },
141
+ tag: { default: "span" }
142
+ },
143
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
144
+ setup(a, { emit: o }) {
145
+ const t = a, n = o, i = v(t), l = y(t, n);
146
+ return (s, e) => (f(), u(c(r(i)), m({
147
+ tag: t.tag
148
+ }, { ...s.$attrs, ...r(l) }, {
149
+ "enter-active-class": "scale-in",
150
+ "move-class": "scale-move",
151
+ "leave-active-class": "scale-out"
152
+ }), {
153
+ default: p(() => [
154
+ g(s.$slots, "default")
155
+ ]),
156
+ _: 3
157
+ }, 16, ["tag"]));
158
+ }
159
+ }), E = /* @__PURE__ */ d({
160
+ inheritAttrs: !1,
161
+ __name: "SlideXLeftTransition",
162
+ props: {
163
+ delay: { default: 0 },
164
+ duration: { default: 300 },
165
+ group: { type: Boolean, default: !1 },
166
+ origin: { default: "" },
167
+ styles: { default: () => ({
168
+ animationFillMode: "both",
169
+ animationTimingFunction: "cubic-bezier(.25,.8,.50,1)"
170
+ }) },
171
+ tag: { default: "span" }
172
+ },
173
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
174
+ setup(a, { emit: o }) {
175
+ const t = a, n = o, i = v(t), l = y(t, n);
176
+ return (s, e) => (f(), u(c(r(i)), m({
177
+ tag: t.tag
178
+ }, { ...s.$attrs, ...r(l) }, {
179
+ "enter-active-class": "slide-x-left-in",
180
+ "move-class": "slide-move",
181
+ "leave-active-class": "slide-x-left-out"
182
+ }), {
183
+ default: p(() => [
184
+ g(s.$slots, "default")
185
+ ]),
186
+ _: 3
187
+ }, 16, ["tag"]));
188
+ }
189
+ }), L = /* @__PURE__ */ d({
190
+ inheritAttrs: !1,
191
+ __name: "SlideXRightTransition",
192
+ props: {
193
+ delay: { default: 0 },
194
+ duration: { default: 300 },
195
+ group: { type: Boolean, default: !1 },
196
+ origin: { default: "" },
197
+ styles: { default: () => ({
198
+ animationFillMode: "both",
199
+ animationTimingFunction: "cubic-bezier(.25,.8,.50,1)"
200
+ }) },
201
+ tag: { default: "span" }
202
+ },
203
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
204
+ setup(a, { emit: o }) {
205
+ const t = a, n = o, i = v(t), l = y(t, n);
206
+ return (s, e) => (f(), u(c(r(i)), m({
207
+ tag: t.tag
208
+ }, { ...s.$attrs, ...r(l) }, {
209
+ "enter-active-class": "slide-x-right-in",
210
+ "move-class": "slide-move",
211
+ "leave-active-class": "slide-x-right-out"
212
+ }), {
213
+ default: p(() => [
214
+ g(s.$slots, "default")
215
+ ]),
216
+ _: 3
217
+ }, 16, ["tag"]));
218
+ }
219
+ }), O = /* @__PURE__ */ d({
220
+ inheritAttrs: !1,
221
+ __name: "SlideYDownTransition",
222
+ props: {
223
+ delay: { default: 0 },
224
+ duration: { default: 300 },
225
+ group: { type: Boolean, default: !1 },
226
+ origin: { default: "" },
227
+ styles: { default: () => ({
228
+ animationFillMode: "both",
229
+ animationTimingFunction: "cubic-bezier(.25,.8,.50,1)"
230
+ }) },
231
+ tag: { default: "span" }
232
+ },
233
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
234
+ setup(a, { emit: o }) {
235
+ const t = a, n = o, i = v(t), l = y(t, n);
236
+ return (s, e) => (f(), u(c(r(i)), m({
237
+ tag: t.tag
238
+ }, { ...s.$attrs, ...r(l) }, {
239
+ "enter-active-class": "slide-y-down-in",
240
+ "leave-active-class": "slide-y-down-out"
241
+ }), {
242
+ default: p(() => [
243
+ g(s.$slots, "default")
244
+ ]),
245
+ _: 3
246
+ }, 16, ["tag"]));
247
+ }
248
+ }), C = /* @__PURE__ */ d({
249
+ inheritAttrs: !1,
250
+ __name: "SlideYUpTransition",
251
+ props: {
252
+ delay: { default: 0 },
253
+ duration: { default: 300 },
254
+ group: { type: Boolean, default: !1 },
255
+ origin: { default: "" },
256
+ styles: { default: () => ({
257
+ animationFillMode: "both",
258
+ animationTimingFunction: "cubic-bezier(.25,.8,.50,1)"
259
+ }) },
260
+ tag: { default: "span" }
261
+ },
262
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
263
+ setup(a, { emit: o }) {
264
+ const t = a, n = o, i = v(t), l = y(t, n);
265
+ return (s, e) => (f(), u(c(r(i)), m({
266
+ tag: t.tag,
267
+ type: "animation"
268
+ }, { ...s.$attrs, ...r(l) }, {
269
+ "enter-active-class": "slide-y-in",
270
+ "move-class": "slide-move",
271
+ "leave-active-class": "slide-y-out"
272
+ }), {
273
+ default: p(() => [
274
+ g(s.$slots, "default")
275
+ ]),
276
+ _: 3
277
+ }, 16, ["tag"]));
278
+ }
279
+ }), Z = /* @__PURE__ */ d({
280
+ inheritAttrs: !1,
281
+ __name: "ZoomCenterTransition",
282
+ props: {
283
+ delay: { default: 0 },
284
+ duration: { default: 300 },
285
+ group: { type: Boolean, default: !1 },
286
+ origin: { default: "" },
287
+ styles: { default: () => ({
288
+ animationFillMode: "both",
289
+ animationTimingFunction: "ease-out"
290
+ }) },
291
+ tag: { default: "span" }
292
+ },
293
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
294
+ setup(a, { emit: o }) {
295
+ const t = a, n = o, i = v(t), l = y(t, n);
296
+ return (s, e) => (f(), u(c(r(i)), m({
297
+ tag: t.tag
298
+ }, { ...s.$attrs, ...r(l) }, {
299
+ "enter-active-class": "zoom-in",
300
+ "move-class": "zoom-move",
301
+ "leave-active-class": "zoom-out"
302
+ }), {
303
+ default: p(() => [
304
+ g(s.$slots, "default")
305
+ ]),
306
+ _: 3
307
+ }, 16, ["tag"]));
308
+ }
309
+ }), X = /* @__PURE__ */ d({
310
+ inheritAttrs: !1,
311
+ __name: "ZoomUpTransition",
312
+ props: {
313
+ delay: { default: 0 },
314
+ duration: { default: 300 },
315
+ group: { type: Boolean, default: !1 },
316
+ origin: { default: "" },
317
+ styles: { default: () => ({
318
+ animationFillMode: "both",
319
+ animationTimingFunction: "ease-out"
320
+ }) },
321
+ tag: { default: "span" }
322
+ },
323
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
324
+ setup(a, { emit: o }) {
325
+ const t = a, n = o, i = v(t), l = y(t, n);
326
+ return (s, e) => (f(), u(c(r(i)), m({
327
+ tag: t.tag
328
+ }, { ...s.$attrs, ...r(l) }, {
329
+ "enter-active-class": "zoom-in-up",
330
+ "move-class": "zoom-move",
331
+ "leave-active-class": "zoom-out-up"
332
+ }), {
333
+ default: p(() => [
334
+ g(s.$slots, "default")
335
+ ]),
336
+ _: 3
337
+ }, 16, ["tag"]));
338
+ }
339
+ }), Y = /* @__PURE__ */ d({
340
+ inheritAttrs: !1,
341
+ __name: "ZoomXTransition",
342
+ props: {
343
+ delay: { default: 0 },
344
+ duration: { default: 300 },
345
+ group: { type: Boolean, default: !1 },
346
+ origin: { default: "" },
347
+ styles: { default: () => ({
348
+ animationFillMode: "both",
349
+ animationTimingFunction: "cubic-bezier(.55,0,.1,1)"
350
+ }) },
351
+ tag: { default: "span" }
352
+ },
353
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
354
+ setup(a, { emit: o }) {
355
+ const t = a, n = o, i = v(t), l = y(t, n);
356
+ return (s, e) => (f(), u(c(r(i)), m({
357
+ tag: t.tag,
358
+ "enter-active-class": "zoom-in-x",
359
+ "move-class": "zoom-move",
360
+ "leave-active-class": "zoom-out-x"
361
+ }, { ...s.$attrs, ...r(l) }), {
362
+ default: p(() => [
363
+ g(s.$slots, "default")
364
+ ]),
365
+ _: 3
366
+ }, 16, ["tag"]));
367
+ }
368
+ }), H = /* @__PURE__ */ d({
369
+ inheritAttrs: !1,
370
+ __name: "ZoomYTransition",
371
+ props: {
372
+ delay: { default: 0 },
373
+ duration: { default: 300 },
374
+ group: { type: Boolean, default: !1 },
375
+ origin: { default: "" },
376
+ styles: { default: () => ({
377
+ animationFillMode: "both",
378
+ animationTimingFunction: "cubic-bezier(.55,0,.1,1)"
379
+ }) },
380
+ tag: { default: "span" }
381
+ },
382
+ emits: ["after-enter", "after-leave", "before-enter", "before-leave", "leave"],
383
+ setup(a, { emit: o }) {
384
+ const t = a, n = o, i = v(t), l = y(t, n);
385
+ return (s, e) => (f(), u(c(r(i)), m({
386
+ tag: t.tag,
387
+ "enter-active-class": "zoom-in-y",
388
+ "move-class": "zoom-move",
389
+ "leave-active-class": "zoom-out-y"
390
+ }, { ...s.$attrs, ...r(l) }), {
391
+ default: p(() => [
392
+ g(s.$slots, "default")
393
+ ]),
394
+ _: 3
395
+ }, 16, ["tag"]));
396
+ }
397
+ }), U = {
398
+ CollapseTransition: k,
399
+ FadeTransition: P,
400
+ ScaleTransition: M,
401
+ SlideXLeftTransition: E,
402
+ SlideXRightTransition: L,
403
+ SlideYDownTransition: O,
404
+ SlideYUpTransition: C,
405
+ ZoomCenterTransition: Z,
406
+ ZoomUpTransition: X,
407
+ ZoomXTransition: Y,
408
+ ZoomYTransition: H
409
+ };
410
+ function j(a) {
411
+ a.$_vueBezierInstalled || (a.$_vueBezierInstalled = !0, Object.entries(U).forEach(
412
+ ([o, t]) => a.component(o, t)
413
+ ));
414
+ }
415
+ const R = {
416
+ install: j
417
+ };
418
+ export {
419
+ U as components,
420
+ R as default,
421
+ j as install
422
+ };