@rotki/ui-library 2.4.4 → 2.5.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.
@@ -0,0 +1,22 @@
1
+ interface BlockieOptions {
2
+ /** seed used to generate icon data, default: random */
3
+ seed: string;
4
+ /** to manually specify the icon color, default: random */
5
+ color: string;
6
+ /** choose a different background color, default: random */
7
+ bgcolor: string;
8
+ /** width/height of the icon in blocks, default: 8 */
9
+ size: number;
10
+ /** width/height of each block in pixels, default: 4 */
11
+ scale: number;
12
+ /**
13
+ * each pixel has a 13% chance of being of a third color, default: random.
14
+ *
15
+ * Set to -1 to disable it.
16
+ *
17
+ * These "spots" create structures that look like eyes, mouths and noses.
18
+ */
19
+ spotColor: string;
20
+ }
21
+ export declare function createBlockie(opts: Partial<BlockieOptions>): string;
22
+ export {};
@@ -0,0 +1,157 @@
1
+ import { logicOr as p } from "@vueuse/math";
2
+ import { computed as m, ref as b } from "vue";
3
+ import { get as g, objectPick as w, objectOmit as M, set as x } from "@vueuse/shared";
4
+ import { c as A } from "../vendor-DQixCxRS.js";
5
+ import { createGlobalState as C } from "@vueuse/core";
6
+ class I extends Error {
7
+ constructor(e) {
8
+ super(e ?? "AssertionError"), this.name = "AssertionError";
9
+ }
10
+ }
11
+ function K(t, e) {
12
+ if (!t)
13
+ throw new I(e);
14
+ }
15
+ function T(t, e) {
16
+ const r = m(() => {
17
+ let o = g(t);
18
+ return typeof o == "string" && (o = [o]), o.filter((f) => !!f);
19
+ }), s = m(() => {
20
+ let o = g(e);
21
+ return typeof o == "string" && (o = [o]), o.filter((f) => !!f);
22
+ }), i = m(() => g(r).length > 0), c = m(() => g(s).length > 0), a = p(i, c);
23
+ return {
24
+ formattedErrorMessages: r,
25
+ formattedSuccessMessages: s,
26
+ hasError: i,
27
+ hasMessages: a,
28
+ hasSuccess: c
29
+ };
30
+ }
31
+ function O(t, { fractionDigits: e = 2 }) {
32
+ return new Intl.NumberFormat(void 0, {
33
+ maximumFractionDigits: e,
34
+ minimumFractionDigits: e
35
+ }).format(Number(t));
36
+ }
37
+ function V(t) {
38
+ return O(t, { fractionDigits: 0 });
39
+ }
40
+ function y(t) {
41
+ return Object.keys(t).filter(
42
+ (e) => e.startsWith("data-")
43
+ );
44
+ }
45
+ function W(t, e = ["class"]) {
46
+ return w(t, [...y(t), ...e]);
47
+ }
48
+ function q(t, e = ["class"]) {
49
+ return M(t, [...y(t), ...e]);
50
+ }
51
+ function G(t, e) {
52
+ return t && Object.keys(t).reduce((r, s) => (r[A(s)] = t[s], r), {});
53
+ }
54
+ function L(t) {
55
+ return t ? t.toString().toLowerCase().replace(/[^\da-z]/gi, "") : "";
56
+ }
57
+ function P(t) {
58
+ return t === void 0 || typeof t == "string" && isNaN(Number(t)) ? t : `${t}px`;
59
+ }
60
+ function h(t, e) {
61
+ if (t === e)
62
+ return !0;
63
+ if (t == null || e == null)
64
+ return t === e;
65
+ if (typeof t != typeof e)
66
+ return !1;
67
+ if (Array.isArray(t)) {
68
+ if (!Array.isArray(e) || t.length !== e.length)
69
+ return !1;
70
+ for (const [r, s] of t.entries())
71
+ if (!h(s, e[r]))
72
+ return !1;
73
+ return !0;
74
+ }
75
+ if (typeof t == "object") {
76
+ const r = Object.keys(t), s = Object.keys(e);
77
+ if (r.length !== s.length)
78
+ return !1;
79
+ for (const i of r)
80
+ if (!h(t[i], e[i]))
81
+ return !1;
82
+ return !0;
83
+ }
84
+ return !1;
85
+ }
86
+ const S = C(() => {
87
+ const t = b(0);
88
+ return { count: t, nextId: () => {
89
+ const r = g(t) + 1;
90
+ return x(t, r), r;
91
+ } };
92
+ });
93
+ function U(t = "") {
94
+ const { nextId: e } = S();
95
+ return `${t}-${e()}`;
96
+ }
97
+ const n = new Array(4);
98
+ function j(t) {
99
+ for (let e = 0; e < n.length; e++) n[e] = 0;
100
+ for (let e = 0; e < t.length; e++)
101
+ n[e % 4] = (n[e % 4] << 5) - n[e % 4] + t.charCodeAt(e);
102
+ }
103
+ function u() {
104
+ const t = n[0] ^ n[0] << 11;
105
+ return n[0] = n[1], n[1] = n[2], n[2] = n[3], n[3] = n[3] ^ n[3] >> 19 ^ t ^ t >> 8, (n[3] >>> 0) / (1 << 31 >>> 0);
106
+ }
107
+ function d() {
108
+ const t = Math.floor(u() * 360), e = `${u() * 60 + 40}%`, r = `${(u() + u() + u() + u()) * 25}%`;
109
+ return `hsl(${t},${e},${r})`;
110
+ }
111
+ function k(t) {
112
+ const e = t, r = t, s = Math.ceil(e / 2), i = e - s, c = [];
113
+ for (let a = 0; a < r; a++) {
114
+ let o = [];
115
+ for (let l = 0; l < s; l++)
116
+ o[l] = Math.floor(u() * 2.3);
117
+ const f = o.slice(0, i);
118
+ f.reverse(), o = o.concat(f);
119
+ for (const l of o) c.push(l);
120
+ }
121
+ return c;
122
+ }
123
+ function E(t) {
124
+ const e = {};
125
+ return e.seed = t.seed || Math.floor(Math.random() * 10 ** 16).toString(16), j(e.seed), e.size = t.size || 8, e.scale = t.scale || 8, e.color = t.color || d(), e.bgcolor = t.bgcolor || d(), e.spotColor = t.spotColor || d(), e;
126
+ }
127
+ function $(t, e) {
128
+ const r = E(t || {}), s = k(r.size), i = Math.sqrt(s.length);
129
+ e.width = e.height = r.size * r.scale;
130
+ const c = e.getContext("2d");
131
+ if (c) {
132
+ c.fillStyle = r.bgcolor, c.fillRect(0, 0, e.width, e.height), c.fillStyle = r.color;
133
+ for (const [a, o] of s.entries())
134
+ if (o) {
135
+ const f = Math.floor(a / i), l = a % i;
136
+ c.fillStyle = o === 1 ? r.color : r.spotColor, c.fillRect(l * r.scale, f * r.scale, r.scale, r.scale);
137
+ }
138
+ }
139
+ return e;
140
+ }
141
+ function B(t) {
142
+ const e = document.createElement("canvas");
143
+ return $(t, e), e.toDataURL("image/jpeg");
144
+ }
145
+ export {
146
+ q as a,
147
+ L as b,
148
+ K as c,
149
+ U as d,
150
+ P as e,
151
+ V as f,
152
+ W as g,
153
+ B as h,
154
+ h as i,
155
+ G as t,
156
+ T as u
157
+ };
@@ -1,4 +1,4 @@
1
- import { g as Vt } from "./index-QzEscGAT.js";
1
+ import { g as Vt } from "./index-CIcI4wps.js";
2
2
  const Ee = /\d/, Pe = ["-", "_", "/", "."];
