@vestcards/shared 1.0.3 → 1.2.0

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.
package/dist/theme.js CHANGED
@@ -1,114 +1,19 @@
1
- import * as u from "@radix-ui/colors";
2
- const b = ["primary", "secondary", "tertiary", "quaternary", "quinary"];
3
- function c(r) {
4
- if (!r) return b[0];
5
- let a = 0;
6
- for (let t = 0; t < r.length; t++)
7
- a = r.charCodeAt(t) + ((a << 5) - a);
8
- const g = Math.abs(a) % b.length;
9
- return b[g];
10
- }
11
- const n = (r, a) => {
12
- var t;
13
- const g = `${r}${a.charAt(0).toUpperCase() + a.slice(1)}`;
14
- return ((t = u[r]) == null ? void 0 : t[g]) ?? `var(--${r}-${a})`;
15
- }, o = (r, a, g) => [r, n(a, g)];
16
- function e(r) {
17
- const a = Array.from({ length: 12 }, (g, t) => {
18
- const s = t + 1;
19
- return [o(s.toString(), r, s.toString()), o(`a${s}`, r, `a${s}`)];
20
- }).flat();
21
- return a.push(o("DEFAULT", r, "9")), a.push(o("hover", r, "10")), a.push(o("dark", r, "11")), a.push(o("light", r, "4")), a.push(o("lightness", r, "2")), Object.fromEntries(a);
22
- }
23
- const d = {
24
- transparent: "transparent",
25
- current: "currentColor",
26
- brand: {
27
- DEFAULT: "#FF7824"
28
- },
29
- primary: {
30
- ...e("orange")
31
- },
32
- secondary: {
33
- ...e("blue")
34
- },
35
- tertiary: {
36
- ...e("amber")
37
- },
38
- quaternary: {
39
- ...e("crimson")
40
- },
41
- quinary: {
42
- ...e("jade")
43
- },
44
- gray: {
45
- ...e("sand")
46
- },
47
- success: {
48
- ...e("grass")
49
- },
50
- warning: {
51
- ...e("amber")
52
- },
53
- danger: {
54
- ...e("red")
55
- },
56
- black: {
57
- DEFAULT: "#000000",
58
- a1: "rgba(0, 0, 0, 0.05)",
59
- a2: "rgba(0, 0, 0, 0.1)",
60
- a3: "rgba(0, 0, 0, 0.15)",
61
- a4: "rgba(0, 0, 0, 0.2)",
62
- a5: "rgba(0, 0, 0, 0.3)",
63
- a6: "rgba(0, 0, 0, 0.4)",
64
- a7: "rgba(0, 0, 0, 0.5)",
65
- a8: "rgba(0, 0, 0, 0.6)",
66
- a9: "rgba(0, 0, 0, 0.7)",
67
- a10: "rgba(0, 0, 0, 0.8)",
68
- a11: "rgba(0, 0, 0, 0.9)",
69
- a12: "rgba(0, 0, 0, 0.95)"
70
- },
71
- white: {
72
- DEFAULT: "#FFFFFF",
73
- a1: "rgba(255, 255, 255, 0.05)",
74
- a2: "rgba(255, 255, 255, 0.1)",
75
- a3: "rgba(255, 255, 255, 0.15)",
76
- a4: "rgba(255, 255, 255, 0.2)",
77
- a5: "rgba(255, 255, 255, 0.3)",
78
- a6: "rgba(255, 255, 255, 0.4)",
79
- a7: "rgba(255, 255, 255, 0.5)",
80
- a8: "rgba(255, 255, 255, 0.6)",
81
- a9: "rgba(255, 255, 255, 0.7)",
82
- a10: "rgba(255, 255, 255, 0.8)",
83
- a11: "rgba(255, 255, 255, 0.9)",
84
- a12: "rgba(255, 255, 255, 0.95)"
85
- },
86
- // shadcn colors
87
- foreground: n("sand", "12"),
88
- background: n("sand", "2"),
89
- ring: n("blue", "6"),
90
- muted: {
91
- DEFAULT: n("sand", "3"),
92
- foreground: n("sand", "10")
93
- },
94
- border: n("sand", "5"),
95
- input: n("sand", "4"),
96
- accent: n("blue", "2"),
97
- sidebar: {
98
- DEFAULT: n("sand", "3"),
99
- foreground: n("sand", "11"),
100
- accent: "white",
101
- "accent-foreground": n("orange", "11"),
102
- border: n("sand", "6"),
103
- ring: n("blue", "6")
104
- },
105
- popover: {
106
- DEFAULT: "#FFFFFF",
107
- foreground: n("sand", "11")
108
- }
1
+ import { c as t } from "./colors-G1GHbBJq.js";
2
+ const e = (o) => {
3
+ const a = Object.keys(t.data).length, r = o % a;
4
+ return Object.values(t.data)[r];
5
+ }, p = {
6
+ card: "2px",
7
+ button: "2px",
8
+ input: "2px"
9
+ }, c = {
10
+ card: "16px",
11
+ button: "8px",
12
+ input: "8px"
109
13
  };
110
14
  export {
111
- d as colors,
112
- e as generateScale,
113
- c as hashColor
15
+ c as borderRadius,
16
+ p as borderWidth,
17
+ t as colors,
18
+ e as getDataColor
114
19
  };
package/dist/utils.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("clsx"),s=require("tailwind-merge"),u={"border-w":["border-card","border-button","border-input"],"border-r":["rounded-card","rounded-button","rounded-input"]};function c(r){const e=s.extendTailwindMerge({extend:{classGroups:{...u,...r}}});return(...n)=>e(a.clsx(n))}const d=c(),o=["primary","secondary","tertiary","quaternary","quinary"];function i(r){if(!r)return o[0];let e=0;for(let t=0;t<r.length;t++)e=r.charCodeAt(t)+((e<<5)-e);const n=Math.abs(e)%o.length;return o[n]}const l=r=>r.toLocaleString("pt-BR",{style:"currency",currency:"BRL"});exports.cn=d;exports.createCn=c;exports.hashColor=i;exports.transformMoney=l;
@@ -0,0 +1,15 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ export declare const cn: (...inputs: ClassValue[]) => string;
4
+
5
+ /**
6
+ * Create a `cn` helper extended with shared classGroups plus any app-specific ones.
7
+ * Use this in each app to add tokens that only exist in that app (e.g. shadow-elevation).
8
+ */
9
+ export declare function createCn(extraClassGroups?: Record<string, string[]>): (...inputs: ClassValue[]) => string;
10
+
11
+ export declare function hashColor(str: string): "primary" | "secondary" | "tertiary" | "quaternary" | "quinary";
12
+
13
+ export declare const transformMoney: (value: number) => string;
14
+
15
+ export { }
package/dist/utils.js ADDED
@@ -0,0 +1,36 @@
1
+ import { clsx as a } from "clsx";
2
+ import { extendTailwindMerge as c } from "tailwind-merge";
3
+ const d = {
4
+ "border-w": ["border-card", "border-button", "border-input"],
5
+ "border-r": ["rounded-card", "rounded-button", "rounded-input"]
6
+ };
7
+ function s(r) {
8
+ const e = c({
9
+ extend: {
10
+ classGroups: {
11
+ ...d,
12
+ ...r
13
+ }
14
+ }
15
+ });
16
+ return (...n) => e(a(n));
17
+ }
18
+ const l = s(), o = ["primary", "secondary", "tertiary", "quaternary", "quinary"];
19
+ function h(r) {
20
+ if (!r) return o[0];
21
+ let e = 0;
22
+ for (let t = 0; t < r.length; t++)
23
+ e = r.charCodeAt(t) + ((e << 5) - e);
24
+ const n = Math.abs(e) % o.length;
25
+ return o[n];
26
+ }
27
+ const p = (r) => r.toLocaleString("pt-BR", {
28
+ style: "currency",
29
+ currency: "BRL"
30
+ });
31
+ export {
32
+ l as cn,
33
+ s as createCn,
34
+ h as hashColor,
35
+ p as transformMoney
36
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vestcards/shared",
3
- "version": "1.0.3",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -28,6 +28,11 @@
28
28
  "types": "./dist/spaced-repetition.d.ts",
29
29
  "import": "./dist/spaced-repetition.js",
30
30
  "require": "./dist/spaced-repetition.cjs"
31
+ },
32
+ "./utils": {
33
+ "types": "./dist/utils.d.ts",
34
+ "import": "./dist/utils.js",
35
+ "require": "./dist/utils.cjs"
31
36
  }
32
37
  },
