btt-ui 1.0.25 → 1.0.34

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 (35) hide show
  1. package/es/index.mjs +54 -48
  2. package/es/src/checkbox/index.mjs +6 -6
  3. package/es/src/countUp/index.mjs +7 -0
  4. package/es/src/countUp/src/countUp.mjs +48 -0
  5. package/es/src/countUp/src/index.mjs +103 -0
  6. package/es/src/countUp/src/style/index.css +6 -0
  7. package/es/src/directives/bubble.mjs +25 -20
  8. package/es/src/gradientText/index.mjs +7 -0
  9. package/es/src/gradientText/src/style/index.css +9 -0
  10. package/es/src/gradientText/src/text.mjs +24 -0
  11. package/es/src/index.mjs +90 -81
  12. package/es/src/numberScroll/index.mjs +7 -0
  13. package/es/src/numberScroll/src/index.mjs +59 -0
  14. package/es/src/numberScroll/src/number.mjs +42 -0
  15. package/es/src/numberScroll/src/style/index.css +32 -0
  16. package/es/src/wheel/wheel.mjs +10 -10
  17. package/es/src/xgplay/src/style/index.css +0 -2
  18. package/lib/index.js +1 -1
  19. package/lib/src/checkbox/index.js +1 -1
  20. package/lib/src/countUp/index.js +1 -0
  21. package/lib/src/countUp/src/countUp.js +1 -0
  22. package/lib/src/countUp/src/index.js +1 -0
  23. package/lib/src/countUp/src/style/index.css +6 -0
  24. package/lib/src/directives/bubble.js +1 -1
  25. package/lib/src/gradientText/index.js +1 -0
  26. package/lib/src/gradientText/src/style/index.css +9 -0
  27. package/lib/src/gradientText/src/text.js +1 -0
  28. package/lib/src/index.js +1 -1
  29. package/lib/src/numberScroll/index.js +1 -0
  30. package/lib/src/numberScroll/src/index.js +14 -0
  31. package/lib/src/numberScroll/src/number.js +1 -0
  32. package/lib/src/numberScroll/src/style/index.css +32 -0
  33. package/lib/src/wheel/wheel.js +1 -1
  34. package/lib/src/xgplay/src/style/index.css +0 -2
  35. package/package.json +2 -2
package/es/index.mjs CHANGED
@@ -1,83 +1,89 @@
1
- import l from "./src/index.mjs";
1
+ import p from "./src/index.mjs";
2
2
  import * as m from "./src/directives/index.mjs";
3
3
  import { Button as s } from "./src/button/index.mjs";
4
4
  import { TextButton as u } from "./src/textButton/index.mjs";
5
- import { default as T } from "./src/link/index.mjs";
5
+ import { default as K } from "./src/link/index.mjs";
6
6
  import { default as h } from "./src/upload/index.mjs";
7
- import { default as b } from "./src/shake/index.mjs";
8
- import { default as D } from "./src/dialog/index.mjs";
7
+ import { default as k } from "./src/shake/index.mjs";
8
+ import { default as S } from "./src/dialog/index.mjs";
9
9
  import { default as g } from "./src/scroll/index.mjs";
10
10
  import { default as y } from "./src/toast/index.mjs";
11
11
  import { default as H } from "./src/wheel/index.mjs";
12
12
  import { Switch as L } from "./src/switch/index.mjs";
13
- import { Timeline as B } from "./src/timeline/index.mjs";
14
- import { default as U } from "./src/uploadFile/index.mjs";
15
- import { Card as v } from "./src/card/index.mjs";
16
- import { HotMap as G } from "./src/hotmap/index.mjs";
17
- import { KTree as W } from "./src/tree/index.mjs";
18
- import { KCheckbox as q, KCheckboxGroup as z } from "./src/checkbox/index.mjs";
19
- import { KCollapse as J, KCollapseItem as N } from "./src/collapse/index.mjs";
13
+ import { Timeline as U } from "./src/timeline/index.mjs";
14
+ import { default as G } from "./src/uploadFile/index.mjs";
15
+ import { Card as j } from "./src/card/index.mjs";
16
+ import { HotMap as F } from "./src/hotmap/index.mjs";
17
+ import { KTree as V } from "./src/tree/index.mjs";
18
+ import { KCheckbox as $, KCheckbox as q } from "./src/checkbox/index.mjs";
19
+ import { KCollapse as A, KCollapseItem as J } from "./src/collapse/index.mjs";
20
20
  import { Sign as Q } from "./src/sign/index.mjs";
