@fonderie/vue-admin-screens 0.7.0 → 0.8.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/index.cjs +115 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +115 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,20 +4,49 @@ import { TemplateEditorScreen, TemplateListScreen } from "@fonderie/vue-courier-
|
|
|
4
4
|
import { computed as computed2, defineComponent as defineComponent13, h as h14, ref as ref5 } from "vue";
|
|
5
5
|
|
|
6
6
|
// src/styles.ts
|
|
7
|
+
var t = {
|
|
8
|
+
text: "var(--fonderie-text,#171717)",
|
|
9
|
+
muted: "var(--fonderie-text-muted,#5c5c5c)",
|
|
10
|
+
bg: "var(--fonderie-bg,#fafafa)",
|
|
11
|
+
surface: "var(--fonderie-surface,#fff)",
|
|
12
|
+
surfaceAlt: "var(--fonderie-surface-alt,#fafafa)",
|
|
13
|
+
border: "var(--fonderie-border,#e0e0e0)",
|
|
14
|
+
borderLight: "var(--fonderie-border-light,#f5f5f5)",
|
|
15
|
+
accent: "var(--fonderie-accent,#00d294)",
|
|
16
|
+
accentStrong: "var(--fonderie-accent-strong,#009767)",
|
|
17
|
+
warning: "var(--fonderie-warning,#f5a623)",
|
|
18
|
+
danger: "var(--fonderie-danger,#e00)",
|
|
19
|
+
font: 'var(--fonderie-font,Inter,"Inter Fallback",-apple-system,BlinkMacSystemFont,"Helvetica Neue",system-ui,sans-serif)',
|
|
20
|
+
mono: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace)',
|
|
21
|
+
radius: "var(--fonderie-radius,4px)",
|
|
22
|
+
radiusLg: "var(--fonderie-radius-lg,8px)",
|
|
23
|
+
trackingDisplay: "var(--fonderie-tracking-display,-0.05em)",
|
|
24
|
+
shadowCard: "var(--fonderie-shadow-card,0 2px 3px 0 rgba(0,0,0,.05))"
|
|
25
|
+
};
|
|
7
26
|
var styles = {
|
|
8
27
|
shell: {
|
|
9
28
|
display: "flex",
|
|
10
29
|
minHeight: "100vh",
|
|
11
|
-
fontFamily:
|
|
12
|
-
color:
|
|
30
|
+
fontFamily: t.font,
|
|
31
|
+
color: t.text,
|
|
32
|
+
background: t.bg
|
|
33
|
+
},
|
|
34
|
+
// The sidebar sits on the raised surface against the page canvas, which is
|
|
35
|
+
// what separates the two without a heavy rule between them.
|
|
36
|
+
nav: {
|
|
37
|
+
width: 220,
|
|
38
|
+
borderRight: `1px solid ${t.border}`,
|
|
39
|
+
padding: 16,
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
background: t.surface
|
|
13
42
|
},
|
|
14
|
-
nav: { width: "220px", borderRight: "1px solid #eee", padding: "16px", flexShrink: 0 },
|
|
15
43
|
navGroup: {
|
|
16
|
-
fontSize:
|
|
44
|
+
fontSize: 11,
|
|
17
45
|
textTransform: "uppercase",
|
|
18
|
-
letterSpacing:
|
|
19
|
-
color:
|
|
20
|
-
margin: "16px 0 6px"
|
|
46
|
+
letterSpacing: 0.6,
|
|
47
|
+
color: t.muted,
|
|
48
|
+
margin: "16px 0 6px",
|
|
49
|
+
fontWeight: 600
|
|
21
50
|
},
|
|
22
51
|
navItem: {
|
|
23
52
|
display: "block",
|
|
@@ -25,51 +54,79 @@ var styles = {
|
|
|
25
54
|
textAlign: "left",
|
|
26
55
|
background: "none",
|
|
27
56
|
border: "none",
|
|
28
|
-
borderRadius:
|
|
57
|
+
borderRadius: t.radius,
|
|
29
58
|
padding: "6px 8px",
|
|
30
59
|
cursor: "pointer",
|
|
31
|
-
fontSize:
|
|
32
|
-
color:
|
|
60
|
+
fontSize: 14,
|
|
61
|
+
color: t.text,
|
|
62
|
+
fontFamily: "inherit"
|
|
63
|
+
},
|
|
64
|
+
navItemActive: { background: t.surfaceAlt, fontWeight: 600, color: t.accentStrong },
|
|
65
|
+
main: { flex: 1, padding: 24, maxWidth: 960 },
|
|
66
|
+
container: { padding: 24, maxWidth: 960 },
|
|
67
|
+
title: {
|
|
68
|
+
fontSize: 20,
|
|
69
|
+
fontWeight: 600,
|
|
70
|
+
marginTop: 0,
|
|
71
|
+
marginBottom: 12,
|
|
72
|
+
letterSpacing: t.trackingDisplay
|
|
33
73
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
74
|
+
subtitle: {
|
|
75
|
+
fontSize: 15,
|
|
76
|
+
fontWeight: 600,
|
|
77
|
+
marginTop: 24,
|
|
78
|
+
marginBottom: 8,
|
|
79
|
+
letterSpacing: t.trackingDisplay
|
|
80
|
+
},
|
|
81
|
+
status: { padding: 12, color: t.muted },
|
|
82
|
+
error: { color: t.danger, marginBottom: 12, fontSize: 14 },
|
|
83
|
+
ok: { color: t.accentStrong, fontWeight: 600 },
|
|
84
|
+
bad: { color: t.danger, fontWeight: 600 },
|
|
85
|
+
advice: { color: t.warning },
|
|
86
|
+
muted: { color: t.muted, fontSize: 13 },
|
|
87
|
+
mono: { fontFamily: t.mono, fontSize: 13 },
|
|
88
|
+
table: { width: "100%", borderCollapse: "collapse", fontSize: 14 },
|
|
47
89
|
th: {
|
|
48
90
|
textAlign: "left",
|
|
49
|
-
borderBottom:
|
|
91
|
+
borderBottom: `1px solid ${t.border}`,
|
|
50
92
|
padding: "6px 8px",
|
|
51
93
|
fontWeight: 600,
|
|
52
|
-
color:
|
|
94
|
+
color: t.muted
|
|
53
95
|
},
|
|
54
|
-
td: { borderBottom:
|
|
96
|
+
td: { borderBottom: `1px solid ${t.borderLight}`, padding: "6px 8px", verticalAlign: "top" },
|
|
55
97
|
list: { listStyle: "none", padding: 0, margin: 0 },
|
|
56
|
-
row: { borderBottom:
|
|
98
|
+
row: { borderBottom: `1px solid ${t.borderLight}`, padding: "8px 0" },
|
|
57
99
|
badge: {
|
|
58
100
|
display: "inline-block",
|
|
59
|
-
borderRadius:
|
|
101
|
+
borderRadius: 999,
|
|
60
102
|
padding: "1px 8px",
|
|
61
|
-
fontSize:
|
|
62
|
-
background:
|
|
103
|
+
fontSize: 12,
|
|
104
|
+
background: t.surfaceAlt,
|
|
105
|
+
border: `1px solid ${t.border}`,
|
|
106
|
+
color: t.muted
|
|
63
107
|
},
|
|
64
108
|
button: {
|
|
65
|
-
background:
|
|
66
|
-
border:
|
|
67
|
-
borderRadius:
|
|
109
|
+
background: t.surface,
|
|
110
|
+
border: `1px solid ${t.border}`,
|
|
111
|
+
borderRadius: t.radius,
|
|
68
112
|
padding: "4px 10px",
|
|
69
113
|
cursor: "pointer",
|
|
70
|
-
fontSize:
|
|
114
|
+
fontSize: 13,
|
|
115
|
+
color: t.text,
|
|
116
|
+
fontFamily: "inherit",
|
|
117
|
+
boxShadow: t.shadowCard
|
|
118
|
+
},
|
|
119
|
+
toolbar: { display: "flex", gap: 8, alignItems: "center", marginBottom: 12 },
|
|
120
|
+
// Surfaces the screens compose themselves, kept here so a card looks the
|
|
121
|
+
// same on every page rather than being re-invented per screen.
|
|
122
|
+
card: {
|
|
123
|
+
background: t.surface,
|
|
124
|
+
border: `1px solid ${t.border}`,
|
|
125
|
+
borderRadius: t.radiusLg,
|
|
126
|
+
padding: 16,
|
|
127
|
+
boxShadow: t.shadowCard
|
|
71
128
|
},
|
|
72
|
-
|
|
129
|
+
accent: { color: t.accent }
|
|
73
130
|
};
|
|
74
131
|
|
|
75
132
|
// src/screens/AdminLogScreen.ts
|
|
@@ -97,7 +154,7 @@ function table(headers, rows) {
|
|
|
97
154
|
h("thead", [
|
|
98
155
|
h(
|
|
99
156
|
"tr",
|
|
100
|
-
headers.map((
|
|
157
|
+
headers.map((t2) => h("th", { style: styles.th }, t2))
|
|
101
158
|
)
|
|
102
159
|
]),
|
|
103
160
|
h("tbody", rows)
|
|
@@ -516,8 +573,8 @@ var TokensScreen = defineComponent8({
|
|
|
516
573
|
name: name.value.trim(),
|
|
517
574
|
scopes: scopes.value,
|
|
518
575
|
...days.value && Number.isInteger(d) && d > 0 ? { expiresInDays: d } : {}
|
|
519
|
-
}).then((
|
|
520
|
-
minted.value = { name:
|
|
576
|
+
}).then((t2) => {
|
|
577
|
+
minted.value = { name: t2.name, token: t2.token };
|
|
521
578
|
name.value = "";
|
|
522
579
|
days.value = "";
|
|
523
580
|
}).catch(() => {
|
|
@@ -563,35 +620,35 @@ var TokensScreen = defineComponent8({
|
|
|
563
620
|
r?.issued && r.issued.length > 0 ? table(
|
|
564
621
|
["Name", "Scopes", "Created", "Expires", "Last used", ""],
|
|
565
622
|
r.issued.map(
|
|
566
|
-
(
|
|
623
|
+
(t2) => h9("tr", { key: t2.id }, [
|
|
567
624
|
td([
|
|
568
|
-
|
|
569
|
-
|
|
625
|
+
t2.name,
|
|
626
|
+
t2.revokedAt ? h9("span", { style: styles.badge }, " revoked") : ""
|
|
570
627
|
]),
|
|
571
|
-
td(
|
|
628
|
+
td(t2.scopes.join(", "), styles.mono),
|
|
572
629
|
td(
|
|
573
|
-
`${new Date(
|
|
630
|
+
`${new Date(t2.createdAt).toLocaleDateString()} \xB7 ${t2.createdBy}`,
|
|
574
631
|
styles.muted
|
|
575
632
|
),
|
|
576
633
|
td(
|
|
577
|
-
|
|
634
|
+
t2.expiresAt ? new Date(t2.expiresAt).toLocaleDateString() : "never",
|
|
578
635
|
styles.muted
|
|
579
636
|
),
|
|
580
637
|
td(
|
|
581
|
-
|
|
638
|
+
t2.lastUsedAt ? new Date(t2.lastUsedAt).toLocaleString() : "never",
|
|
582
639
|
styles.muted
|
|
583
640
|
),
|
|
584
641
|
td(
|
|
585
|
-
|
|
642
|
+
t2.revokedAt ? "" : h9(
|
|
586
643
|
"button",
|
|
587
644
|
{
|
|
588
645
|
type: "button",
|
|
589
646
|
style: styles.button,
|
|
590
647
|
onClick: () => {
|
|
591
648
|
if (window.confirm(
|
|
592
|
-
`Revoke "${
|
|
649
|
+
`Revoke "${t2.name}"? Anything using it stops working immediately.`
|
|
593
650
|
))
|
|
594
|
-
void revoke(
|
|
651
|
+
void revoke(t2.id).catch(() => {
|
|
595
652
|
});
|
|
596
653
|
}
|
|
597
654
|
},
|
|
@@ -842,7 +899,7 @@ var CatalogScreen = defineComponent10({
|
|
|
842
899
|
{
|
|
843
900
|
style: {
|
|
844
901
|
...styles.mono,
|
|
845
|
-
background: "
|
|
902
|
+
background: "var(--fonderie-surface-alt,#fafafa)",
|
|
846
903
|
padding: "12px",
|
|
847
904
|
overflowX: "auto"
|
|
848
905
|
}
|
|
@@ -902,11 +959,11 @@ var SubscriberScreen = defineComponent11({
|
|
|
902
959
|
const subscriber = ref3(null);
|
|
903
960
|
const list = useAdminSubscribers(props.client, { limit: props.pageSize });
|
|
904
961
|
const { subscription, wallet, ledger, hasMoreLedger, isLoading, error, loadMoreLedger, grant } = useAdminSubscriber(props.client, subscriber, { limit: 20 });
|
|
905
|
-
const open = (
|
|
962
|
+
const open = (t2, id) => {
|
|
906
963
|
granted.value = null;
|
|
907
|
-
type.value =
|
|
964
|
+
type.value = t2;
|
|
908
965
|
idInput.value = id;
|
|
909
|
-
subscriber.value = { type:
|
|
966
|
+
subscriber.value = { type: t2, id };
|
|
910
967
|
};
|
|
911
968
|
const amount = ref3("");
|
|
912
969
|
const note = ref3("");
|
|
@@ -1086,11 +1143,11 @@ var SubscriberScreen = defineComponent11({
|
|
|
1086
1143
|
ledger.value.length === 0 ? h12("p", { style: styles.muted }, "Nothing moved yet.") : table(
|
|
1087
1144
|
["When", "Kind", "Amount", "Note"],
|
|
1088
1145
|
ledger.value.map(
|
|
1089
|
-
(
|
|
1090
|
-
td(new Date(
|
|
1091
|
-
td(
|
|
1092
|
-
td(
|
|
1093
|
-
td(
|
|
1146
|
+
(t2) => h12("tr", { key: t2.id }, [
|
|
1147
|
+
td(new Date(t2.createdAt).toLocaleString(), styles.muted),
|
|
1148
|
+
td(t2.type),
|
|
1149
|
+
td(t2.amount, styles.mono),
|
|
1150
|
+
td(t2.description ?? "", styles.muted)
|
|
1094
1151
|
])
|
|
1095
1152
|
)
|
|
1096
1153
|
),
|
|
@@ -1345,7 +1402,7 @@ var AdminShell = defineComponent13({
|
|
|
1345
1402
|
];
|
|
1346
1403
|
return h14(TemplateListScreen, {
|
|
1347
1404
|
client: kc,
|
|
1348
|
-
"onSelect-template": (
|
|
1405
|
+
"onSelect-template": (t2) => editing.value = { kind: "template", type: t2.type }
|
|
1349
1406
|
});
|
|
1350
1407
|
}
|
|
1351
1408
|
}
|