elysia-rack 0.2.2 → 0.3.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.
Files changed (38) hide show
  1. package/README.md +22 -15
  2. package/dist/Dashboard-4wv82gwx.js +212 -0
  3. package/dist/Dashboard-jkvfzyk2.js +210 -0
  4. package/dist/Dashboard-zhg2jtq5.js +211 -0
  5. package/dist/{Panel-fbp3wrsw.js → Panel-1qkzh8t7.js} +355 -311
  6. package/dist/Panel-7zpqz8gy.js +782 -0
  7. package/dist/Panel-9mmh3tbh.js +790 -0
  8. package/dist/Panel-ba0qzknj.js +789 -0
  9. package/dist/Panel-e6jyf4rc.js +789 -0
  10. package/dist/index-0dwhzk3j.js +145 -0
  11. package/dist/{index-6v0ns1xn.js → index-b8sq8rbd.js} +1 -1
  12. package/dist/index-rg87f3v1.js +174 -0
  13. package/dist/panel-app.js +27 -11
  14. package/dist/panel.css +2 -1
  15. package/dist/rack/types/metadata.d.ts +2 -1
  16. package/dist/react/donate.d.ts +1 -1
  17. package/dist/react/index.js +3 -3
  18. package/dist/react/page/Panel.d.ts +1 -0
  19. package/dist/react/page/components/Icon.d.ts +10 -0
  20. package/dist/react/page/components/Masthead.d.ts +5 -4
  21. package/package.json +8 -3
  22. package/dist/Dashboard-0da8dvbv.js +0 -225
  23. package/dist/Dashboard-2j561p7c.js +0 -225
  24. package/dist/Dashboard-5mt9hnbw.js +0 -252
  25. package/dist/Dashboard-7gmx8c9y.js +0 -248
  26. package/dist/Dashboard-s8nfyf7s.js +0 -39
  27. package/dist/Dashboard-xkh2g9f7.js +0 -248
  28. package/dist/Dashboard-xpstr7fr.js +0 -172
  29. package/dist/Panel-3yrk3krj.js +0 -914
  30. package/dist/Panel-b7jhgvnm.js +0 -916
  31. package/dist/Panel-n0kstkyw.js +0 -735
  32. package/dist/Panel-pkvqf5v8.js +0 -912
  33. package/dist/Panel-wjxjtbmr.js +0 -753
  34. package/dist/Panel-za4av616.js +0 -753
  35. package/dist/index-h3zbq796.js +0 -39
  36. package/dist/index-tgk4jt4d.js +0 -63
  37. package/dist/index-xsfqad54.js +0 -187
  38. package/dist/index-zc7rgvmm.js +0 -13