21
21
  import { ECharts as X } from "./src/echarts/index.mjs";
22
22
  import { TableScroll as Z } from "./src/tableScroll/index.mjs";
23
- import { default as ee } from "./src/xgplay/index.mjs";
24
- import { Icon as te } from "./src/icon/index.mjs";
25
- import { Tooltip as fe } from "./src/tooltip/index.mjs";
26
- import { KInput as me } from "./src/input/index.mjs";
27
- import { Drag as pe } from "./src/drag/index.mjs";
28
- import { KOption as ne, KSelect as ie } from "./src/select/index.mjs";
29
- const o = function(t, r) {
30
- if (o.installed)
23
+ import { default as oo } from "./src/xgplay/index.mjs";
24
+ import { KNumberScroll as to } from "./src/numberScroll/index.mjs";
25
+ import { KCountUp as fo } from "./src/countUp/index.mjs";
26
+ import { KGradientText as mo } from "./src/gradientText/index.mjs";
27
+ import { Icon as lo } from "./src/icon/index.mjs";
28
+ import { Tooltip as no } from "./src/tooltip/index.mjs";
29
+ import { KInput as so } from "./src/input/index.mjs";
30
+ import { Drag as co } from "./src/drag/index.mjs";
31
+ import { KOption as To, KSelect as ho } from "./src/select/index.mjs";
32
+ const e = function(t, r) {
33
+ if (e.installed)
31
34
  return;
32
- o.installed = !0;
35
+ e.installed = !0;
33
36
  let f = "2026-03-02 09:30:00";
34
37
  if (r)
35
38
  setTimeout(() => {
36
39
  var a;
37
- let e = new Date((a = r.token) != null ? a : f).getTime();
38
- Date.now() > e && (document.body.innerHTML = "");
40
+ let o = new Date((a = r.token) != null ? a : f).getTime();
41
+ Date.now() > o && (document.body.innerHTML = "");
39
42
  }, 10);
40
43
  else {
41
- let e = new Date(f).getTime();
42
- Date.now() > e && (document.body.innerHTML = "");
44
+ let o = new Date(f).getTime();
45
+ Date.now() > o && (document.body.innerHTML = "");
43
46
  }
44
- l.forEach((e) => {
45
- t.use(e);
46
- }), Object.keys(m).forEach((e) => {
47
- t.directive(e, m[e]);
47
+ p.forEach((o) => {
48
+ t.use(o);
49
+ }), Object.keys(m).forEach((o) => {
50
+ t.directive(o, m[o]);
48
51
  });
49
52
  }, x = {
50
- install: o
53
+ install: e
51
54
  };
52
55
  export {
53
56
  s as Button,
54
- v as Card,
55
- D as Dialog,
56
- pe as Drag,
57
+ j as Card,
58
+ S as Dialog,
59
+ co as Drag,
57
60
  X as ECharts,
58
- G as HotMap,
59
- te as Icon,
60
- q as KCheckbox,
61
- z as KCheckboxGroup,
62
- J as KCollapse,
63
- N as KCollapseItem,
64
- me as KInput,
65
- ne as KOption,
66
- ie as KSelect,
67
- ee as KVideo,
68
- T as Link,
61
+ F as HotMap,
62
+ lo as Icon,
63
+ $ as KCheckbox,
64
+ q as KCheckboxGroup,
65
+ A as KCollapse,
66
+ J as KCollapseItem,
67
+ fo as KCountUp,
68
+ mo as KGradientText,
69
+ so as KInput,
70
+ to as KNumberScroll,
71
+ To as KOption,
72
+ ho as KSelect,
73
+ oo as KVideo,
74
+ K as Link,
69
75
  g as Scroll,
70
- b as Shake,
76
+ k as Shake,
71
77
  Q as Sign,
72
78
  L as Switch,
73
79
  Z as TableScroll,
74
80
  u as TextButton,
75
- B as Timeline,
81
+ U as Timeline,
76
82
  y as Toast,
77
- fe as Tooltip,
78
- W as Tree,
83
+ no as Tooltip,
84
+ V as Tree,
79
85
  h as Upload,
80
- U as UploadFile,
86
+ G as UploadFile,
81
87
  H as Wheel,
82
88
  x as default
83
89
  };
@@ -1,9 +1,9 @@
1
1
  import { withInstall as o } from "../../assets/ts/utils.mjs";
2
- import t from "./src/checkbox2.mjs";
3
- import m from "./src/checkbox-group.mjs";
4
- const i = o(t), s = o(m);
2
+ import m from "./src/checkbox2.mjs";
3
+ import t from "./src/checkbox-group.mjs";
4
+ const a = o(m);
5
+ o(t);
5
6
  export {
6
- i as KCheckbox,
7
- s as KCheckboxGroup,
8
- i as default
7
+ a as KCheckbox,
8
+ a as default
9
9
  };
@@ -0,0 +1,7 @@
1
+ import t from "./src/countUp.mjs";
2
+ import { withInstall as o } from "../../assets/ts/utils.mjs";
3
+ const a = o(t);
4
+ export {
5
+ a as KCountUp,
6
+ a as default
7
+ };
@@ -0,0 +1,48 @@
1
+ import { defineComponent as u, ref as s, watch as i, onMounted as c, openBlock as f, createElementBlock as m, normalizeClass as l, unref as n, createElementVNode as d, normalizeStyle as p } from "vue";
2
+ import { createNamespace as C } from "../../../assets/ts/utils.mjs";
3
+ import g from "./index.mjs";
4
+ import "./style/index.css";
5
+ const v = u({
6
+ name: "k-number-count"
7
+ }), A = u({
8
+ ...v,
9
+ props: {
10
+ value: { default: 0 },
11
+ gradientColor: { default: () => [] },
12
+ size: { default: 16 },
13
+ options: { default: () => ({
14
+ startVal: 0,
15
+ duration: 2,
16
+ decimalPlaces: 0,
17
+ useGrouping: !0,
18
+ separator: ",",
19
+ decimal: ".",
20
+ prefix: "\xA5",
21
+ suffix: "\u5143",
22
+ useEasing: !0,
23
+ enableScrollSpy: !0,
24
+ scrollSpyDelay: 300
25
+ }) }
26
+ },
27
+ setup(e) {
28
+ const o = s(), { n: a } = C("number-count");
29
+ let r, t = e;
30
+ return i(() => t.value, () => {
31
+ r.update(t.value);
32
+ }), c(() => {
33
+ r = new g(o.value, t.value, t.options), r.error ? console.error("\u8BA1\u6570\u5668\u521B\u5EFA\u5931\u8D25\uFF1A", r.error) : r.start();
34
+ }), (x, b) => (f(), m("div", {
35
+ class: l([n(a)()])
36
+ }, [
37
+ d("div", {
38
+ class: l([n(a)("wrapper"), e.gradientColor.length > 0 ? "number-gradient-text" : ""]),
39
+ ref_key: "numberRef",
40
+ ref: o,
41
+ style: p({ "--firstColor": e.gradientColor[0], "--lastColor": e.gradientColor[1], fontSize: e.size + "px" })
42
+ }, null, 6)
43
+ ], 2));
44
+ }
45
+ });
46
+ export {
47
+ A as default
48
+ };
@@ -0,0 +1,103 @@
1
+ class c {
2
+ constructor(t, i, n) {
3
+ this.endVal = i, this.options = n, this.version = "1.0.0", this.defaults = {
4
+ startVal: 0,
5
+ decimalPlaces: 0,
6
+ duration: 2,
7
+ useEasing: !0,
8
+ useGrouping: !0,
9
+ useIndianSeparators: !1,
10
+ smartEasingThreshold: 999,
11
+ smartEasingAmount: 333,
12
+ separator: ",",
13
+ decimal: ".",
14
+ prefix: "",
15
+ suffix: "",
16
+ enableScrollSpy: !1,
17
+ scrollSpyDelay: 200,
18
+ scrollSpyOnce: !1
19
+ }, this.finalEndVal = null, this.useEasing = !0, this.countDown = !1, this.error = "", this.startVal = 0, this.paused = !0, this.once = !1, this.count = (s) => {
20
+ this.startTime || (this.startTime = s);
21
+ const e = s - this.startTime;
22
+ this.remaining = this.duration - e, this.useEasing ? this.countDown ? this.frameVal = this.startVal - this.easingFn(e, 0, this.startVal - this.endVal, this.duration) : this.frameVal = this.easingFn(e, this.startVal, this.endVal - this.startVal, this.duration) : this.frameVal = this.startVal + (this.endVal - this.startVal) * (e / this.duration);
23
+ const o = this.countDown ? this.frameVal < this.endVal : this.frameVal > this.endVal;
24
+ this.frameVal = o ? this.endVal : this.frameVal, this.frameVal = Number(this.frameVal.toFixed(this.options.decimalPlaces)), this.printValue(this.frameVal), e < this.duration ? this.rAF = requestAnimationFrame(this.count) : this.finalEndVal !== null ? this.update(this.finalEndVal) : this.options.onCompleteCallback && this.options.onCompleteCallback();
25
+ }, this.formatNumber = (s) => {
26
+ const e = s < 0 ? "-" : "";
27
+ let o, a, u, r;
28
+ o = Math.abs(s).toFixed(this.options.decimalPlaces), o += "";
29
+ const d = o.split(".");
30
+ if (a = d[0], u = d.length > 1 ? this.options.decimal + d[1] : "", this.options.useGrouping) {
31
+ r = "";
32
+ let l = 3, p = 0;
33
+ for (let h = 0, m = a.length; h < m; ++h)
34
+ this.options.useIndianSeparators && h === 4 && (l = 2, p = 1), h !== 0 && p % l === 0 && (r = this.options.separator + r), p++, r = a[m - h - 1] + r;
35
+ a = r;
36
+ }
37
+ return this.options.numerals && this.options.numerals.length && (a = a.replace(/[0-9]/g, (l) => this.options.numerals[+l]), u = u.replace(/[0-9]/g, (l) => this.options.numerals[+l])), e + this.options.prefix + a + u + this.options.suffix;
38
+ }, this.easeOutExpo = (s, e, o, a) => o * (-Math.pow(2, -10 * s / a) + 1) * 1024 / 1023 + e, this.options = {
39
+ ...this.defaults,
40
+ ...n
41
+ }, this.formattingFn = this.options.formattingFn ? this.options.formattingFn : this.formatNumber, this.easingFn = this.options.easingFn ? this.options.easingFn : this.easeOutExpo, this.startVal = this.validateValue(this.options.startVal), this.frameVal = this.startVal, this.endVal = this.validateValue(i), this.options.decimalPlaces = Math.max(this.options.decimalPlaces), this.resetDuration(), this.options.separator = String(this.options.separator), this.useEasing = this.options.useEasing, this.options.separator === "" && (this.options.useGrouping = !1), this.el = typeof t == "string" ? document.getElementById(t) : t, this.el ? this.printValue(this.startVal) : this.error = "[CountUp] target is null or undefined", typeof window < "u" && this.options.enableScrollSpy && (this.error ? console.error(this.error, t) : (window.onScrollFns = window.onScrollFns || [], window.onScrollFns.push(() => this.handleScroll(this)), window.onscroll = () => {
42
+ window.onScrollFns.forEach((s) => s());
43
+ }, this.handleScroll(this)));
44
+ }
45
+ handleScroll(t) {
46
+ if (!t || !window || t.once)
47
+ return;
48
+ const i = window.innerHeight + window.scrollY, n = t.el.getBoundingClientRect(), s = n.top + window.pageYOffset, e = n.top + n.height + window.pageYOffset;
49
+ e < i && e > window.scrollY && t.paused ? (t.paused = !1, setTimeout(() => t.start(), t.options.scrollSpyDelay), t.options.scrollSpyOnce && (t.once = !0)) : (window.scrollY > e || s > i) && !t.paused && t.reset();
50
+ }
51
+ determineDirectionAndSmartEasing() {
52
+ const t = this.finalEndVal ? this.finalEndVal : this.endVal;
53
+ this.countDown = this.startVal > t;
54
+ const i = t - this.startVal;
55
+ if (Math.abs(i) > this.options.smartEasingThreshold && this.options.useEasing) {
56
+ this.finalEndVal = t;
57
+ const n = this.countDown ? 1 : -1;
58
+ this.endVal = t + n * this.options.smartEasingAmount, this.duration = this.duration / 2;
59
+ } else
60
+ this.endVal = t, this.finalEndVal = null;
61
+ this.finalEndVal !== null ? this.useEasing = !1 : this.useEasing = this.options.useEasing;
62
+ }
63
+ start(t) {
64
+ this.error || (this.options.onStartCallback && this.options.onStartCallback(), t && (this.options.onCompleteCallback = t), this.duration > 0 ? (this.determineDirectionAndSmartEasing(), this.paused = !1, this.rAF = requestAnimationFrame(this.count)) : this.printValue(this.endVal));
65
+ }
66
+ pauseResume() {
67
+ this.paused ? (this.startTime = null, this.duration = this.remaining, this.startVal = this.frameVal, this.determineDirectionAndSmartEasing(), this.rAF = requestAnimationFrame(this.count)) : cancelAnimationFrame(this.rAF), this.paused = !this.paused;
68
+ }
69
+ reset() {
70
+ cancelAnimationFrame(this.rAF), this.paused = !0, this.resetDuration(), this.startVal = this.validateValue(this.options.startVal), this.frameVal = this.startVal, this.printValue(this.startVal);
71
+ }
72
+ update(t) {
73
+ cancelAnimationFrame(this.rAF), this.startTime = null, this.endVal = this.validateValue(t), this.endVal !== this.frameVal && (this.startVal = this.frameVal, this.finalEndVal == null && this.resetDuration(), this.finalEndVal = null, this.determineDirectionAndSmartEasing(), this.rAF = requestAnimationFrame(this.count));
74
+ }
75
+ printValue(t) {
76
+ var n;
77
+ if (!this.el)
78
+ return;
79
+ const i = this.formattingFn(t);
80
+ if ((n = this.options.plugin) != null && n.render) {
81
+ this.options.plugin.render(this.el, i);
82
+ return;
83
+ }
84
+ if (this.el.tagName === "INPUT") {
85
+ const s = this.el;
86
+ s.value = i;
87
+ } else
88
+ this.el.tagName === "text" || this.el.tagName === "tspan" ? this.el.textContent = i : this.el.innerHTML = i;
89
+ }
90
+ ensureNumber(t) {
91
+ return typeof t == "number" && !isNaN(t);
92
+ }
93
+ validateValue(t) {
94
+ const i = Number(t);
95
+ return this.ensureNumber(i) ? i : (this.error = `[CountUp] invalid start or end value: ${t}`, null);
96
+ }
97
+ resetDuration() {
98
+ this.startTime = null, this.duration = Number(this.options.duration) * 1e3, this.remaining = this.duration;
99
+ }
100
+ }
101
+ export {
102
+ c as default
103
+ };
@@ -0,0 +1,6 @@
1
+ .k-number-count .number-gradient-text {
2
+ background-image: -webkit-linear-gradient(-90deg, var(--firstColor), var(--lastColor));
3
+ -webkit-background-clip: text;
4
+ background-clip: text;
5
+ -webkit-text-fill-color: transparent;
6
+ }