sakana-element 2.4.0 → 2.4.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 (57) hide show
  1. package/dist/es/{Alert-DfLsJvQD.js → Alert-DdAShH-x.js} +2 -2
  2. package/dist/es/{Avatar-Ci4OKsv7.js → Avatar-BGTH7x40.js} +1 -1
  3. package/dist/es/{Badge-B4wEToK6.js → Badge-CYZ55qNe.js} +2 -2
  4. package/dist/es/{Breadcrumb-BFzww8jd.js → Breadcrumb-BTWTtzrN.js} +2 -2
  5. package/dist/es/{Button-DbFviVWb.js → Button-GsSCWg5x.js} +3 -3
  6. package/dist/es/{Card-ClRqKkc_.js → Card-BhgzwQqo.js} +1 -1
  7. package/dist/es/{ChatBubble-DFEV_lVI.js → ChatBubble-4F481Agj.js} +1 -1
  8. package/dist/es/{Checkbox-l86YI3Fr.js → Checkbox-C7vZGSTh.js} +3 -3
  9. package/dist/es/{Collapse-B67v6RSE.js → Collapse-CbcSQig5.js} +2 -2
  10. package/dist/es/{ConfigProvider-BCoGbcS5.js → ConfigProvider-K1UzjlRm.js} +20 -19
  11. package/dist/es/{Diff-BLiniLom.js → Diff-B747pgwb.js} +1 -1
  12. package/dist/es/{Divider-DDSOHv8G.js → Divider-BSu_1-AU.js} +1 -1
  13. package/dist/es/{Drawer-apeXw6EO.js → Drawer-I2lCgyba.js} +2 -2
  14. package/dist/es/{Dropdown-By9qIErf.js → Dropdown-B0J_c8Wv.js} +6 -6
  15. package/dist/es/{FileInput-CZ5jTfB_.js → FileInput-CFg1wpsH.js} +3 -3
  16. package/dist/es/{Filter-B_1zU4Dq.js → Filter-nA8j-62U.js} +3 -3
  17. package/dist/es/{Form-B_XDnSjK.js → Form-C1b8Igns.js} +4 -4
  18. package/dist/es/{Icon-D6qRB3pq.js → Icon-BulvH9Wm.js} +1 -1
  19. package/dist/es/{Indicator-C6Ip4dpP.js → Indicator-BbW4iUkh.js} +1 -1
  20. package/dist/es/Input-BUHFulIW.js +42 -0
  21. package/dist/es/{Kbd-DXNjs7at.js → Kbd-CeP2wkdE.js} +2 -2
  22. package/dist/es/{Link-08Ee61Fv.js → Link-Dks2bXo8.js} +1 -1
  23. package/dist/es/{Loading-ByI9mjss.js → Loading-DoBtVGWo.js} +18 -18
  24. package/dist/es/{Message-CGG-lV5I.js → Message-Ba_P4Wvy.js} +7 -7
  25. package/dist/es/{Notification-B4clKY5h.js → Notification-DzG8dLuk.js} +4 -4
  26. package/dist/es/{Overlay-6iPenJB1.js → Overlay-DeyTycv0.js} +1 -1
  27. package/dist/es/{Pixelate-A8J7jxDW.js → Pixelate-B21HKbSE.js} +1 -1
  28. package/dist/es/{Popconfirm-gcHGcOTz.js → Popconfirm-BqN3JxJ_.js} +5 -5
  29. package/dist/es/{Progress-DFUBJQ4X.js → Progress--6EJjbbM.js} +1 -1
  30. package/dist/es/{Radio-CLBa1XIM.js → Radio-CrdrvrFH.js} +3 -3
  31. package/dist/es/{Resizable-BWrFr2oj.js → Resizable-By3ijQf0.js} +1 -1
  32. package/dist/es/{Select-BtLqds1d.js → Select-Cq1Ucs_U.js} +34 -34
  33. package/dist/es/{Skeleton-CGUQv3nQ.js → Skeleton-ChCVgMSk.js} +1 -1
  34. package/dist/es/{Switch-CZJ-S77_.js → Switch-DURmSH-T.js} +3 -3
  35. package/dist/es/{Table-lHbxiyGq.js → Table-BE2f9u65.js} +1 -1
  36. package/dist/es/{Tooltip-CdPqNYdn.js → Tooltip-DR4Mc5Fh.js} +23 -23
  37. package/dist/es/{Validator-7ZT_nXDZ.js → Validator-BYn72MYn.js} +2 -2
  38. package/dist/es/{hooks-pU4JmsO3.js → hooks-dJGu-5DG.js} +73 -74
  39. package/dist/es/index.js +119 -107
  40. package/dist/es/utils-CnCdZsHG.js +155 -0
  41. package/dist/es/{vendor-DrBJKLFW.js → vendor-eombfMkP.js} +51 -53
  42. package/dist/index.css +1 -1
  43. package/dist/theme/Button.css +20 -0
  44. package/dist/types/components/Icon/index.d.ts +1 -0
  45. package/dist/types/components/Input/types.d.ts +2 -0
  46. package/dist/types/components/Select/index.d.ts +2 -0
  47. package/dist/types/core/index.d.ts +1 -1
  48. package/dist/types/hooks/index.d.ts +3 -0
  49. package/dist/types/hooks/useFocusController.d.ts +1 -1
  50. package/dist/types/hooks/useLocale.d.ts +9 -1
  51. package/dist/umd/index.css +1 -1
  52. package/dist/umd/index.css.gz +0 -0
  53. package/dist/umd/index.umd.cjs +3 -3
  54. package/dist/umd/index.umd.cjs.gz +0 -0
  55. package/package.json +1 -1
  56. package/dist/es/Input-bThwBbNZ.js +0 -42
  57. package/dist/es/utils-BXICIEsD.js +0 -139
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sakana-element",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "A pixel-style Vue 3 component library, built with TypeScript and Vitest",
5
5
  "type": "module",