@@ -1,39 +0,0 @@
1
- // src/react/donate.ts
2
- var DEFAULT_DONATE_URL = "https://ko-fi.com/notoofly_manu";
3
- var DEFAULT_DONATE_LABEL = "☕ Donate";
4
- var globalDonate = { enabled: true, url: DEFAULT_DONATE_URL, label: DEFAULT_DONATE_LABEL };
5
- function setGlobalDonate(cfg) {
6
- if (cfg === false) {
7
- globalDonate = { enabled: false, url: DEFAULT_DONATE_URL, label: DEFAULT_DONATE_LABEL };
8
- return;
9
- }
10
- if (!cfg) {
11
- globalDonate = { enabled: true, url: DEFAULT_DONATE_URL, label: DEFAULT_DONATE_LABEL };
12
- return;
13
- }
14
- globalDonate = {
15
- enabled: cfg.enabled !== false,
16
- url: cfg.url ?? DEFAULT_DONATE_URL,
17
- label: cfg.label ?? DEFAULT_DONATE_LABEL
18
- };
19
- }
20
- function getGlobalDonate() {
21
- return globalDonate;
22
- }
23
- function resolveDonateProp(prop) {
24
- if (prop === false)
25
- return { enabled: false, url: DEFAULT_DONATE_URL, label: DEFAULT_DONATE_LABEL };
26
- if (prop === undefined)
27
- return getGlobalDonate();
28
- if (typeof prop === "object" && prop !== null) {
29
- const base = getGlobalDonate();
30
- return {
31
- enabled: prop.enabled !== false,
32
- url: prop.url ?? base.url,
33
- label: prop.label ?? base.label
34
- };
35
- }
36
- return getGlobalDonate();
37
- }
38
-
39
- export { setGlobalDonate, resolveDonateProp };
@@ -1,63 +0,0 @@
1
- // src/rack/registry.ts
2
- var registrations = new Map;
3
- function registerRack(reg) {
4
- registrations.set(reg.path, reg);
5
- }
6
- function listRacks() {
7
- return [...registrations.values()];
8
- }
9
- function getRack(id) {
10
- for (const r of registrations.values())
11
- if (r.metadata.id === id)
12
- return r;
13
- return;
14
- }
15
- function getRackTree() {
16
- const nodes = new Map;
17
- for (const r of registrations.values()) {
18
- nodes.set(r.metadata.id, { ...r, children: [] });
19
- }
20
- const roots = [];
21
- for (const node of nodes.values()) {
22
- const parentId = node.metadata.parent;
23
- if (parentId && nodes.has(parentId) && parentId !== node.metadata.id) {
24
- nodes.get(parentId).children.push(node);
25
- } else {
26
- roots.push(node);
27
- }
28
- }
29
- const sortNodes = (list) => {
30
- list.sort((a, b) => {
31
- const orderA = a.metadata.order ?? 0;
32
- const orderB = b.metadata.order ?? 0;
33
- if (orderA !== orderB)
34
- return orderA - orderB;
35
- const labelA = a.metadata.pluralLabel ?? a.metadata.label ?? a.metadata.id;
36
- const labelB = b.metadata.pluralLabel ?? b.metadata.label ?? b.metadata.id;
37
- return labelA.localeCompare(labelB);
38
- });
39
- for (const n of list)
40
- if (n.children.length)
41
- sortNodes(n.children);
42
- };
43
- sortNodes(roots);
44
- return roots;
45
- }
46
- function flatRackTree(tree = getRackTree()) {
47
- const out = [];
48
- const walk = (nodes) => {
49
- for (const n of nodes) {
50
- const { children, ...rest } = n;
51
- out.push(rest);
52
- if (children.length)
53
- walk(children);
54
- }
55
- };
56
- walk(tree);
57
- return out;
58
- }
59
- function clearRacks() {
60
- registrations.clear();
61
- }
62
-
63
- export { registerRack, listRacks, getRack, getRackTree, flatRackTree, clearRacks };
@@ -1,187 +0,0 @@
1
- // src/react/page/components/Breadcrumb.tsx
2
- import { jsxDEV } from "react/jsx-dev-runtime";
3
- function Breadcrumb({ trail }) {
4
- return /* @__PURE__ */ jsxDEV("nav", {
5
- "aria-label": "Breadcrumb",
6
- className: "pb-3 text-sm",
7
- children: /* @__PURE__ */ jsxDEV("ol", {
8
- className: "flex flex-wrap items-center gap-1.5",
9
- children: trail.map((item, i) => {
10
- const last = i === trail.length - 1;
11
- return /* @__PURE__ */ jsxDEV("li", {
12
- className: "flex items-center gap-1.5",
13
- children: [
14
- i > 0 ? /* @__PURE__ */ jsxDEV("span", {
15
- "aria-hidden": "true",
16
- className: "text-text-muted",
17
- children: "/"
18
- }, undefined, false, undefined, this) : null,
19
- item.href && !last ? /* @__PURE__ */ jsxDEV("a", {
20
- href: item.href,
21
- className: "text-text-muted hover:text-foreground",
22
- children: item.label
23
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV("span", {
24
- "aria-current": last ? "page" : undefined,
25
- className: last ? "text-foreground font-semibold" : "text-text-muted",
26
- children: item.label
27
- }, undefined, false, undefined, this)
28
- ]
29
- }, `${item.label}-${i}`, true, undefined, this);
30
- })
31
- }, undefined, false, undefined, this)
32
- }, undefined, false, undefined, this);
33
- }
34
-
35
- // src/react/page/components/Sidebar.tsx
36
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
37
- function SidebarItemView({ item, depth = 0 }) {
38
- const hasChildren = item.children && item.children.length > 0;
39
- return /* @__PURE__ */ jsxDEV2("li", {
40
- children: [
41
- /* @__PURE__ */ jsxDEV2("a", {
42
- href: item.href,
43
- "aria-current": item.active ? "page" : undefined,
44
- className: item.active ? "bg-sidebar-primary text-sidebar-primary-foreground flex items-center gap-2 rounded-md px-2 py-1.5 text-sm font-semibold" : "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground flex items-center gap-2 rounded-md px-2 py-1.5 text-sm",
45
- style: depth > 0 ? { paddingLeft: `${8 + depth * 12}px` } : undefined,
46
- children: [
47
- item.icon ? /* @__PURE__ */ jsxDEV2("span", {
48
- "aria-hidden": "true",
49
- children: item.icon
50
- }, undefined, false, undefined, this) : null,
51
- /* @__PURE__ */ jsxDEV2("span", {
52
- children: item.label
53
- }, undefined, false, undefined, this)
54
- ]
55
- }, undefined, true, undefined, this),
56
- hasChildren ? /* @__PURE__ */ jsxDEV2("ul", {
57
- className: "border-sidebar-border mt-0.5 ml-2 flex flex-col gap-0.5 border-l py-1 pl-2",
58
- children: item.children.map((child) => /* @__PURE__ */ jsxDEV2(SidebarItemView, {
59
- item: child,
60
- depth: depth + 1
61
- }, child.id, false, undefined, this))
62
- }, undefined, false, undefined, this) : null
63
- ]
64
- }, undefined, true, undefined, this);
65
- }
66
- function hasActive(items) {
67
- for (const it of items) {
68
- if (it.active)
69
- return true;
70
- if (it.children && hasActive(it.children))
71
- return true;
72
- }
73
- return false;
74
- }
75
- function Sidebar({ title, groups }) {
76
- return /* @__PURE__ */ jsxDEV2("aside", {
77
- className: "bg-sidebar text-sidebar-foreground border-sidebar-border min-h-0 w-64 shrink-0 overflow-y-auto rounded-lg border",
78
- children: [
79
- /* @__PURE__ */ jsxDEV2("div", {
80
- className: "border-sidebar-border border-b px-4 py-3",
81
- children: /* @__PURE__ */ jsxDEV2("p", {
82
- className: "font-koran text-xl font-black tracking-tight",
83
- children: title
84
- }, undefined, false, undefined, this)
85
- }, undefined, false, undefined, this),
86
- /* @__PURE__ */ jsxDEV2("nav", {
87
- className: "flex flex-col gap-4 p-3",
88
- children: groups.map((group) => /* @__PURE__ */ jsxDEV2("section", {
89
- children: /* @__PURE__ */ jsxDEV2("details", {
90
- className: "group",
91
- open: hasActive(group.items) || undefined,
92
- children: [
93
- /* @__PURE__ */ jsxDEV2("summary", {
94
- className: "font-koran border-sidebar-border flex cursor-pointer list-none items-center justify-between border-b px-2 pb-1 text-base font-bold tracking-tight [&::-webkit-details-marker]:hidden",
95
- children: [
96
- /* @__PURE__ */ jsxDEV2("span", {
97
- children: group.name
98
- }, undefined, false, undefined, this),
99
- /* @__PURE__ */ jsxDEV2("span", {
100
- "aria-hidden": "true",
101
- className: "text-text-muted text-xs transition group-open:rotate-180",
102
- children: "▾"
103
- }, undefined, false, undefined, this)
104
- ]
105
- }, undefined, true, undefined, this),
106
- /* @__PURE__ */ jsxDEV2("ul", {
107
- className: "border-sidebar-border mt-1 ml-2 flex flex-col gap-0.5 border-l py-1 pl-2",
108
- children: group.items.map((item) => /* @__PURE__ */ jsxDEV2(SidebarItemView, {
109
- item
110
- }, item.id, false, undefined, this))
111
- }, undefined, false, undefined, this)
112
- ]
113
- }, undefined, true, undefined, this)
114
- }, group.name, false, undefined, this))
115
- }, undefined, false, undefined, this)
116
- ]
117
- }, undefined, true, undefined, this);
118
- }
119
-
120
- // src/react/page/components/Masthead.tsx
121
- import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
122
- function Masthead({ title, group, resource, total }) {
123
- const today = new Date().toLocaleDateString("en-US", {
124
- weekday: "long",
125
- day: "numeric",
126
- month: "long",
127
- year: "numeric"
128
- });
129
- return /* @__PURE__ */ jsxDEV3("header", {
130
- className: "bg-header text-header-foreground",
131
- children: [
132
- /* @__PURE__ */ jsxDEV3("div", {
133
- className: "flex items-center justify-between gap-4 py-2 text-xs tracking-widest text-text-muted uppercase",
134
- children: [
135
- /* @__PURE__ */ jsxDEV3("span", {
136
- children: today
137
- }, undefined, false, undefined, this),
138
- /* @__PURE__ */ jsxDEV3("span", {
139
- className: "hidden sm:inline",
140
- children: "Daily Edition"
141
- }, undefined, false, undefined, this),
142
- /* @__PURE__ */ jsxDEV3("button", {
143
- id: "koran-theme-toggle",
144
- type: "button",
145
- className: "border-border hover:bg-navigation-hover rounded-full border px-3 py-1 tracking-widest uppercase",
146
- children: "◐ Theme"
147
- }, undefined, false, undefined, this)
148
- ]
149
- }, undefined, true, undefined, this),
150
- /* @__PURE__ */ jsxDEV3("h1", {
151
- className: "font-koran py-2 text-center text-5xl font-black tracking-tight",
152
- children: title
153
- }, undefined, false, undefined, this),
154
- /* @__PURE__ */ jsxDEV3("div", {
155
- className: "flex items-center justify-center gap-2 pb-3 text-sm text-text-muted",
156
- children: [
157
- group ? /* @__PURE__ */ jsxDEV3("span", {
158
- className: "uppercase",
159
- children: group
160
- }, undefined, false, undefined, this) : null,
161
- group && (resource || total !== undefined) ? /* @__PURE__ */ jsxDEV3("span", {
162
- "aria-hidden": "true",
163
- children: "·"
164
- }, undefined, false, undefined, this) : null,
165
- resource ? /* @__PURE__ */ jsxDEV3("span", {
166
- className: "font-mono text-xs",
167
- children: [
168
- "/",
169
- resource
170
- ]
171
- }, undefined, true, undefined, this) : null,
172
- total !== undefined ? /* @__PURE__ */ jsxDEV3("span", {
173
- children: [
174
- total,
175
- " records"
176
- ]
177
- }, undefined, true, undefined, this) : null
178
- ]
179
- }, undefined, true, undefined, this),
180
- /* @__PURE__ */ jsxDEV3("div", {
181
- className: "koran-rule-double"
182
- }, undefined, false, undefined, this)
183
- ]
184
- }, undefined, true, undefined, this);
185
- }
186
-
187
- export { Breadcrumb, Sidebar, Masthead };
@@ -1,13 +0,0 @@
1
- // src/rack/registry.ts
2
- var registrations = new Map;
3
- function registerRack(reg) {
4
- registrations.set(reg.path, reg);
5
- }
6
- function listRacks() {
7
- return [...registrations.values()];
8
- }
9
- function clearRacks() {
10
- registrations.clear();
11
- }
12
-
13
- export { registerRack, listRacks, clearRacks };