33
38
  "files": [
@@ -45,10 +50,12 @@
45
50
  },
46
51
  "dependencies": {
47
52
  "@radix-ui/colors": "^3.0.0",
53
+ "clsx": "^2.1.1",
48
54
  "date-fns": "^4.1.0",
49
55
  "date-fns-tz": "^3.0.0",
50
- "ts-fsrs": "^4.5.1",
51
- "immer": "^10.1.1"
56
+ "immer": "^10.1.1",
57
+ "tailwind-merge": "^2.5.4",
58
+ "ts-fsrs": "^4.5.1"
52
59
  },
53
60
  "peerDependencies": {
54
61
  "react": ">=18"
@@ -1,10 +0,0 @@
1
- var n = /* @__PURE__ */ ((a) => (a.New = "New", a.Learning = "Learning", a.Review = "Review", a.Relearning = "Relearning", a))(n || {});
2
- const s = ["New", "Learning", "Review", "Relearning"];
3
- var r = /* @__PURE__ */ ((a) => (a.Manual = "Manual", a.Again = "Again", a.Hard = "Hard", a.Good = "Good", a.Easy = "Easy", a))(r || {});
4
- const e = ["Manual", "Again", "Hard", "Good", "Easy"];
5
- export {
6
- r as R,
7
- n as a,
8
- s as b,
9
- e as r
10
- };
@@ -1 +0,0 @@
1
- "use strict";var n=(a=>(a.New="New",a.Learning="Learning",a.Review="Review",a.Relearning="Relearning",a))(n||{});const e=["New","Learning","Review","Relearning"];var r=(a=>(a.Manual="Manual",a.Again="Again",a.Hard="Hard",a.Good="Good",a.Easy="Easy",a))(r||{});const i=["Manual","Again","Hard","Good","Easy"];exports.ReviewRating=r;exports.ReviewState=n;exports.reviewRatings=i;exports.reviewStates=e;