@fonderie/vue-admin-screens 0.7.0 → 1.0.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.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as vue from 'vue';
2
2
  import { PropType, VNode } from 'vue';
3
3
  import { AdminClient, ConfigAdminClient, CourierAdminClient, AuthAdminClient, BillingAdminClient, AuditAdminClient } from '@fonderie/client';
4
4
 
5
- type AdminPage = 'attention' | 'modules' | 'doctor' | 'config' | 'routes' | 'migrations' | 'tokens' | 'log' | 'settings' | 'templates' | 'users' | 'catalog' | 'subscriber' | 'audit';
5
+ type AdminPage = 'attention' | 'modules' | 'doctor' | 'environment' | 'routes' | 'migrations' | 'tokens' | 'log' | 'settings' | 'templates' | 'users' | 'catalog' | 'subscriber' | 'audit';
6
6
  declare const AdminShell: vue.DefineComponent<vue.ExtractPropTypes<{
7
7
  client: {
8
8
  type: PropType<AdminClient>;
@@ -77,12 +77,12 @@ declare const AdminShell: vue.DefineComponent<vue.ExtractPropTypes<{
77
77
  onNavigate?: (_page: AdminPage) => any;
78
78
  }>, {
79
79
  page: AdminPage;
80
+ environment: string;
80
81
  configClient: ConfigAdminClient;
81
82
  courierClient: CourierAdminClient;
82
83
  authClient: AuthAdminClient;
83
84
  billingClient: BillingAdminClient;
84
85
  auditClient: AuditAdminClient;
85
- environment: string;
86
86
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
87
87
 
88
88
  declare const AttentionScreen: vue.DefineComponent<vue.ExtractPropTypes<{
@@ -127,7 +127,7 @@ declare const DoctorScreen: vue.DefineComponent<vue.ExtractPropTypes<{
127
127
  };
128
128
  }>> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
129
129
 
130
- declare const ConfigScreen: vue.DefineComponent<vue.ExtractPropTypes<{
130
+ declare const EnvironmentScreen: vue.DefineComponent<vue.ExtractPropTypes<{
131
131
  client: {
132
132
  type: PropType<AdminClient>;
133
133
  required: true;
@@ -293,4 +293,4 @@ declare const AuditScreen: vue.DefineComponent<vue.ExtractPropTypes<{
293
293
  pageSize: number;
294
294
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
295
295
 
296
- export { AdminLogScreen, type AdminPage, AdminShell, AttentionScreen, AuditScreen, CatalogScreen, ConfigScreen, DoctorScreen, MigrationsScreen, ModulesScreen, RoutesScreen, SubscriberScreen, TokensScreen, UsersScreen };
296
+ export { AdminLogScreen, type AdminPage, AdminShell, AttentionScreen, AuditScreen, CatalogScreen, DoctorScreen, EnvironmentScreen, MigrationsScreen, ModulesScreen, RoutesScreen, SubscriberScreen, TokensScreen, UsersScreen };
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: "system-ui, sans-serif",
12
- color: "#111"
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: "11px",
44
+ fontSize: 11,
17
45
  textTransform: "uppercase",
18
- letterSpacing: "0.6px",
19
- color: "#888",
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: "6px",
57
+ borderRadius: t.radius,
29
58
  padding: "6px 8px",
30
59
  cursor: "pointer",
31
- fontSize: "14px",
32
- color: "#111"
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
- navItemActive: { background: "#f3f4f6", fontWeight: 600 },
35
- main: { flex: 1, padding: "24px", maxWidth: "960px" },
36
- container: { padding: "24px", maxWidth: "960px" },
37
- title: { fontSize: "20px", fontWeight: 700, marginTop: 0, marginBottom: "12px" },
38
- subtitle: { fontSize: "15px", fontWeight: 600, marginTop: "24px", marginBottom: "8px" },
39
- status: { padding: "12px", color: "#666" },
40
- error: { color: "#e11d48", marginBottom: "12px", fontSize: "14px" },
41
- ok: { color: "#15803d", fontWeight: 600 },
42
- bad: { color: "#e11d48", fontWeight: 600 },
43
- advice: { color: "#b45309" },
44
- muted: { color: "#666", fontSize: "13px" },
45
- mono: { fontFamily: "ui-monospace, monospace", fontSize: "13px" },
46
- table: { width: "100%", borderCollapse: "collapse", fontSize: "14px" },
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: "1px solid #ddd",
91
+ borderBottom: `1px solid ${t.border}`,
50
92
  padding: "6px 8px",
51
93
  fontWeight: 600,
52
- color: "#444"
94
+ color: t.muted
53
95
  },
54
- td: { borderBottom: "1px solid #eee", padding: "6px 8px", verticalAlign: "top" },
96
+ td: { borderBottom: `1px solid ${t.borderLight}`, padding: "6px 8px", verticalAlign: "top" },
55
97
  list: { listStyle: "none", padding: 0, margin: 0 },
56
- row: { borderBottom: "1px solid #eee", padding: "8px 0" },
98
+ row: { borderBottom: `1px solid ${t.borderLight}`, padding: "8px 0" },
57
99
  badge: {
58
100
  display: "inline-block",
59
- borderRadius: "999px",
101
+ borderRadius: 999,
60
102
  padding: "1px 8px",
61
- fontSize: "12px",
62
- background: "#f3f4f6"
103
+ fontSize: 12,
104
+ background: t.surfaceAlt,
105
+ border: `1px solid ${t.border}`,
106
+ color: t.muted
63
107
  },
64
108
  button: {
65
- background: "none",
66
- border: "1px solid #ddd",
67
- borderRadius: "8px",
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: "13px"
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
- toolbar: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }
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((t) => h("th", { style: styles.th }, t))
157
+ headers.map((t2) => h("th", { style: styles.th }, t2))
101
158
  )
102
159
  ]),
103
160
  h("tbody", rows)
@@ -205,14 +262,14 @@ var AttentionScreen = defineComponent2({
205
262
  }
206
263
  });
207
264
 
208
- // src/screens/ConfigScreen.ts
209
- import { useAdminConfig } from "@fonderie/vue-admin";
265
+ // src/screens/EnvironmentScreen.ts
266
+ import { useAdminEnvironment } from "@fonderie/vue-admin";
210
267
  import { defineComponent as defineComponent3, h as h4 } from "vue";
211
- var ConfigScreen = defineComponent3({
212
- name: "FonderieConfigScreen",
268
+ var EnvironmentScreen = defineComponent3({
269
+ name: "FonderieEnvironmentScreen",
213
270
  props: { client: { type: Object, required: true } },
214
271
  setup(props) {
215
- const { report, isLoading, error } = useAdminConfig(props.client);
272
+ const { report, isLoading, error } = useAdminEnvironment(props.client);
216
273
  return () => page("Configuration", { isLoading, error }, () => {
217
274
  const r = report.value;
218
275
  if (!r) return null;
@@ -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((t) => {
520
- minted.value = { name: t.name, token: t.token };
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
- (t) => h9("tr", { key: t.id }, [
623
+ (t2) => h9("tr", { key: t2.id }, [
567
624
  td([
568
- t.name,
569
- t.revokedAt ? h9("span", { style: styles.badge }, " revoked") : ""
625
+ t2.name,
626
+ t2.revokedAt ? h9("span", { style: styles.badge }, " revoked") : ""
570
627
  ]),
571
- td(t.scopes.join(", "), styles.mono),
628
+ td(t2.scopes.join(", "), styles.mono),
572
629
  td(
573
- `${new Date(t.createdAt).toLocaleDateString()} \xB7 ${t.createdBy}`,
630
+ `${new Date(t2.createdAt).toLocaleDateString()} \xB7 ${t2.createdBy}`,
574
631
  styles.muted
575
632
  ),
576
633
  td(
577
- t.expiresAt ? new Date(t.expiresAt).toLocaleDateString() : "never",
634
+ t2.expiresAt ? new Date(t2.expiresAt).toLocaleDateString() : "never",
578
635
  styles.muted
579
636
  ),
580
637
  td(
581
- t.lastUsedAt ? new Date(t.lastUsedAt).toLocaleString() : "never",
638
+ t2.lastUsedAt ? new Date(t2.lastUsedAt).toLocaleString() : "never",
582
639
  styles.muted
583
640
  ),
584
641
  td(
585
- t.revokedAt ? "" : h9(
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 "${t.name}"? Anything using it stops working immediately.`
649
+ `Revoke "${t2.name}"? Anything using it stops working immediately.`
593
650
  ))
594
- void revoke(t.id).catch(() => {
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: "#f9fafb",
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 = (t, id) => {
962
+ const open = (t2, id) => {
906
963
  granted.value = null;
907
- type.value = t;
964
+ type.value = t2;
908
965
  idInput.value = id;
909
- subscriber.value = { type: t, id };
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
- (t) => h12("tr", { key: t.id }, [
1090
- td(new Date(t.createdAt).toLocaleString(), styles.muted),
1091
- td(t.type),
1092
- td(t.amount, styles.mono),
1093
- td(t.description ?? "", styles.muted)
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
  ),
@@ -1200,7 +1257,7 @@ var NAV = [
1200
1257
  group: "System",
1201
1258
  items: [
1202
1259
  { page: "modules", label: "Modules" },
1203
- { page: "config", label: "Configuration" },
1260
+ { page: "environment", label: "Environment" },
1204
1261
  { page: "doctor", label: "Doctor" },
1205
1262
  { page: "routes", label: "Routes" }
1206
1263
  ]
@@ -1268,8 +1325,8 @@ var AdminShell = defineComponent13({
1268
1325
  return h14(ModulesScreen, { client: c });
1269
1326
  case "doctor":
1270
1327
  return h14(DoctorScreen, { client: c });
1271
- case "config":
1272
- return h14(ConfigScreen, { client: c });
1328
+ case "environment":
1329
+ return h14(EnvironmentScreen, { client: c });
1273
1330
  case "routes":
1274
1331
  return h14(RoutesScreen, { client: c });
1275
1332
  case "tokens":
@@ -1345,7 +1402,7 @@ var AdminShell = defineComponent13({
1345
1402
  ];
1346
1403
  return h14(TemplateListScreen, {
1347
1404
  client: kc,
1348
- "onSelect-template": (t) => editing.value = { kind: "template", type: t.type }
1405
+ "onSelect-template": (t2) => editing.value = { kind: "template", type: t2.type }
1349
1406
  });
1350
1407
  }
1351
1408
  }
@@ -1390,8 +1447,8 @@ export {
1390
1447
  AttentionScreen,
1391
1448
  AuditScreen,
1392
1449
  CatalogScreen,
1393
- ConfigScreen,
1394
1450
  DoctorScreen,
1451
+ EnvironmentScreen,
1395
1452
  MigrationsScreen,
1396
1453
  ModulesScreen,
1397
1454
  RoutesScreen,