6
6
  "main": "./dist/umd/index.umd.cjs",
@@ -1,42 +0,0 @@
1
- import { c as e, r as o, d as a, w as l } from "./utils-BXICIEsD.js";
2
- import { defineComponent as s, ref as r, shallowRef as u, useAttrs as t, computed as p, watch as n, createElementBlock as d, openBlock as c, normalizeStyle as i, normalizeClass as f, unref as v, withDirectives as m, Fragment as y, createCommentVNode as h, createElementVNode as x, renderSlot as _, mergeProps as w, vModelDynamic as k, createBlock as b, withModifiers as $, vModelText as g, nextTick as B } from "vue";
3
- import { e as V, u as I } from "./hooks-pU4JmsO3.js";
4
- import { u as P } from "./Form-B_XDnSjK.js";
5
- import { P as j } from "./Icon-D6qRB3pq.js";
6
- import { q as C, f as F } from "./vendor-DrBJKLFW.js";
7
- const R = /* @__PURE__ */ new Set(["primary", "success", "warning", "danger", "info"]), z = { default: { "border-color": "color", "hover-border-color": "dark", "focus-border-color": "dark", "shadow-color": "dark", "focus-shadow-color": "dark" }, ghost: { "border-color": "transparent", "hover-border-color": "color", "focus-border-color": "dark", "shadow-color": "transparent", "focus-shadow-color": "dark" } }, M = { key: 0, class: "px-input__prepend" }, U = { key: 0, class: "px-input__prefix" }, q = ["id", "type", "disabled", "readonly", "autocomplete", "placeholder", "autofocus", "form"], A = { key: 1, class: "px-input__suffix" }, S = { key: 1, class: "px-input__append" }, D = ["id", "disabled", "readonly", "autocomplete", "placeholder", "autofocus", "form"], E = s({ name: "PxInput", inheritAttrs: false, __name: "Input", props: { id: {}, modelValue: {}, type: { default: "text" }, size: {}, color: {}, ghost: { type: Boolean }, disabled: { type: Boolean }, clearable: { type: Boolean }, showPassword: { type: Boolean }, placeholder: {}, readonly: { type: Boolean }, autocomplete: { default: "off" }, autofocus: { type: Boolean }, form: {} }, emits: ["update:modelValue", "input", "change", "focus", "blur", "clear"], setup(l2, { expose: s2, emit: E2 }) {
8
- const G2 = l2, H = E2, J = r(G2.modelValue), K = r(false), L = u(), N = u(), O = t(), { formItem: Q } = P(), T = p((() => L.value || N.value)), W = p((() => G2.disabled)), X = p((() => R.has(G2.color ?? ""))), Y = p((() => !!G2.color && !X.value)), Z = p((() => {
9
- if (!Y.value) return {};
10
- const a2 = e(G2.color), l3 = G2.ghost ? "ghost" : "default";
11
- return o(a2, "px-input", z[l3]);
12
- })), ee = p((() => G2.clearable && !!J.value && !W.value && le.value)), oe = p((() => "password" === G2.type && G2.showPassword && !W.value && !!J.value)), { wrapperRef: ae, isFocused: le, handleFocus: se, handleBlur: re } = V(T, { afterBlur() {
13
- Q == null ? void 0 : Q.validate("blur").catch(((e2) => a()));
14
- } }), ue = () => {
15
- J.value = "", F(["input", "change", "update:modelValue"], ((e2) => H(e2, ""))), H("clear"), Q == null ? void 0 : Q.clearValidate();
16
- };
17
- function te() {
18
- H("update:modelValue", J.value), H("input", J.value);
19
- }
20
- function pe() {
21
- H("change", J.value);
22
- }
23
- function ne() {
24
- K.value = !K.value;
25
- }
26
- return n((() => G2.modelValue), ((e2) => {
27
- J.value = e2, Q == null ? void 0 : Q.validate("change").catch(((e3) => a()));
28
- })), s2({ ref: T, focus: async () => {
29
- var _a;
30
- await B(), (_a = T.value) == null ? void 0 : _a.focus();
31
- }, blur: () => {
32
- var _a;
33
- (_a = T.value) == null ? void 0 : _a.blur();
34
- }, select: () => {
35
- var _a;
36
- (_a = T.value) == null ? void 0 : _a.select();
37
- }, clear: ue }), (e2, o2) => (c(), d("div", { class: f(["px-input", { [`px-input--${e2.type}`]: e2.type, [`px-input--${e2.size}`]: e2.size, [`px-input--${e2.color}`]: X.value, "is-ghost": e2.ghost, "is-disabled": W.value, "is-prepend": e2.$slots.prepend, "is-append": e2.$slots.append, "is-prefix": e2.$slots.prefix, "is-suffix": e2.$slots.suffix, "is-focus": v(le) }]), style: i(Z.value) }, ["textarea" !== e2.type ? (c(), d(y, { key: 0 }, [e2.$slots.prepend ? (c(), d("div", M, [_(e2.$slots, "prepend")])) : h("", true), x("div", { class: "px-input__wrapper", ref_key: "wrapperRef", ref: ae }, [e2.$slots.prefix ? (c(), d("span", U, [_(e2.$slots, "prefix")])) : h("", true), m(x("input", w({ class: "px-input__inner", ref_key: "inputRef", ref: L, id: v(I)().value, type: e2.showPassword ? K.value ? "text" : "password" : e2.type, disabled: W.value, readonly: e2.readonly, autocomplete: e2.autocomplete, placeholder: e2.placeholder, autofocus: e2.autofocus, form: e2.form, "onUpdate:modelValue": o2[0] || (o2[0] = (e3) => J.value = e3) }, v(O), { onInput: te, onChange: pe, onFocus: o2[1] || (o2[1] = (...e3) => v(se) && v(se)(...e3)), onBlur: o2[2] || (o2[2] = (...e3) => v(re) && v(re)(...e3)) }), null, 16, q), [[k, J.value]]), e2.$slots.suffix || ee.value || oe.value ? (c(), d("span", A, [_(e2.$slots, "suffix"), ee.value ? (c(), b(j, { key: 0, icon: "close-box", class: "px-input__clear", onClick: ue, onMousedown: $(v(C), ["prevent"]) }, null, 8, ["onMousedown"])) : h("", true), oe.value && K.value ? (c(), b(j, { key: 1, icon: "eye", class: "px-input__password", onClick: ne })) : h("", true), oe.value && !K.value ? (c(), b(j, { key: 2, icon: "eye-closed", class: "px-input__password", onClick: ne })) : h("", true)])) : h("", true)], 512), e2.$slots.append ? (c(), d("div", S, [_(e2.$slots, "append")])) : h("", true)], 64)) : m((c(), d("textarea", w({ key: 1, class: "px-textarea__wrapper", ref_key: "textareaRef", ref: N, id: v(I)().value, disabled: W.value, readonly: e2.readonly, autocomplete: e2.autocomplete, placeholder: e2.placeholder, autofocus: e2.autofocus, form: e2.form, "onUpdate:modelValue": o2[3] || (o2[3] = (e3) => J.value = e3) }, v(O), { onInput: te, onChange: pe, onFocus: o2[4] || (o2[4] = (...e3) => v(se) && v(se)(...e3)), onBlur: o2[5] || (o2[5] = (...e3) => v(re) && v(re)(...e3)) }), null, 16, D)), [[g, J.value]])], 6));
38
- } }), G = l(E);
39
- export {
40
- G as P,
41
- E as _
42
- };
@@ -1,139 +0,0 @@
1
- import { h as e, d as t, y as o } from "./vendor-DrBJKLFW.js";
2
- import { defineComponent as r } from "vue";
3
- function n(e2, t2) {
4
- const o2 = parseInt(e2.replace("#", ""), 16);
5
- return `#${(Math.max(0, (o2 >> 16) - Math.round(2.55 * t2)) << 16 | Math.max(0, (o2 >> 8 & 255) - Math.round(2.55 * t2)) << 8 | Math.max(0, (255 & o2) - Math.round(2.55 * t2))).toString(16).padStart(6, "0")}`;
6
- }
7
- function a(e2, t2) {
8
- const o2 = parseInt(e2.replace("#", ""), 16);
9
- return `#${(Math.min(255, (o2 >> 16) + Math.round(2.55 * t2)) << 16 | Math.min(255, (o2 >> 8 & 255) + Math.round(2.55 * t2)) << 8 | Math.min(255, (255 & o2) + Math.round(2.55 * t2))).toString(16).padStart(6, "0")}`;
10
- }
11
- function c(e2) {
12
- const t2 = parseInt(e2.replace("#", ""), 16);
13
- return (0.299 * (t2 >> 16) + 0.587 * (t2 >> 8 & 255) + 0.114 * (255 & t2)) / 255 > 0.6 ? "#1e1e2e" : "#ffffff";
14
- }
15
- function s(e2) {
16
- return { color: e2, dark: n(e2, 15), light: a(e2, 35), contrast: c(e2), transparent: "transparent" };
17
- }
18
- function i(e2, t2, o2) {
19
- const r2 = {};
20
- for (const [n2, a2] of Object.entries(o2)) r2[`--${t2}-${n2}`] = e2[a2];
21
- return r2;
22
- }
23
- const l = { outline: { "text-color": "color", "bg-color": "transparent", "border-color": "color", "shadow-color": "transparent" }, dash: { "text-color": "color", "bg-color": "light", "border-color": "color", "shadow-color": "transparent" }, default: { "text-color": "contrast", "bg-color": "color", "border-color": "dark", "shadow-color": "dark" } };
24
- function u(e2, t2) {
25
- }
26
- const f = { spinner: "loader", loading: "loader", "eye-slash": "eye-closed", "eye-off": "eye-closed", xmark: "close", x: "close", times: "close", "circle-xmark": "close-box", "x-circle": "close-box", "times-circle": "close-box", error: "close-box", "circle-info": "info-box", "info-circle": "info-box", info: "info-box", "check-circle": "check", "circle-check": "check", success: "check", "circle-exclamation": "warning-box", "exclamation-circle": "warning-box", warning: "warning-box", "angle-down": "chevron-down", "caret-down": "chevron-down", "angle-up": "chevron-up", "caret-up": "chevron-up", "angle-left": "chevron-left", "caret-left": "chevron-left", "angle-right": "chevron-right", "caret-right": "chevron-right", "question-circle": "info-box", "circle-question": "info-box", help: "info-box", question: "info-box", gear: "sliders", cog: "sliders", settings: "sliders", star: "bookmark", "star-solid": "bookmark" };
27
- function d(e2) {
28
- return e2 in f ? f[e2] : e2;
29
- }
30
- const h = /* @__PURE__ */ new Set(["svg", "path", "rect", "circle", "ellipse", "line", "polyline", "polygon", "g", "defs", "clipPath", "mask", "title", "desc", "linearGradient", "radialGradient", "stop", "symbol", "use"]), g = /^on/i, p = /^\s*javascript\s*:/i;
31
- function m(e2) {
32
- if (!e2 || "string" != typeof e2) return "";
33
- if ("undefined" == typeof DOMParser) return "";
34
- const t2 = new DOMParser().parseFromString(e2, "image/svg+xml");
35
- return t2.querySelector("parsererror") ? "" : (b(t2.documentElement), t2.documentElement.outerHTML);
36
- }
37
- function b(e2) {
38
- const t2 = Array.from(e2.children);
39
- for (const e3 of t2) {
40
- const t3 = e3.tagName.toLowerCase();
41
- if (h.has(t3)) {
42
- for (const t4 of Array.from(e3.attributes)) (g.test(t4.name) || "href" === t4.name && p.test(t4.value) || "xlink:href" === t4.name && p.test(t4.value)) && e3.removeAttribute(t4.name);
43
- b(e3);
44
- } else e3.remove();
45
- }
46
- }
47
- const x = /* @__PURE__ */ new Map();
48
- function M(e2) {
49
- for (const [t2, o2] of Object.entries(e2)) x.set(t2, m(o2));
50
- }
51
- function v(e2) {
52
- return x.get(e2);
53
- }
54
- const w = (e2) => (e2.install = (t2) => {
55
- const o2 = e2.name;
56
- t2.component(o2, e2);
57
- }, e2), y = (e2, t2) => (e2.install = (o2) => {
58
- o2.config.globalProperties[t2] = e2;
59
- }, e2);
60
- function k(e2, t2) {
61
- for (; e2.length >= t2; ) e2[0].props.onDestroy();
62
- }
63
- function S(e2) {
64
- let t2 = false, o2 = 0;
65
- const r2 = (t3) => {
66
- var _a;
67
- "Escape" === t3.code && ((_a = e2()) == null ? void 0 : _a.handler.close());
68
- };
69
- return { register() {
70
- o2++, t2 || (document.addEventListener("keydown", r2), t2 = true);
71
- }, unregister() {
72
- o2--, o2 <= 0 && (document.removeEventListener("keydown", r2), t2 = false, o2 = 0);
73
- } };
74
- }
75
- function N(e2, t2, o2, r2) {
76
- if (0 === r2.length) return [e2, t2, o2];
77
- let n2 = 1 / 0, a2 = r2[0];
78
- for (const c2 of r2) {
79
- const r3 = (e2 - c2[0]) ** 2 + (t2 - c2[1]) ** 2 + (o2 - c2[2]) ** 2;
80
- if (0 === r3) return c2;
81
- r3 < n2 && (n2 = r3, a2 = c2);
82
- }
83
- return a2;
84
- }
85
- function $(e2, t2, o2) {
86
- const r2 = e2.getContext("2d");
87
- if (!r2) return;
88
- const { pixelSize: n2, grayscale: a2 = false, palette: c2, background: s2 = "#FFFFFF" } = o2, i2 = t2.naturalWidth, l2 = t2.naturalHeight;
89
- e2.width = i2, e2.height = l2, r2.drawImage(t2, 0, 0, i2, l2);
90
- const u2 = r2.getImageData(0, 0, i2, l2).data, f2 = Math.max(1, Math.round(n2)), d2 = c2 ? (function(e3) {
91
- return e3.map(((e4) => "string" == typeof e4 ? (function(e5) {
92
- const t3 = e5.replace("#", "");
93
- return [parseInt(t3.substring(0, 2), 16), parseInt(t3.substring(2, 4), 16), parseInt(t3.substring(4, 6), 16)];
94
- })(e4) : e4));
95
- })(c2) : null;
96
- r2.fillStyle = s2, r2.fillRect(0, 0, i2, l2);
97
- for (let e3 = 0; e3 < l2; e3 += f2) for (let t3 = 0; t3 < i2; t3 += f2) {
98
- const o3 = Math.min(f2, i2 - t3), n3 = Math.min(f2, l2 - e3);
99
- let c3 = 0, s3 = 0, h2 = 0, g2 = 0;
100
- for (let r3 = 0; r3 < n3; r3++) for (let n4 = 0; n4 < o3; n4++) {
101
- const o4 = 4 * ((e3 + r3) * i2 + (t3 + n4));
102
- c3 += u2[o4], s3 += u2[o4 + 1], h2 += u2[o4 + 2], g2++;
103
- }
104
- let p2 = Math.round(c3 / g2), m2 = Math.round(s3 / g2), b2 = Math.round(h2 / g2);
105
- a2 && (p2 = m2 = b2 = Math.round(0.299 * p2 + 0.587 * m2 + 0.114 * b2)), d2 && ([p2, m2, b2] = N(p2, m2, b2, d2)), r2.fillStyle = `rgb(${p2},${m2},${b2})`, r2.fillRect(t3, e3, o3, n3);
106
- }
107
- }
108
- function F(o2, r2 = "px") {
109
- return o2 ? e(o2) || ((e2) => !!t(e2) && !Number.isNaN(Number(e2)))(o2) ? `${o2}${r2}` : t(o2) ? o2 : void 0 : "";
110
- }
111
- function I(e2, t2, o2) {
112
- return Math.max(t2, Math.min(o2, e2));
113
- }
114
- const j = /* @__PURE__ */ new Map([["info", "info-box"], ["success", "check"], ["warning", "warning-box"], ["danger", "close-box"], ["error", "close-box"]]), O = r({ props: { vNode: { type: [String, Object, Function], required: true } }, setup: (e2) => () => o(e2.vNode) ? e2.vNode() : e2.vNode }), q = (e2, t2) => {
115
- const o2 = e2.__vccOpts || e2;
116
- for (const [e3, r2] of t2) o2[e3] = r2;
117
- return o2;
118
- };
119
- export {
120
- O as R,
121
- l as S,
122
- q as _,
123
- I as a,
124
- F as b,
125
- s as c,
126
- u as d,
127
- d as e,
128
- M as f,
129
- v as g,
130
- k as h,
131
- S as i,
132
- y as j,
133
- a as l,
134
- $ as p,
135
- i as r,
136
- m as s,
137
- j as t,
138
- w
139
- };