@axium/client 0.42.1 → 0.44.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/assets/styles.css CHANGED
@@ -63,6 +63,10 @@ button:where(.reset) {
63
63
  &:hover {
64
64
  background-color: unset;
65
65
  }
66
+
67
+ &:disabled {
68
+ border: none;
69
+ }
66
70
  }
67
71
 
68
72
  input,
@@ -256,6 +260,7 @@ div.success {
256
260
  }
257
261
 
258
262
  :disabled,
263
+ :disabled + label.checkbox,
259
264
  .disabled {
260
265
  cursor: not-allowed;
261
266
  color: var(--fg-disabled);
package/assets/theme.css CHANGED
@@ -30,6 +30,9 @@
30
30
 
31
31
  /* html is used so themes can use :root to override these if needed */
32
32
  html {
33
+ --color-scheme: dark;
34
+ color-scheme: var(--color-scheme);
35
+
33
36
  --bg-normal: hsl(0 0 var(--bg-light));
34
37
  --bg-menu: hsl(0 0 calc(var(--bg-light) - var(--light-step)));
35
38
  --bg-accent: hsl(var(--hue) 15 calc(var(--bg-light) + (var(--light-step) * 2)));
@@ -53,7 +56,7 @@ html {
53
56
 
54
57
  --green: hsl(140 50 50);
55
58
 
56
- --border-disabled: 1px solid hsl(0 5 calc(var(--bg-light) - var(--light-step)));
59
+ --border-disabled: 1px solid hsl(0 5 calc(var(--bg-light) + (var(--light-step) * 2)));
57
60
  --border-accent: 1px solid hsl(var(--hue) 10 calc(var(--bg-light) + (var(--light-step) * 3)));
58
61
  --border-alt: 1px solid var(--bg-alt);
59
62
  --border-strong: 1px solid hsl(var(--hue) 20 calc(var(--bg-light) + (var(--light-step) * 3)));
package/dist/cache.js CHANGED
@@ -11,6 +11,15 @@ function isThenable(value) {
11
11
  return !!(value && typeof value == 'object' && 'then' in value && typeof value.then == 'function');
12
12
  }
13
13
  const kTimestamp = Symbol('kTimestamp');
14
+ function withTimestamp(value, timestamp = Date.now()) {
15
+ Object.defineProperty(value, kTimestamp, {
16
+ value: timestamp,
17
+ enumerable: false,
18
+ configurable: false,
19
+ writable: false,
20
+ });
21
+ return value;
22
+ }
14
23
  /**
15
24
  * Cache some arbitrary operation.
16
25
  * This is primarily intended for de-duplicating API requests
@@ -52,7 +61,7 @@ export class Cache {
52
61
  const [key] = this.items.entries().next().value;
53
62
  this.items.delete(key);
54
63
  }
55
- this.items.set(key, Object.assign(value, { [kTimestamp]: Date.now() }));
64
+ this.items.set(key, withTimestamp(value));
56
65
  this.onWrite?.(this.toJSON());
57
66
  }
58
67
  get(...keys) {
@@ -89,7 +98,7 @@ export class Cache {
89
98
  if (!this.valid($timestamp))
90
99
  continue;
91
100
  delete value.$timestamp;
92
- this.items.set(key, Object.assign(value, { [kTimestamp]: $timestamp }));
101
+ this.items.set(key, withTimestamp(value, $timestamp));
93
102
  }
94
103
  }
95
104
  toJSON() {
@@ -31,6 +31,7 @@ export declare const meta: Handle<z.ZodObject<{
31
31
  expires: z.ZodCoercedDate<unknown>;
32
32
  created: z.ZodCoercedDate<unknown>;
33
33
  elevated: z.ZodBoolean;
34
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
35
  user: z.ZodObject<{
35
36
  id: z.ZodUUID;
36
37
  name: z.ZodString;
@@ -40,6 +41,7 @@ export declare const meta: Handle<z.ZodObject<{
40
41
  preferences: z.ZodLazy<z.ZodObject<{
41
42
  debug: z.ZodDefault<z.ZodBoolean>;
42
43
  theme: z.ZodDefault<z.ZodLiteral<"default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano">>;
44
+ time_zone: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<string>, z.ZodString]>>;
43
45
  }, z.core.$strip>>;
44
46
  roles: z.ZodArray<z.ZodString>;
45
47
  tags: z.ZodArray<z.ZodString>;
@@ -39,6 +39,7 @@ export declare function session(): {
39
39
  preferences: {
40
40
  debug: boolean;
41
41
  theme: "default" | "light" | "forest" | "midnight" | "beach" | "cherry" | "volcano";
42
+ time_zone?: string | undefined;
42
43
  };
43
44
  roles: string[];
44
45
  tags: string[];
@@ -49,4 +50,5 @@ export declare function session(): {
49
50
  emailVerified?: Date | null | undefined;
50
51
  };
51
52
  name?: string | null | undefined;
53
+ timezone?: string | null | undefined;
52
54
  };
@@ -1,6 +1,6 @@
1
1
  import type { APIParameters, Endpoint, RequestBody, Result } from '@axium/core/api';
2
2
  import { $API } from '@axium/core/api';
3
- import type { RequestMethod } from '@axium/core/requests';
3
+ import { type RequestMethod } from '@axium/core/requests';
4
4
  export declare let token: string | null;
5
5
  export declare function setToken(value: string | null): void;
6
6
  export declare let prefix: string, origin: string;
@@ -14,4 +14,6 @@ export declare let userAgent: string | null;
14
14
  * Only for use on non-browser clients, e.g. Node.js
15
15
  */
16
16
  export declare function useUserAgent(ua: string | null): void;
17
+ /** Logs the warnings the server sent about a request */
18
+ export declare function logWarnings(response: Response): void;
17
19
  export declare function fetchAPI<const E extends Endpoint, const M extends keyof $API[E] & RequestMethod>(method: M, endpoint: E, data?: RequestBody<M, E>, ...params: APIParameters<E>): Promise<Result<M, E>>;
package/dist/requests.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { $API } from '@axium/core/api';
2
2
  import { errorText } from 'ioium';
3
+ import { decodeWarnings, warningsHeader } from '@axium/core/requests';
3
4
  import { prettifyError } from 'zod';
4
5
  // @ts-expect-error 2339
5
6
  BigInt.prototype.toJSON = function () {
@@ -31,6 +32,11 @@ export let userAgent = null;
31
32
  export function useUserAgent(ua) {
32
33
  userAgent = ua;
33
34
  }
35
+ /** Logs the warnings the server sent about a request */
36
+ export function logWarnings(response) {
37
+ for (const warning of decodeWarnings(response.headers.get(warningsHeader)))
38
+ console.warn('[API]', warning);
39
+ }
34
40
  export async function fetchAPI(method, endpoint, data, ...params) {
35
41
  const options = {
36
42
  method,
@@ -77,13 +83,9 @@ export async function fetchAPI(method, endpoint, data, ...params) {
77
83
  throw new Error(`Unexpected response type: ${response.headers.get('Content-Type')}`);
78
84
  }
79
85
  const json = await response.json().catch(() => ({ message: 'Unknown server error (invalid JSON response)' }));
86
+ logWarnings(response);
80
87
  if (!response.ok)
81
88
  throw Object.assign(new Error(json.message), { status: response.status });
82
- if (typeof json == 'object' && json != null && '_warnings' in json) {
83
- for (const warning of json._warnings)
84
- console.warn('[API]', warning);
85
- delete json._warnings;
86
- }
87
89
  if (!schema)
88
90
  return json;
89
91
  const Output = Array.isArray(schema) ? schema[1] : schema;
package/dist/socket.js CHANGED
@@ -7,7 +7,8 @@ export function addListener(event, listener) {
7
7
  const schema = ServerToClient[event];
8
8
  if (!schema)
9
9
  io.warn(`Attaching a listener to the '${event}' socket event without schema`);
10
- const entry = [event, schema ? schema.implement(listener) : listener];
10
+ const run = (...args) => void listener(...args);
11
+ const entry = [event, schema ? schema.implement(run) : listener];
11
12
  listeners.add(entry);
12
13
  socket?.on(...entry);
13
14
  }
package/dist/themes.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export const themeStyles = Object.assign(Object.create(null), {
2
2
  light: {
3
+ 'color-scheme': 'light',
3
4
  'fg-light': '10%',
4
5
  'bg-light': '70%',
5
6
  'light-step': '-6%',
@@ -15,6 +16,7 @@ export const themeStyles = Object.assign(Object.create(null), {
15
16
  'light-step': '2.5%',
16
17
  },
17
18
  beach: {
19
+ 'color-scheme': 'light',
18
20
  hue: '50',
19
21
  'fg-light': '30%',
20
22
  'bg-light': '60%',
package/dist/user.js CHANGED
@@ -28,14 +28,18 @@ export async function loginWithAutofill() {
28
28
  return await fetchAPI('POST', 'login', response);
29
29
  }
30
30
  let _currentSession = null;
31
+ /** Fetches the current session, reporting this device's time zone */
32
+ function fetchSession() {
33
+ return fetchAPI('POST', 'session', { timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
34
+ }
31
35
  export async function getCurrentSession() {
32
- _currentSession ||= await fetchAPI('GET', 'session');
36
+ _currentSession ||= await fetchSession();
33
37
  return _currentSession;
34
38
  }
35
39
  /** Get the current session, or `null` if there isn't a valid one (e.g. missing or expired) */
36
40
  export async function currentSession() {
37
41
  try {
38
- _currentSession ||= await fetchAPI('GET', 'session');
42
+ _currentSession ||= await fetchSession();
39
43
  return _currentSession;
40
44
  }
41
45
  catch (e) {
@@ -3,7 +3,7 @@
3
3
  import { preferences as uap } from '@axium/client';
4
4
  import { structurallyEqual } from 'utilium';
5
5
  import type { ZodObject } from 'zod';
6
- import ZodInput from './ZodInput.svelte';
6
+ import ZodForm from './ZodForm.svelte';
7
7
  import { toast } from './toast.js';
8
8
 
9
9
  const {
@@ -11,7 +11,14 @@
11
11
  appId,
12
12
  schema,
13
13
  _parentDialog,
14
- }: { userId: string; appId: string; schema: ZodObject; _parentDialog?: HTMLDialogElement } = $props();
14
+ onsave,
15
+ }: {
16
+ userId: string;
17
+ appId: string;
18
+ schema: ZodObject;
19
+ _parentDialog?: HTMLDialogElement;
20
+ onsave?(preferences: object): void;
21
+ } = $props();
15
22
 
16
23
  let initialValue = $state(await uap.get(userId, appId));
17
24
  let currentValue = $state({ ...initialValue });
@@ -23,6 +30,7 @@
23
30
 
24
31
  async function save() {
25
32
  initialValue = await uap.set(userId, appId, currentValue);
33
+ onsave?.(initialValue);
26
34
  if (!_parentDialog) return;
27
35
  _parentDialog.close();
28
36
  toast('success', text('AppPreferences.toast_saved'));
@@ -31,7 +39,7 @@
31
39
 
32
40
  <h2>{text('AppPreferences.title', { name: text(`app_name.${appId}`) })}</h2>
33
41
 
34
- <ZodInput {schema} updateValue={() => {}} bind:rootValue={currentValue} path="" />
42
+ <ZodForm {schema} updateValue={() => {}} bind:rootValue={currentValue} />
35
43
 
36
44
  <div class="actions">
37
45
  <button onclick={cancel}>{text('generic.cancel')}</button>
@@ -4,7 +4,8 @@
4
4
  import Icon from './Icon.svelte';
5
5
  import { text } from '@axium/client';
6
6
 
7
- const { userId, appId, schema }: { userId: string; appId: string; schema: ZodObject } = $props();
7
+ const { userId, appId, schema, onsave }: { userId: string; appId: string; schema: ZodObject; onsave?(preferences: object): void } =
8
+ $props();
8
9
 
9
10
  const id = 'AppPreferencesDialog:' + appId;
10
11
 
@@ -17,5 +18,5 @@
17
18
  </button>
18
19
 
19
20
  <dialog bind:this={_parentDialog} {id}>
20
- <AppPreferences {userId} {appId} {schema} {_parentDialog} />
21
+ <AppPreferences {userId} {appId} {schema} {_parentDialog} {onsave} />
21
22
  </dialog>
package/lib/Icon.svelte CHANGED
@@ -1,11 +1,12 @@
1
1
  <script lang="ts">
2
2
  import type { SVGAttributes } from 'svelte/elements';
3
- const { i, ...rest }: { i: string } & SVGAttributes<SVGSVGElement> = $props();
3
+ const { i, title, ...rest }: { i: string; title?: string } & SVGAttributes<SVGSVGElement> = $props();
4
4
  const [style, id] = $derived(i.includes('/') ? i.split('/') : ['solid', i]);
5
5
  const href = $derived(`/icons/${style}.svg#${id}`);
6
6
  </script>
7
7
 
8
8
  <svg {...rest} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="1em" height="1em" class={['Icon', rest.class]}>
9
+ {#if title}<title>{title}</title>{/if}
9
10
  <use {href} />
10
11
  </svg>
11
12
 
@@ -95,6 +95,7 @@
95
95
  margin: -0.1em 0;
96
96
  font: inherit;
97
97
  color: inherit;
98
+ width: 100%;
98
99
  min-width: 0;
99
100
  flex: 1 1 auto;
100
101
  anchor-name: --inline-edit;
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ /** From 0 to 1. Without a finite number, the bar shows activity instead. */
3
+ const { value }: { value?: number | null } = $props();
4
+
5
+ const measured = $derived(typeof value == 'number' && Number.isFinite(value));
6
+ </script>
7
+
8
+ <div
9
+ class={['ProgressBar', !measured && 'indeterminate']}
10
+ role="progressbar"
11
+ aria-valuenow={measured ? Math.round(value! * 100) : undefined}
12
+ aria-valuemin={0}
13
+ aria-valuemax={100}
14
+ >
15
+ <div class="fill" style:width={measured ? `${value! * 100}%` : undefined}></div>
16
+ </div>
17
+
18
+ <style>
19
+ .ProgressBar {
20
+ height: 3px;
21
+ border-radius: 2px;
22
+ background-color: var(--bg-strong);
23
+ overflow: hidden;
24
+
25
+ .fill {
26
+ height: 100%;
27
+ background-color: var(--fg-accent);
28
+ transition: width 0.5s;
29
+ }
30
+ }
31
+
32
+ .indeterminate .fill {
33
+ width: 30%;
34
+ animation: slide 1.5s ease-in-out infinite;
35
+ }
36
+
37
+ @keyframes slide {
38
+ from {
39
+ translate: -100%;
40
+ }
41
+
42
+ to {
43
+ translate: 340%;
44
+ }
45
+ }
46
+ </style>
@@ -0,0 +1,97 @@
1
+ <script lang="ts">
2
+ import { text } from '@axium/client';
3
+ import type { SecretInfo, SecretStore } from '@axium/core';
4
+ import ClipboardCopy from './ClipboardCopy.svelte';
5
+ import FormDialog from './FormDialog.svelte';
6
+ import Icon from './Icon.svelte';
7
+
8
+ interface Props {
9
+ info: SecretInfo;
10
+ /** Title of the edit dialog */
11
+ label?: string;
12
+ /** Stores a new value, which allows editing when the secret is editable */
13
+ save?(value: string): unknown;
14
+ minLength?: number | null;
15
+ maxLength?: number | null;
16
+ }
17
+
18
+ const { info, label, save, minLength, maxLength }: Props = $props();
19
+
20
+ let dialog = $state<HTMLDialogElement>(),
21
+ saved = $state(false);
22
+
23
+ const source = $derived<SecretStore | null>(saved ? 'file' : info.source),
24
+ store = $derived<SecretStore>(source ?? (info.editable ? 'file' : 'systemd')),
25
+ name = $derived(store == 'systemd' ? 'axium.' + info.id : info.id);
26
+
27
+ async function submit(data: Record<string, FormDataEntryValue>) {
28
+ await save!(String(data.value));
29
+ saved = true;
30
+ dialog?.querySelector('form')?.reset();
31
+ }
32
+ </script>
33
+
34
+ <span class={['Secret', !source && 'unset']}>
35
+ <Icon i={store == 'systemd' ? 'lock-keyhole' : 'file-lock'} title={text(`Secret.${source ?? 'unset'}`, { id: info.id })} />
36
+ <code>{name}</code>
37
+ <ClipboardCopy value={name} />
38
+ {#if save && info.editable}
39
+ <button type="button" title={text(source ? 'Secret.replace' : 'Secret.add')} onclick={() => dialog?.showModal()}>
40
+ <Icon i="pencil" />
41
+ </button>
42
+ <FormDialog bind:dialog clearOnCancel submitText={text('Secret.save')} {submit}>
43
+ <div class="Secret-heading">
44
+ {#if label}<strong>{label}</strong>{/if}
45
+ {#if source}<span>{text('Secret.replace_notice')}</span>{/if}
46
+ </div>
47
+ <textarea
48
+ name="value"
49
+ autocomplete="off"
50
+ autocapitalize="off"
51
+ spellcheck="false"
52
+ required
53
+ minlength={minLength || 1}
54
+ maxlength={maxLength ?? undefined}></textarea>
55
+ </FormDialog>
56
+ {/if}
57
+ </span>
58
+
59
+ <style>
60
+ .Secret {
61
+ display: inline-flex;
62
+ align-items: center;
63
+ gap: 0.5em;
64
+ min-width: 0;
65
+
66
+ &.unset > code {
67
+ color: var(--fg-disabled);
68
+ }
69
+
70
+ > button {
71
+ display: inline-flex;
72
+ padding: 0;
73
+ border: none;
74
+ background: transparent;
75
+ }
76
+ }
77
+
78
+ code {
79
+ overflow: hidden;
80
+ text-overflow: ellipsis;
81
+ }
82
+
83
+ .Secret-heading {
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: 0.25em;
87
+ }
88
+
89
+ textarea {
90
+ width: min(30em, 70vw);
91
+ field-sizing: content;
92
+ resize: none;
93
+ min-height: 3lh;
94
+ max-height: 10lh;
95
+ font-family: monospace;
96
+ }
97
+ </style>
package/lib/TopBar.svelte CHANGED
@@ -4,7 +4,7 @@
4
4
  import AppMenu from './AppMenu.svelte';
5
5
  import Icon from './Icon.svelte';
6
6
  import PWAIndicator from './PWAIndicator.svelte';
7
- import { currentContent } from './TopBarContent.svelte';
7
+ import { currentContent, topBarMiddle } from './TopBarContent.svelte';
8
8
  import UserMenu from './UserMenu.svelte';
9
9
  import Boundary from './Boundary.svelte';
10
10
 
@@ -19,9 +19,6 @@
19
19
  {#if content.icon}<Icon i={content.icon} --size="1.25em" />{/if}
20
20
  <span>{content.name}</span>
21
21
  </a>
22
- {#if content.children}
23
- <div class="middle" style:justify-content={content.align ?? 'center'}>{@render content.children()}</div>
24
- {/if}
25
22
  {:else}
26
23
  <a class="title" href="/">
27
24
  <img src="/favicon.svg" alt="" />
@@ -31,6 +28,8 @@
31
28
  </a>
32
29
  {/if}
33
30
 
31
+ <div class="middle" style:justify-content={content?.align ?? 'center'} {@attach topBarMiddle}></div>
32
+
34
33
  <div class="end">
35
34
  <PWAIndicator />
36
35
  {#if user}<AppMenu />{/if}
@@ -104,7 +103,7 @@
104
103
  padding: 0.5em 0.75em;
105
104
  }
106
105
 
107
- .TopBar:has(.middle) .title span {
106
+ .TopBar:has(.middle:not(:empty)) .title span {
108
107
  display: none;
109
108
  }
110
109
 
@@ -1,5 +1,6 @@
1
1
  <script module lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
+ import type { Attachment } from 'svelte/attachments';
3
4
 
4
5
  export interface TopBarContentProps {
5
6
  name: string;
@@ -12,11 +13,20 @@
12
13
  }
13
14
 
14
15
  let stack = $state.raw<TopBarContentProps[]>([]);
16
+ let middle = $state<HTMLElement>();
15
17
 
16
18
  /** The content registered by the most recently mounted `TopBarContent`. */
17
19
  export function currentContent(): TopBarContentProps | undefined {
18
20
  return stack.at(-1);
19
21
  }
22
+
23
+ /** Marks the element in the top bar that the current content's children are moved into. */
24
+ export const topBarMiddle: Attachment<HTMLElement> = element => {
25
+ middle = element;
26
+ return () => {
27
+ if (middle === element) middle = undefined;
28
+ };
29
+ };
20
30
  </script>
21
31
 
22
32
  <script lang="ts">
@@ -28,4 +38,19 @@
28
38
  onDestroy(() => {
29
39
  stack = stack.filter(entry => entry !== props);
30
40
  });
41
+
42
+ const moveToTopBar: Attachment<HTMLElement> = element => {
43
+ middle?.append(element);
44
+ return () => element.remove();
45
+ };
31
46
  </script>
47
+
48
+ {#if props.children && currentContent() === props && middle}
49
+ <div class="TopBarContent" {@attach moveToTopBar}>{@render props.children()}</div>
50
+ {/if}
51
+
52
+ <style>
53
+ .TopBarContent {
54
+ display: contents;
55
+ }
56
+ </style>
@@ -1,38 +1,230 @@
1
- <script lang="ts">
2
- import { type ReplacementOptions, text } from '@axium/client/locales';
1
+ <script lang="ts" module>
2
+ import type { SecretInfo, ZodPref } from '@axium/core';
3
+ import feature from '@axium/core/features';
3
4
  import * as locales from '@james-pre/locales';
4
- import type { ZodObject } from 'zod';
5
+
6
+ /** Context holding a getter for information about secret fields, keyed by path */
7
+ export const secretsContext = Symbol('ZodForm:secrets');
8
+ export type SecretsGetter = () => Record<string, SecretInfo> | undefined;
9
+
10
+ /** The schema a modifier or composite is rendered as */
11
+ function inner(schema: ZodPref): ZodPref | undefined {
12
+ switch (schema.type) {
13
+ case 'readonly':
14
+ case 'default':
15
+ case 'nullable':
16
+ case 'optional':
17
+ case 'nonoptional':
18
+ case 'success':
19
+ return schema.def.innerType;
20
+ case 'pipe':
21
+ return schema.def.in;
22
+ case 'union':
23
+ return schema.def.options[0];
24
+ case 'intersection':
25
+ return schema.def.left;
26
+ }
27
+ }
28
+
29
+ function unwrap(schema: ZodPref): ZodPref {
30
+ const next = inner(schema);
31
+ return next ? unwrap(next) : schema;
32
+ }
33
+
34
+ /** The outermost translation metadata registered on a schema or the schemas it wraps */
35
+ function infoOf(schema: ZodPref): locales.ZodInfo | undefined {
36
+ const next = inner(schema);
37
+ return locales.zod.get(schema) ?? (next && infoOf(next));
38
+ }
39
+
40
+ function isAvailable(schema: ZodPref): boolean {
41
+ const flag = infoOf(schema)?.feature;
42
+ if (flag && !feature(flag)) return false;
43
+ const base = unwrap(schema);
44
+ return base.type != 'object' || Object.values<ZodPref>(base.shape).some(isAvailable);
45
+ }
46
+
47
+ function isSection(schema: ZodPref): boolean {
48
+ const { type } = unwrap(schema);
49
+ return type == 'object' || type == 'record';
50
+ }
51
+ </script>
52
+
53
+ <script lang="ts">
54
+ import { text } from '@axium/client';
55
+ import { getContext, setContext } from 'svelte';
56
+ import { getByString } from 'utilium';
57
+ import Icon from './Icon.svelte';
5
58
  import ZodInput from './ZodInput.svelte';
6
59
 
7
60
  interface Props {
8
61
  rootValue: any;
9
- schema: ZodObject;
10
- labels?: Record<string, string>;
11
- updateValue(value: any): void;
62
+ schema: Extract<ZodPref, { type: 'object' | 'record' }>;
63
+ /** May return a promise, which secret fields wait on to report errors */
64
+ updateValue(value: any): unknown;
12
65
  idPrefix?: string;
66
+ /** Where the value is in `rootValue`, which renders the form as a section when set */
67
+ path?: string;
68
+ label?: string;
69
+ localeInfo?: locales.ZodInfo;
70
+ /** Whether fields are ordered by key instead of by the schema */
71
+ sort?: boolean;
72
+ /** Information about secret fields, keyed by path */
73
+ secrets?: Record<string, SecretInfo>;
74
+ }
75
+
76
+ let {
77
+ rootValue = $bindable(),
78
+ schema,
79
+ updateValue,
80
+ idPrefix,
81
+ path = '',
82
+ label,
83
+ localeInfo = locales.zod.get(schema),
84
+ sort,
85
+ secrets,
86
+ }: Props = $props();
87
+
88
+ const parentSecrets = getContext<SecretsGetter | undefined>(secretsContext);
89
+ setContext<SecretsGetter>(secretsContext, () => secrets ?? parentSecrets?.());
90
+
91
+ /** A section's `enabled` field, which disables the rest of the section when false */
92
+ const toggle = $derived.by((): ZodPref | undefined => {
93
+ if (!path || schema.type != 'object') return;
94
+ const field: ZodPref | undefined = schema.shape.enabled;
95
+ if (field && unwrap(field).type == 'boolean') return field;
96
+ });
97
+
98
+ function valueAt(root: any): Record<string, unknown> {
99
+ return { ...(path ? getByString(root, path) : root) };
100
+ }
101
+
102
+ /** A copy of this object's value, replaced when a field changes since `rootValue` may not be deeply reactive */
103
+ let value = $derived(valueAt(rootValue));
104
+
105
+ function update(root: any): unknown {
106
+ value = valueAt(root);
107
+ return updateValue(root);
108
+ }
109
+
110
+ /** Whether each sibling field named in `requires` has one of the values it lists */
111
+ function meets(requires: Record<string, readonly unknown[]>): boolean {
112
+ if (schema.type != 'object') return true;
113
+ return Object.entries(requires).every(([key, allowed]) => {
114
+ const field: ZodPref | undefined = schema.shape[key];
115
+ return !field || allowed.includes(field.safeParse(value[key]).data);
116
+ });
13
117
  }
14
118
 
15
- let { rootValue = $bindable(), schema, labels, updateValue, idPrefix }: Props = $props();
119
+ const entries = $derived.by((): [string, ZodPref][] => {
120
+ if (schema.type == 'record') return Object.keys(value).map(key => [key, schema.valueType]);
121
+
122
+ const visible = Object.entries<ZodPref>(schema.shape).filter(([key, child]) => !(toggle && key == 'enabled') && isAvailable(child));
123
+ if (sort) visible.sort(([a], [b]) => a.localeCompare(b));
124
+ return [...visible.filter(([, child]) => !isSection(child)), ...visible.filter(([, child]) => isSection(child))];
125
+ });
16
126
 
17
- const localeInfo = locales.zod.get(schema);
127
+ /** A field's translation metadata, where sections without their own prefix nest under this form's prefix */
128
+ function childInfo(key: string, child: ZodPref): locales.ZodInfo | undefined {
129
+ const info = infoOf(child);
130
+ if (schema.type == 'record' || !isSection(child) || info?.prefix || !localeInfo?.prefix) return info;
131
+ return { ...info, prefix: `${localeInfo.prefix}.${key}` };
132
+ }
18
133
 
19
- function subText(name: string, replacements?: ReplacementOptions & Record<string, any>): string | undefined {
20
- if (!localeInfo?.prefix) return replacements?.$default || labels?.[name] || name;
21
- return text(`${localeInfo.prefix}.${name}`, replacements);
134
+ /** Sections are titled by the `$title` key under their prefix, or by their key when it is missing */
135
+ function childLabel(key: string, child: ZodPref, info?: locales.ZodInfo): string | undefined {
136
+ if (schema.type == 'record') return key;
137
+ if (info?.key) return;
138
+ if (info?.prefix && isSection(child)) return text(`${info.prefix}.$title`, { $default: key });
139
+ return localeInfo?.prefix ? text(`${localeInfo.prefix}.${key}`) : key;
22
140
  }
23
141
  </script>
24
142
 
25
- <div class="ZodForm">
26
- {#each Object.keys(schema.shape).sort((a, b) => a.localeCompare(b)) as path}
27
- <ZodInput bind:rootValue {updateValue} {idPrefix} {path} schema={schema.shape[path]} label={subText(path)} />
143
+ {#snippet field(key: string, child: ZodPref)}
144
+ {const info = childInfo(key, child)}
145
+ <ZodInput
146
+ bind:rootValue
147
+ updateValue={update}
148
+ {idPrefix}
149
+ path={path ? `${path}.${key}` : key}
150
+ schema={child}
151
+ localeInfo={info}
152
+ label={childLabel(key, child, info)}
153
+ />
154
+ {/snippet}
155
+
156
+ {#snippet fields()}
157
+ {#each entries as [key, child] (key)}
158
+ {const requires = infoOf(child)?.requires}
159
+ {#if requires}
160
+ <fieldset class="ZodForm-requires" disabled={!meets(requires)}>{@render field(key, child)}</fieldset>
161
+ {:else}
162
+ {@render field(key, child)}
163
+ {/if}
28
164
  {/each}
29
- </div>
165
+ {/snippet}
166
+
167
+ {#if !path}
168
+ <div class="ZodForm">{@render fields()}</div>
169
+ {:else if toggle || entries.length}
170
+ <fieldset class="ZodForm" disabled={toggle && !meets({ enabled: [true] })}>
171
+ <legend>
172
+ {#if toggle}
173
+ <ZodInput bind:rootValue updateValue={update} {idPrefix} path="{path}.enabled" schema={toggle} {label} />
174
+ {:else}
175
+ {label}
176
+ {/if}
177
+ {#if localeInfo?.experimental}<Icon
178
+ i="regular/flask"
179
+ class="ZodInput-experimental"
180
+ title={text('ZodInput.experimental')}
181
+ />{/if}
182
+ </legend>
183
+ {@render fields()}
184
+ </fieldset>
185
+ {/if}
30
186
 
31
187
  <style>
32
188
  .ZodForm {
189
+ display: grid;
190
+ grid-template-columns: fit-content(50%) minmax(0, 30em);
191
+ align-items: center;
192
+ gap: 0.75em 1.5em;
193
+ }
194
+
195
+ fieldset.ZodForm {
196
+ grid-column: 1 / -1;
197
+ grid-template-columns: subgrid;
198
+ margin: 0.75em 0 0;
199
+ padding: 0;
200
+ border: none;
201
+ min-width: 0;
202
+
203
+ &:disabled {
204
+ color: inherit;
205
+ cursor: auto;
206
+
207
+ > :not(legend) {
208
+ color: var(--fg-disabled);
209
+ }
210
+ }
211
+ }
212
+
213
+ .ZodForm-requires {
214
+ display: contents;
215
+ }
216
+
217
+ legend {
33
218
  display: flex;
34
- flex-direction: column;
35
- align-items: stretch;
36
- gap: 1em;
219
+ align-items: center;
220
+ padding: 0 0 0.75em;
221
+ font-weight: bold;
222
+
223
+ > :global(.ZodInput) {
224
+ display: flex;
225
+ flex-direction: row-reverse;
226
+ align-items: center;
227
+ gap: 0.5em;
228
+ }
37
229
  }
38
230
  </style>
@@ -3,10 +3,13 @@
3
3
  import type { ZodPref } from '@axium/core';
4
4
  import feature from '@axium/core/features';
5
5
  import * as locales from '@james-pre/locales';
6
+ import { getContext } from 'svelte';
6
7
  import type { HTMLInputAttributes } from 'svelte/elements';
7
8
  import { getByString, pick, setByString } from 'utilium';
8
9
  import { prettifyError, type z } from 'zod';
9
10
  import Icon from './Icon.svelte';
11
+ import Secret from './Secret.svelte';
12
+ import ZodForm, { secretsContext, type SecretsGetter } from './ZodForm.svelte';
10
13
  import ZodInput from './ZodInput.svelte';
11
14
 
12
15
  interface Props {
@@ -21,7 +24,7 @@
21
24
  optional?: boolean;
22
25
  readonly?: boolean;
23
26
  noLabel?: boolean | 'placeholder';
24
- updateValue(value: any): void;
27
+ updateValue(value: any): unknown;
25
28
  }
26
29
 
27
30
  let { rootValue = $bindable(), ...props }: Props = $props();
@@ -42,6 +45,8 @@
42
45
 
43
46
  const id = (idPrefix ? idPrefix + ':' : '') + path.replaceAll(' ', '_');
44
47
 
48
+ const secrets = getContext<SecretsGetter | undefined>(secretsContext);
49
+
45
50
  let value = $state<any>(getByString(rootValue, path));
46
51
 
47
52
  let lastRoot = rootValue;
@@ -96,15 +101,31 @@
96
101
  const oldValue = getByString(rootValue, path);
97
102
  if (val == oldValue) return;
98
103
 
99
- if (defaultValue == val) {
100
- const parts = path.split('.');
101
- const prop = parts.pop()!;
102
- delete getByString<Record<string, any>>(rootValue, parts.join('.'))![prop];
103
- } else setByString(rootValue, path, val);
104
+ if (defaultValue == val) removeValue();
105
+ else setByString(rootValue, path, val);
104
106
 
105
107
  updateValue(rootValue);
106
108
  }
107
109
 
110
+ function removeValue() {
111
+ const parts = path.split('.');
112
+ const prop = parts.pop()!;
113
+ delete getByString<Record<string, any>>(rootValue, parts.join('.'))![prop];
114
+ }
115
+
116
+ /** Sends a new secret, then drops it from `rootValue` so later updates don't send it again */
117
+ async function saveSecret(secret: string) {
118
+ const result = schema.safeParse(secret);
119
+ if (!result.success) throw prettifyError(result.error);
120
+
121
+ setByString(rootValue, path, result.data);
122
+ try {
123
+ await updateValue(rootValue);
124
+ } finally {
125
+ removeValue();
126
+ }
127
+ }
128
+
108
129
  const oninput = onchange;
109
130
 
110
131
  function isSchemaPart(part: unknown): part is z.core.$ZodType {
@@ -155,9 +176,21 @@
155
176
  const largeArrayTypes = ['object', 'array', 'record', 'tuple', 'template_literal'];
156
177
  </script>
157
178
 
179
+ {#snippet labelFor(target: string)}
180
+ {#if !noLabel}
181
+ <label for={target}>
182
+ {labelText}{#if localeInfo?.experimental}<Icon
183
+ i="regular/flask"
184
+ class="ZodInput-experimental"
185
+ title={text('ZodInput.experimental')}
186
+ />{/if}
187
+ </label>
188
+ {/if}
189
+ {/snippet}
190
+
158
191
  {#snippet _in(rest: HTMLInputAttributes)}
159
192
  <div class={['ZodInput', noLabel && 'no-label']}>
160
- {#if !noLabel}<label for={id}>{labelText}</label>{/if}
193
+ {@render labelFor(id)}
161
194
  {#if error}<span class="ZodInput-error">{error}</span>{/if}
162
195
  <input
163
196
  {id}
@@ -176,6 +209,33 @@
176
209
 
177
210
  {#if localeInfo?.feature && !feature(localeInfo.feature)}
178
211
  <meta data-feature={localeInfo.feature} />
212
+ {:else if schema.type == 'string' && localeInfo?.secret}
213
+ <div class={['ZodInput', noLabel && 'no-label']}>
214
+ {@render labelFor(id)}
215
+ <Secret
216
+ info={secrets?.()?.[path] ?? { id: path, source: null, editable: true }}
217
+ label={labelText}
218
+ save={readonly ? undefined : saveSecret}
219
+ minLength={schema.minLength}
220
+ maxLength={schema.maxLength}
221
+ />
222
+ </div>
223
+ {:else if schema.type == 'string' && localeInfo?.multiline}
224
+ <div class={['ZodInput', 'multiline', noLabel && 'no-label']}>
225
+ {@render labelFor(id)}
226
+ {#if error}<span class="ZodInput-error">{error}</span>{/if}
227
+ <textarea
228
+ {id}
229
+ bind:value
230
+ {onchange}
231
+ {oninput}
232
+ required={!optional}
233
+ minlength={schema.minLength}
234
+ maxlength={schema.maxLength}
235
+ {placeholder}
236
+ {readonly}
237
+ class={[error && 'error']}></textarea>
238
+ </div>
179
239
  {:else if schema.type == 'string'}
180
240
  {@render _in({ type: schema.format == 'email' ? 'email' : 'text', ...pick(schema, 'minLength', 'maxLength') })}
181
241
  {:else if schema.type == 'number'}
@@ -183,13 +243,13 @@
183
243
  {:else if schema.type == 'bigint'}
184
244
  {@render _in({ type: 'number', min: Number(schema.minValue), max: Number(schema.maxValue), step: 1 })}
185
245
  {:else if schema.type == 'boolean'}
186
- <div class={['ZodInput', noLabel && 'no-label']}>
187
- {#if !noLabel}<label for="{id}:checkbox">{labelText}</label>{/if}
246
+ <span class={['ZodInput', noLabel && 'no-label']}>
247
+ {@render labelFor(`${id}:checkbox`)}
188
248
  <input bind:checked={value} id="{id}:checkbox" type="checkbox" {onchange} required={!optional} {placeholder} />
189
249
  <label for="{id}:checkbox" {id} class="checkbox">
190
250
  {#if value}<Icon i="check" --size="1.3em" />{/if}
191
251
  </label>
192
- </div>
252
+ </span>
193
253
  {:else if schema.type == 'date'}
194
254
  {@render _in({
195
255
  type: 'date',
@@ -200,7 +260,7 @@
200
260
  <!-- todo -->
201
261
  {:else if schema.type == 'literal'}
202
262
  <div class="ZodInput">
203
- <label for={id}>{labelText}</label>
263
+ {@render labelFor(id)}
204
264
  <select bind:value {id} {onchange} required={!optional}>
205
265
  {#each schema.values as literal}
206
266
  <option value={literal} selected={value === literal}>{subText(String(literal), { $default: String(literal) })}</option>
@@ -210,7 +270,7 @@
210
270
  {:else if schema.type == 'template_literal'}
211
271
  {const parts = splitTemplate(schema.def.parts, value)}
212
272
  <div class={['ZodInput', noLabel && 'no-label']}>
213
- {#if !noLabel}<label for={id}>{labelText}</label>{/if}
273
+ {@render labelFor(id)}
214
274
  {#if error}<span class="ZodInput-error">{error}</span>{/if}
215
275
  <div class={['ZodInput-template', error && 'error']}>
216
276
  {#each schema.def.parts as part, i}
@@ -262,7 +322,7 @@
262
322
  <ZodInput bind:rootValue {...props} {localeInfo} label={labelText} schema={schema.def.innerType} optional={false} />
263
323
  {:else if schema.type == 'array'}
264
324
  <div class={['ZodInput', noLabel && 'no-label']}>
265
- {#if !noLabel}<label for={id}>{labelText}</label>{/if}
325
+ {@render labelFor(id)}
266
326
  <div class={['ZodInput-array', largeArrayTypes.includes(schema.element.type) && 'large']}>
267
327
  {#each value, i}
268
328
  <div class="ZodInput-element">
@@ -286,21 +346,18 @@
286
346
  </button>
287
347
  </div>
288
348
  </div>
349
+ {:else if (schema.type == 'record' || schema.type == 'object') && !noLabel}
350
+ <ZodForm bind:rootValue {updateValue} {idPrefix} {path} {schema} {localeInfo} label={labelText} />
289
351
  {:else if schema.type == 'record'}
290
352
  <div class="ZodInput-record">
291
353
  {#each Object.keys(value) as key}
292
- <div class="ZodInput-record-entry">
293
- {#if !noLabel}<label for={id}>{key}</label>{/if}
294
- <ZodInput bind:rootValue {updateValue} {idPrefix} {noLabel} path="{path}.{key}" schema={schema.valueType} />
295
- </div>
354
+ <ZodInput bind:rootValue {updateValue} {idPrefix} {noLabel} path="{path}.{key}" schema={schema.valueType} />
296
355
  {/each}
297
356
  </div>
298
357
  {:else if schema.type == 'object'}
299
- <!-- <div class="ZodInput-object"> -->
300
358
  {#each Object.entries(schema.shape) as [key, value]}
301
359
  <ZodInput bind:rootValue {updateValue} {idPrefix} {noLabel} path="{path}.{key}" schema={value} label={subText(key)} />
302
360
  {/each}
303
- <!-- </div> -->
304
361
  {:else if schema.type == 'tuple'}
305
362
  <div class="ZodInput-tuple" data-rest={schema.def.rest}>
306
363
  {#each schema.def.items as item, i}
@@ -309,7 +366,7 @@
309
366
  </div>
310
367
  {:else if schema.type == 'enum'}
311
368
  <div class={['ZodInput', noLabel && 'no-label']}>
312
- {#if !noLabel}<label for={id}>{labelText}</label>{/if}
369
+ {@render labelFor(id)}
313
370
  {#if error}<span class="ZodInput-error">{error}</span>{/if}
314
371
  <select {id} {onchange} bind:value required={!optional}>
315
372
  {#each Object.entries(schema.enum) as [name, enumValue]}
@@ -318,19 +375,24 @@
318
375
  </select>
319
376
  </div>
320
377
  {:else if schema.type == 'success'}
321
- <ZodInput bind:rootValue {...props} label={labelText} schema={schema.def.innerType} {_parseSchema} />
378
+ <ZodInput bind:rootValue {...props} {localeInfo} label={labelText} schema={schema.def.innerType} {_parseSchema} />
322
379
  {:else if schema.type == 'pipe'}
323
- <ZodInput bind:rootValue {...props} label={labelText} schema={schema.def.in} {_parseSchema} />
380
+ <ZodInput bind:rootValue {...props} {localeInfo} label={labelText} schema={schema.def.in} {_parseSchema} />
324
381
  {:else if schema.type == 'union'}
325
- <ZodInput bind:rootValue {...props} label={labelText} schema={schema.def.options[0]} {_parseSchema} />
382
+ <ZodInput bind:rootValue {...props} {localeInfo} label={labelText} schema={schema.def.options[0]} {_parseSchema} />
326
383
  {:else if schema.type == 'intersection'}
327
- <ZodInput bind:rootValue {...props} label={labelText} schema={schema.def.left} {_parseSchema} />
384
+ <ZodInput bind:rootValue {...props} {localeInfo} label={labelText} schema={schema.def.left} {_parseSchema} />
328
385
  {:else}
329
386
  <!-- No idea how to render this -->
330
387
  <i class="error">{text('ZodInput.invalid_type', { type: JSON.stringify((schema as ZodPref)?.def?.type) })}</i>
331
388
  {/if}
332
389
 
333
390
  <style>
391
+ :global(.ZodInput-experimental) {
392
+ margin-left: 0.4em;
393
+ vertical-align: -0.1em;
394
+ }
395
+
334
396
  .ZodInput-error {
335
397
  position: fixed;
336
398
  position-anchor: --zod-input;
@@ -345,11 +407,24 @@
345
407
  gap: 1em;
346
408
  anchor-scope: --zod-input;
347
409
 
348
- input {
410
+ input,
411
+ textarea {
349
412
  anchor-name: --zod-input;
350
413
  }
351
414
  }
352
415
 
416
+ .ZodInput.multiline {
417
+ grid-template-columns: minmax(0, 1fr);
418
+ gap: 0.5em;
419
+
420
+ textarea {
421
+ field-sizing: content;
422
+ resize: none;
423
+ min-height: 4lh;
424
+ max-height: 20lh;
425
+ }
426
+ }
427
+
353
428
  .ZodInput.no-label {
354
429
  grid-template-columns: minmax(0, 1fr);
355
430
  }
@@ -416,7 +491,6 @@
416
491
  }
417
492
  }
418
493
 
419
- .ZodInput-object,
420
494
  .ZodInput-record,
421
495
  .ZodInput-tuple {
422
496
  display: flex;
@@ -424,4 +498,27 @@
424
498
  align-items: stretch;
425
499
  gap: 0.25em;
426
500
  }
501
+
502
+ :global(.ZodForm) > .ZodInput,
503
+ :global(.ZodForm-requires) > .ZodInput {
504
+ grid-column: 1 / -1;
505
+ grid-template-columns: subgrid;
506
+ column-gap: normal;
507
+ align-items: center;
508
+
509
+ &.multiline > :not(.ZodInput-error) {
510
+ grid-column: 1 / -1;
511
+ }
512
+
513
+ > label.checkbox {
514
+ justify-self: start;
515
+ }
516
+
517
+ @media (width < 700px) {
518
+ &:not(:has(> label.checkbox)) {
519
+ grid-template-columns: minmax(0, 1fr);
520
+ row-gap: 0.25em;
521
+ }
522
+ }
523
+ }
427
524
  </style>
@@ -117,7 +117,7 @@ export function contextMenu(...menuItems: ContextMenuEntry[] | [() => ContextMen
117
117
  if (!_forcePopover) return;
118
118
  e.stopPropagation();
119
119
  e.preventDefault();
120
- menu.togglePopover();
120
+ if (!menu.matches(':popover-open')) menu.showPopover();
121
121
  _forcePopover = false;
122
122
  };
123
123
 
@@ -2,47 +2,7 @@
2
2
  * Svelte attachments
3
3
  * @see https://svelte.dev/docs/svelte/@attach
4
4
  */
5
- import type { Attachment } from 'svelte/attachments';
6
-
7
5
  export * from './context-menu.js';
8
6
  export * as drag from './drag-and-drop.js';
9
7
  export * from './gestures.js';
10
8
  export * from './selection.js';
11
-
12
- /**
13
- * Dynamically resize `<textarea>`s based on content.
14
- * @todo Remove this once `field-sizing` works everywhere
15
- */
16
- export function dynamicRows(max: number = 40, min: number = 3): Attachment<HTMLTextAreaElement> {
17
- return function _attachDynamicRows(element: HTMLTextAreaElement) {
18
- element.style.resize = 'none';
19
- element.style.fieldSizing = 'content';
20
- element.style.height = 'max-content';
21
- element.style.overflowY = 'auto';
22
-
23
- /** Counts wrapped lines as well as explicit ones. */
24
- function update() {
25
- element.rows = 2;
26
- const twoRows = element.clientHeight;
27
- element.rows = 1;
28
- const oneRow = element.clientHeight;
29
- const lines = 1 + Math.round((element.scrollHeight - oneRow) / (twoRows - oneRow));
30
- element.rows = Math.max(Math.min(lines, max), min);
31
- }
32
-
33
- if (CSS.supports('field-sizing', 'content')) return;
34
- update();
35
- element.addEventListener('input', update);
36
- let width = element.clientWidth;
37
- const resize = new ResizeObserver(() => {
38
- if (element.clientWidth == width) return;
39
- width = element.clientWidth;
40
- update();
41
- });
42
- resize.observe(element);
43
- return () => {
44
- element.removeEventListener('input', update);
45
- resize.disconnect();
46
- };
47
- };
48
- }
package/lib/index.ts CHANGED
@@ -18,9 +18,11 @@ export { default as Logout } from './Logout.svelte';
18
18
  export { default as MediaControls } from './MediaControls.svelte';
19
19
  export { default as NumberBar } from './NumberBar.svelte';
20
20
  export { default as Popover } from './Popover.svelte';
21
+ export { default as ProgressBar } from './ProgressBar.svelte';
21
22
  export { default as ProgressRing } from './ProgressRing.svelte';
22
23
  export { default as PWAIndicator } from './PWAIndicator.svelte';
23
24
  export { default as Register } from './Register.svelte';
25
+ export { default as Secret } from './Secret.svelte';
24
26
  export { default as SessionList } from './SessionList.svelte';
25
27
  export { default as SidebarLayout } from './SidebarLayout.svelte';
26
28
  export { default as TopBar } from './TopBar.svelte';
package/locales/en.json CHANGED
@@ -65,7 +65,17 @@
65
65
  "latest": "Latest",
66
66
  "upgrade": "<span class=\"version\">{latest}</span> available"
67
67
  },
68
+ "Secret": {
69
+ "add": "Set",
70
+ "file": "Stored in the secrets file. Change it with `axium secret set {id}`.",
71
+ "replace": "Replace",
72
+ "replace_notice": "This replaces the current value.",
73
+ "save": "Save",
74
+ "systemd": "Stored as a systemd credential. Change it with `axium secret set {id}`.",
75
+ "unset": "Not set. Store it with `axium secret set {id}`."
76
+ },
68
77
  "ZodInput": {
78
+ "experimental": "Experimental",
69
79
  "invalid_type": "Invalid input type: {type}"
70
80
  },
71
81
  "error": {
@@ -205,6 +215,7 @@
205
215
  "config": {
206
216
  "active": "Active Configuration",
207
217
  "loaded_files": "Loaded Files",
218
+ "secrets": "Secrets",
208
219
  "title": "Admin — Configuration"
209
220
  },
210
221
  "dashboard": {
@@ -278,7 +289,13 @@
278
289
  "audit_severity": ["Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "Info", "Debug"],
279
290
  "preference": {
280
291
  "debug": "Debug mode",
281
- "theme": "Theme"
292
+ "theme": "Theme",
293
+ "time_zone": "Home time zone"
294
+ },
295
+ "upload_config": {
296
+ "$title": "Uploads",
297
+ "temp_dir": "Temporary directory",
298
+ "timeout": "Idle timeout (minutes)"
282
299
  },
283
300
  "themes": {
284
301
  "default": "Default",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/client",
3
- "version": "0.42.1",
3
+ "version": "0.44.0",
4
4
  "author": "James Prevett <jp@jamespre.dev>",
5
5
  "funding": {
6
6
  "type": "individual",
@@ -50,7 +50,7 @@
50
50
  "build": "tsc"
51
51
  },
52
52
  "peerDependencies": {
53
- "@axium/core": ">=0.43.0",
53
+ "@axium/core": ">=0.46.0",
54
54
  "@james-pre/locales": "^1.0.0",
55
55
  "ioium": "^1.7.0",
56
56
  "semver": "^7.7.4",