@crystaltech/hsms-shared-ui 0.6.6 → 0.6.7-alpha-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.
- package/README.md +134 -0
- package/dist/components/ui/SideDrawer.d.ts +78 -0
- package/dist/hooks/useLogout.d.ts +1 -0
- package/dist/hooks/useSyncedLocalStorage.d.ts +5 -0
- package/dist/index.es.js +8318 -8185
- package/dist/index.es2.js +164 -0
- package/dist/index.js +86 -86
- package/dist/index2.js +48 -0
- package/dist/logo.png +0 -0
- package/dist/preMountSplash.iife.js +48 -0
- package/dist/splash/preMountSplash.d.ts +28 -0
- package/package.json +7 -2
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
function u(t, e) {
|
|
2
|
+
try {
|
|
3
|
+
let a = t.replace("#", "");
|
|
4
|
+
a.length === 3 && (a = a.split("").map((s) => s + s).join(""));
|
|
5
|
+
const r = (s) => Math.min(255, Math.max(0, s)), n = r(parseInt(a.slice(0, 2), 16) + e), i = r(parseInt(a.slice(2, 4), 16) + e), p = r(parseInt(a.slice(4, 6), 16) + e), o = (s) => {
|
|
6
|
+
const l = s.toString(16);
|
|
7
|
+
return (l.length === 1 ? "0" : "") + l;
|
|
8
|
+
};
|
|
9
|
+
return "#" + o(n) + o(i) + o(p);
|
|
10
|
+
} catch {
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function g() {
|
|
15
|
+
try {
|
|
16
|
+
const t = localStorage.getItem("theme"), e = t ? JSON.parse(t) : null, a = e && e.mode || "light", r = e && e.themeColor || "#2c5282", n = u(r, 24), i = a === "light" ? "#ffffff" : "#121212", p = a === "light" ? "#0f172a" : "#e5e7eb", o = document.documentElement;
|
|
17
|
+
o.style.setProperty("--app-bg", i), o.style.setProperty("--app-fg", p), o.style.setProperty("--app-primary", r), o.style.setProperty("--app-primary-2", n);
|
|
18
|
+
} catch {
|
|
19
|
+
const e = document.documentElement;
|
|
20
|
+
e.style.setProperty("--app-bg", "#ffffff"), e.style.setProperty("--app-fg", "#0f172a"), e.style.setProperty("--app-primary", "#2c5282"), e.style.setProperty("--app-primary-2", "#3b82f6");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function y() {
|
|
24
|
+
try {
|
|
25
|
+
const t = localStorage.getItem("organization_name") || "", e = localStorage.getItem("organization_logo_full_url") || "";
|
|
26
|
+
return { orgName: t, orgLogo: e };
|
|
27
|
+
} catch {
|
|
28
|
+
return { orgName: "", orgLogo: "" };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function f() {
|
|
32
|
+
if (document.getElementById("hsms-pre-splash-style")) return;
|
|
33
|
+
const t = document.createElement("style");
|
|
34
|
+
t.id = "hsms-pre-splash-style", t.textContent = `
|
|
35
|
+
html, body { height: 100%; }
|
|
36
|
+
body { margin: 0; background: var(--app-bg); color: var(--app-fg); }
|
|
37
|
+
.app-splash {
|
|
38
|
+
height: 100%;
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 12px;
|
|
44
|
+
background-image:
|
|
45
|
+
radial-gradient(circle at 10% 10%, rgba(255,255,255,0.06), transparent 40%),
|
|
46
|
+
linear-gradient(135deg, var(--app-primary), var(--app-primary-2));
|
|
47
|
+
color: white;
|
|
48
|
+
opacity: 1;
|
|
49
|
+
transform: translateY(0);
|
|
50
|
+
transition: opacity 280ms ease-out, transform 280ms ease-out;
|
|
51
|
+
}
|
|
52
|
+
.app-splash.app-splash-hide {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transform: translateY(6px);
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
}
|
|
57
|
+
.app-splash .brand {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 10px;
|
|
61
|
+
background: rgba(255,255,255,0.12);
|
|
62
|
+
border: 1px solid rgba(255,255,255,0.2);
|
|
63
|
+
padding: 10px 14px;
|
|
64
|
+
border-radius: 12px;
|
|
65
|
+
}
|
|
66
|
+
.splash-title { font-weight: 600; letter-spacing: .2px; }
|
|
67
|
+
.splash-spinner {
|
|
68
|
+
width: 28px; height: 28px; border-radius: 50%;
|
|
69
|
+
border: 3px solid rgba(0,0,0,0.1);
|
|
70
|
+
border-top-color: var(--app-primary);
|
|
71
|
+
animation: hsms-spin 1s linear infinite;
|
|
72
|
+
}
|
|
73
|
+
@keyframes hsms-spin { to { transform: rotate(360deg); } }
|
|
74
|
+
`, document.head.appendChild(t);
|
|
75
|
+
}
|
|
76
|
+
function v(t) {
|
|
77
|
+
if (t != null && t.rootId) {
|
|
78
|
+
const e = document.getElementById(t.rootId);
|
|
79
|
+
if (e) return e;
|
|
80
|
+
}
|
|
81
|
+
return document.getElementById("app") || document.getElementById("root") || document.body;
|
|
82
|
+
}
|
|
83
|
+
function d(t) {
|
|
84
|
+
try {
|
|
85
|
+
const e = document.getElementById("hsms-pre-splash");
|
|
86
|
+
if (!e) return;
|
|
87
|
+
const a = t || e.parentElement || document.body;
|
|
88
|
+
if (a && Array.from(a.children).some((n) => n !== e) || document.readyState === "complete")
|
|
89
|
+
try {
|
|
90
|
+
e.classList.add("app-splash-hide");
|
|
91
|
+
const n = () => {
|
|
92
|
+
e.removeEventListener("transitionend", n), e && e.parentElement && e.remove();
|
|
93
|
+
try {
|
|
94
|
+
document.documentElement.classList.remove("app-loading"), document.documentElement.classList.add("app-ready"), window.__APP_READY__ = !0, window.dispatchEvent(new Event("app-ready"));
|
|
95
|
+
} catch {
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
e.addEventListener("transitionend", n), setTimeout(n, 340);
|
|
99
|
+
} catch {
|
|
100
|
+
e.remove();
|
|
101
|
+
}
|
|
102
|
+
} catch {
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function c(t) {
|
|
106
|
+
try {
|
|
107
|
+
if (document.getElementById("hsms-pre-splash")) return;
|
|
108
|
+
try {
|
|
109
|
+
document.documentElement.classList.add("app-loading"), document.documentElement.classList.remove("app-ready"), window.__APP_READY__ = !1;
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
g(), f();
|
|
113
|
+
const { orgName: e, orgLogo: a } = y(), r = v(t), n = document.createElement("div");
|
|
114
|
+
n.id = "hsms-pre-splash", n.className = "app-splash", n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.innerHTML = `
|
|
115
|
+
<div class="brand">
|
|
116
|
+
<img id="hsms-splash-logo" src="/logo.png" alt="Organization Logo"
|
|
117
|
+
style="height:40px;width:auto;border-radius:6px" />
|
|
118
|
+
<div id="hsms-splash-name" class="splash-title">Loading HSMS UI…</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="splash-spinner" aria-hidden="true"></div>
|
|
121
|
+
`, r.firstChild ? r.insertBefore(n, r.firstChild) : r.appendChild(n);
|
|
122
|
+
const i = n.querySelector("#hsms-splash-logo"), p = n.querySelector("#hsms-splash-name");
|
|
123
|
+
i && a && (i.src = a), p && e && (p.textContent = e);
|
|
124
|
+
const o = new MutationObserver(() => {
|
|
125
|
+
d(r), document.getElementById("hsms-pre-splash") || o.disconnect();
|
|
126
|
+
});
|
|
127
|
+
o.observe(r, { childList: !0, subtree: !1 });
|
|
128
|
+
const s = () => d(r);
|
|
129
|
+
window.addEventListener("load", s, { once: !0 });
|
|
130
|
+
const l = () => d(r);
|
|
131
|
+
window.addEventListener("hsms-app-mounted", l);
|
|
132
|
+
const m = () => d(r);
|
|
133
|
+
document.addEventListener("DOMContentLoaded", m, { once: !0 });
|
|
134
|
+
const h = () => d(r);
|
|
135
|
+
window.addEventListener("app-ready", h);
|
|
136
|
+
} catch {
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function E() {
|
|
140
|
+
d();
|
|
141
|
+
}
|
|
142
|
+
function b() {
|
|
143
|
+
try {
|
|
144
|
+
window.__APP_READY__ = !0, window.dispatchEvent(new Event("app-ready"));
|
|
145
|
+
} catch {
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
c();
|
|
150
|
+
} catch {
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
window.HSMSPreMountSplash = {
|
|
154
|
+
initPreMountSplash: c,
|
|
155
|
+
hidePreMountSplash: E,
|
|
156
|
+
markAppReady: b
|
|
157
|
+
};
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
export {
|
|
161
|
+
E as hidePreMountSplash,
|
|
162
|
+
c as initPreMountSplash,
|
|
163
|
+
b as markAppReady
|
|
164
|
+
};
|