@skiddph/prui 0.2.1 → 0.4.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/app.js +1 -1
- package/dist/chunks/{auth-shell-DsAwGqf8.js → auth-shell-DWnZhpVf.js} +123 -122
- package/dist/core/button.d.ts +7 -2
- package/dist/core/button.js +45 -32
- package/dist/core/card.d.ts +9 -2
- package/dist/core/card.js +73 -58
- package/dist/core/index.d.ts +1 -0
- package/dist/core/input.d.ts +14 -1
- package/dist/core/input.js +32 -17
- package/dist/core/surface.d.ts +40 -0
- package/dist/core/surface.js +37 -0
- package/dist/core.js +63 -60
- package/dist/forms/form.d.ts +78 -0
- package/dist/forms/index.d.ts +8 -0
- package/dist/forms/registry.d.ts +4 -0
- package/dist/forms/types.d.ts +55 -0
- package/dist/forms.js +364 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +150 -131
- package/dist/prui-utilities.css +2 -0
- package/dist/prui.css +38 -0
- package/dist/theme/base.css +36 -0
- package/dist/theme/index.d.ts +51 -0
- package/dist/theme.js +110 -35
- package/package.json +11 -5
package/dist/theme.js
CHANGED
|
@@ -1,51 +1,120 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u = ["control", "workshop", "ember", "daylight"], d = "prui-theme-", c = /* @__PURE__ */ new Map(), m = [
|
|
2
|
+
"background",
|
|
3
|
+
"surface",
|
|
4
|
+
"raise",
|
|
5
|
+
"line",
|
|
6
|
+
"fg",
|
|
7
|
+
"dim",
|
|
8
|
+
"brand",
|
|
9
|
+
"brand-fg",
|
|
10
|
+
"ok",
|
|
11
|
+
"warn",
|
|
12
|
+
"danger"
|
|
13
|
+
];
|
|
2
14
|
function s(e) {
|
|
15
|
+
return `--prui-${e}`;
|
|
16
|
+
}
|
|
17
|
+
function f(e) {
|
|
18
|
+
const t = [];
|
|
19
|
+
for (const [r, n] of Object.entries(e))
|
|
20
|
+
n !== void 0 && t.push(` ${s(r)}: ${n};`);
|
|
21
|
+
return t.join(`
|
|
22
|
+
`);
|
|
23
|
+
}
|
|
24
|
+
function E(e, t) {
|
|
25
|
+
const r = e.trim().toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "") || "custom";
|
|
26
|
+
if (c.set(r, { ...t }), typeof document < "u") {
|
|
27
|
+
let n = document.getElementById(`prui-custom-theme-${r}`);
|
|
28
|
+
n || (n = document.createElement("style"), n.id = `prui-custom-theme-${r}`, document.head.appendChild(n)), n.textContent = `.${d}${r} {
|
|
29
|
+
${f(t)}
|
|
30
|
+
}`;
|
|
31
|
+
}
|
|
32
|
+
return r;
|
|
33
|
+
}
|
|
34
|
+
function v() {
|
|
35
|
+
return [...u, ...c.keys()];
|
|
36
|
+
}
|
|
37
|
+
function p(e, t = {}) {
|
|
38
|
+
const r = t.target ?? (typeof document < "u" ? document.documentElement : null), n = [];
|
|
39
|
+
if (r) {
|
|
40
|
+
for (const [o, l] of Object.entries(e))
|
|
41
|
+
l !== void 0 && (r.style.setProperty(s(o), String(l)), n.push(s(o)));
|
|
42
|
+
e.radius !== void 0 && (r.style.setProperty("--prui-radius", String(e.radius)), n.push("--prui-radius")), e["dim-op"] !== void 0 && (r.style.setProperty("--prui-dim-op", String(e["dim-op"])), n.push("--prui-dim-op"));
|
|
43
|
+
}
|
|
44
|
+
const i = t.storageKey === void 0 ? "prui:tokens" : t.storageKey;
|
|
45
|
+
return i && typeof localStorage < "u" && localStorage.setItem(i, JSON.stringify(e)), n;
|
|
46
|
+
}
|
|
47
|
+
function $(e = {}) {
|
|
48
|
+
const t = e.target ?? (typeof document < "u" ? document.documentElement : null);
|
|
49
|
+
if (t) {
|
|
50
|
+
for (const n of [...m, "radius", "dim-op"])
|
|
51
|
+
t.style.removeProperty(s(n));
|
|
52
|
+
t.style.removeProperty("--prui-radius"), t.style.removeProperty("--prui-dim-op");
|
|
53
|
+
}
|
|
54
|
+
const r = e.storageKey === void 0 ? "prui:tokens" : e.storageKey;
|
|
55
|
+
r && typeof localStorage < "u" && localStorage.removeItem(r);
|
|
56
|
+
}
|
|
57
|
+
function w(e = {}) {
|
|
58
|
+
if (typeof localStorage > "u") return null;
|
|
59
|
+
const t = e.storageKey ?? "prui:tokens", r = localStorage.getItem(t);
|
|
60
|
+
if (!r) return null;
|
|
61
|
+
try {
|
|
62
|
+
const n = JSON.parse(r);
|
|
63
|
+
return p(n, { target: e.target, storageKey: null }), n;
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function I(e) {
|
|
3
69
|
return e === "dark" ? "control" : e === "light" ? "daylight" : e;
|
|
4
70
|
}
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
return
|
|
71
|
+
const h = ["control", "workshop", "ember"], g = ["daylight"];
|
|
72
|
+
function y(e) {
|
|
73
|
+
return h.includes(e);
|
|
8
74
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
75
|
+
function K(e) {
|
|
76
|
+
return g.includes(e);
|
|
11
77
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
78
|
+
function a(e) {
|
|
79
|
+
const t = c.get(e);
|
|
80
|
+
return t != null && t.mode ? t.mode : y(e) ? "dark" : "light";
|
|
14
81
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return [`${i}${e}`, "prui-root", `prui-mode-${t}`];
|
|
82
|
+
function k(e, t) {
|
|
83
|
+
return [`${d}${e}`, "prui-root", `prui-mode-${t}`];
|
|
18
84
|
}
|
|
19
|
-
function
|
|
85
|
+
function S(e) {
|
|
20
86
|
const t = [...e.classList].filter(
|
|
21
|
-
(r) => r.startsWith(
|
|
87
|
+
(r) => r.startsWith(d) || r === "prui-root" || r.startsWith("prui-mode-")
|
|
22
88
|
);
|
|
23
89
|
t.length && e.classList.remove(...t);
|
|
24
90
|
}
|
|
25
|
-
function
|
|
26
|
-
const t =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
91
|
+
function T(e = {}) {
|
|
92
|
+
const t = e.theme ?? "control";
|
|
93
|
+
if (!(t === "dark" || t === "light" || u.includes(t) || c.has(t)))
|
|
94
|
+
return T({ ...e, theme: "control" });
|
|
95
|
+
const n = t === "dark" ? "control" : t === "light" ? "daylight" : t, i = e.mode ?? a(n), o = e.target ?? (typeof document < "u" ? document.documentElement : null);
|
|
96
|
+
o && (S(o), o.classList.add(...k(n, i)), o.dataset.pruiTheme = n, o.dataset.pruiMode = i, o.style.colorScheme = i);
|
|
97
|
+
const l = e.storageKey === void 0 ? "prui:theme" : e.storageKey;
|
|
98
|
+
return l && typeof localStorage < "u" && localStorage.setItem(l, JSON.stringify({ theme: n, mode: i })), { theme: n, mode: i };
|
|
30
99
|
}
|
|
31
|
-
function
|
|
100
|
+
function P(e = "prui:theme") {
|
|
32
101
|
if (typeof localStorage > "u") return null;
|
|
33
102
|
const t = localStorage.getItem(e);
|
|
34
103
|
if (!t) return null;
|
|
35
104
|
try {
|
|
36
|
-
const r = JSON.parse(t), n =
|
|
105
|
+
const r = JSON.parse(t), n = u.find((o) => o === r.theme);
|
|
37
106
|
if (!n) return null;
|
|
38
|
-
const
|
|
39
|
-
return { theme: n, mode:
|
|
107
|
+
const i = r.mode === "light" || r.mode === "dark" ? r.mode : a(n);
|
|
108
|
+
return { theme: n, mode: i };
|
|
40
109
|
} catch {
|
|
41
110
|
return null;
|
|
42
111
|
}
|
|
43
112
|
}
|
|
44
|
-
function
|
|
45
|
-
const t =
|
|
46
|
-
return
|
|
113
|
+
function M(e) {
|
|
114
|
+
const t = u.indexOf(e);
|
|
115
|
+
return u[(t + 1) % u.length] ?? "control";
|
|
47
116
|
}
|
|
48
|
-
const
|
|
117
|
+
const b = {
|
|
49
118
|
name: "applyTheme",
|
|
50
119
|
description: "Apply a named PRUI theme and persist the choice.",
|
|
51
120
|
props: [
|
|
@@ -56,13 +125,19 @@ const E = {
|
|
|
56
125
|
]
|
|
57
126
|
};
|
|
58
127
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
p as
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
128
|
+
u as PRUI_THEMES,
|
|
129
|
+
m as PRUI_TOKENS,
|
|
130
|
+
T as applyTheme,
|
|
131
|
+
p as applyThemeTokens,
|
|
132
|
+
$ as clearAppliedTokens,
|
|
133
|
+
E as defineTheme,
|
|
134
|
+
y as isDarkTheme,
|
|
135
|
+
K as isLightTheme,
|
|
136
|
+
v as listThemes,
|
|
137
|
+
M as nextTheme,
|
|
138
|
+
P as readPersistedTheme,
|
|
139
|
+
I as resolveThemeName,
|
|
140
|
+
w as restoreAppliedTokens,
|
|
141
|
+
b as themeMeta,
|
|
142
|
+
a as themeMode
|
|
68
143
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skiddph/prui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "PRUI component system: primitives, app-layer super-components, pages, and themes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"types": "./dist/app/index.d.ts",
|
|
28
28
|
"import": "./dist/app.js"
|
|
29
29
|
},
|
|
30
|
+
"./forms": {
|
|
31
|
+
"types": "./dist/forms/index.d.ts",
|
|
32
|
+
"import": "./dist/forms.js"
|
|
33
|
+
},
|
|
30
34
|
"./pages": {
|
|
31
35
|
"types": "./dist/pages/index.d.ts",
|
|
32
36
|
"import": "./dist/pages.js"
|
|
@@ -48,6 +52,7 @@
|
|
|
48
52
|
"tailwind-merge": "^3.3.1"
|
|
49
53
|
},
|
|
50
54
|
"devDependencies": {
|
|
55
|
+
"@tailwindcss/cli": "^4.3.3",
|
|
51
56
|
"@testing-library/jest-dom": "^6.6.3",
|
|
52
57
|
"@testing-library/react": "^16.3.0",
|
|
53
58
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -56,13 +61,14 @@
|
|
|
56
61
|
"@types/react-dom": "^19.1.0",
|
|
57
62
|
"@vitejs/plugin-react": "^4.5.0",
|
|
58
63
|
"jsdom": "^26.1.0",
|
|
64
|
+
"lucide-react": "^0.525.0",
|
|
65
|
+
"react": "^19.1.0",
|
|
66
|
+
"react-dom": "^19.1.0",
|
|
67
|
+
"tailwindcss": "^4.3.3",
|
|
59
68
|
"typescript": "^5.9.3",
|
|
60
69
|
"vite": "^6.3.5",
|
|
61
70
|
"vite-plugin-dts": "^4.5.4",
|
|
62
|
-
"vitest": "^3.2.4"
|
|
63
|
-
"lucide-react": "^0.525.0",
|
|
64
|
-
"react": "^19.1.0",
|
|
65
|
-
"react-dom": "^19.1.0"
|
|
71
|
+
"vitest": "^3.2.4"
|
|
66
72
|
},
|
|
67
73
|
"repository": {
|
|
68
74
|
"type": "git",
|