3
3
  function Le(t = "") {
4
4
  if (!Ee.test(t))
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "@rotki/ui-library",
5
- "version": "2.4.4",
5
+ "version": "2.5.1",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rotki/ui-library",
3
- "version": "2.4.4",
3
+ "version": "2.5.1",
4
4
  "description": "A vue design system and component library for rotki",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -1,108 +0,0 @@
1
- import { logicOr as l } from "@vueuse/math";
2
- import { computed as f, ref as y } from "vue";
3
- import { get as i, objectPick as p, objectOmit as b, set as d } from "@vueuse/shared";
4
- import { c as x } from "../vendor-CYFK77Oj.js";
5
- import { createGlobalState as A } from "@vueuse/core";
6
- class j extends Error {
7
- constructor(r) {
8
- super(r ?? "AssertionError"), this.name = "AssertionError";
9
- }
10
- }
11
- function w(t, r) {
12
- if (!t)
13
- throw new j(r);
14
- }
15
- function F(t, r) {
16
- const e = f(() => {
17
- let s = i(t);
18
- return typeof s == "string" && (s = [s]), s.filter((c) => !!c);
19
- }), n = f(() => {
20
- let s = i(r);
21
- return typeof s == "string" && (s = [s]), s.filter((c) => !!c);
22
- }), o = f(() => i(e).length > 0), u = f(() => i(n).length > 0), g = l(o, u);
23
- return {
24
- formattedErrorMessages: e,
25
- formattedSuccessMessages: n,
26
- hasError: o,
27
- hasMessages: g,
28
- hasSuccess: u
29
- };
30
- }
31
- function k(t, { fractionDigits: r = 2 }) {
32
- return new Intl.NumberFormat(void 0, {
33
- maximumFractionDigits: r,
34
- minimumFractionDigits: r
35
- }).format(Number(t));
36
- }
37
- function S(t) {
38
- return k(t, { fractionDigits: 0 });
39
- }
40
- function m(t) {
41
- return Object.keys(t).filter(
42
- (r) => r.startsWith("data-")
43
- );
44
- }
45
- function C(t, r = ["class"]) {
46
- return p(t, [...m(t), ...r]);
47
- }
48
- function D(t, r = ["class"]) {
49
- return b(t, [...m(t), ...r]);
50
- }
51
- function K(t, r) {
52
- return t && Object.keys(t).reduce((e, n) => (e[x(n)] = t[n], e), {});
53
- }
54
- function R(t) {
55
- return t ? t.toString().toLowerCase().replace(/[^\da-z]/gi, "") : "";
56
- }
57
- function T(t) {
58
- return t === void 0 || typeof t == "string" && isNaN(Number(t)) ? t : `${t}px`;
59
- }
60
- function a(t, r) {
61
- if (t === r)
62
- return !0;
63
- if (t == null || r == null)
64
- return t === r;
65
- if (typeof t != typeof r)
66
- return !1;
67
- if (Array.isArray(t)) {
68
- if (!Array.isArray(r) || t.length !== r.length)
69
- return !1;
70
- for (const [e, n] of t.entries())
71
- if (!a(n, r[e]))
72
- return !1;
73
- return !0;
74
- }
75
- if (typeof t == "object") {
76
- const e = Object.keys(t), n = Object.keys(r);
77
- if (e.length !== n.length)
78
- return !1;
79
- for (const o of e)
80
- if (!a(t[o], r[o]))
81
- return !1;
82
- return !0;
83
- }
84
- return !1;
85
- }
86
- const E = A(() => {
87
- const t = y(0);
88
- return { count: t, nextId: () => {
89
- const e = i(t) + 1;
90
- return d(t, e), e;
91
- } };
92
- });
93
- function V(t = "") {
94
- const { nextId: r } = E();
95
- return `${t}-${r()}`;
96
- }
97
- export {
98
- D as a,
99
- R as b,
100
- w as c,
101
- V as d,
102
- T as e,
103
- S as f,
104
- C as g,
105
- a as i,
106
- K as t,
107
- F as u
108
- };