summaryrefslogtreecommitdiff
path: root/ui/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ui/lib')
-rw-r--r--ui/lib/apiServer.js8
-rw-r--r--ui/lib/components/Message.svelte6
-rw-r--r--ui/lib/components/MessageInput.svelte2
-rw-r--r--ui/lib/iterator.test.js18
-rw-r--r--ui/lib/markdown.js6
-rw-r--r--ui/lib/markdown.test.js10
-rw-r--r--ui/lib/outbox.svelte.js2
-rw-r--r--ui/lib/runs.js2
-rw-r--r--ui/lib/session.svelte.js12
-rw-r--r--ui/lib/state/local/channels.svelte.js10
-rw-r--r--ui/lib/state/remote/channels.svelte.js2
-rw-r--r--ui/lib/state/remote/messages.svelte.js2
-rw-r--r--ui/lib/state/remote/state.svelte.js2
13 files changed, 41 insertions, 41 deletions
diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js
index e682681..397638c 100644
--- a/ui/lib/apiServer.js
+++ b/ui/lib/apiServer.js
@@ -4,7 +4,7 @@ import * as r from './retry.js';
import { timedDelay } from './retry.js';
export const apiServer = axios.create({
- baseURL: '/api/'
+ baseURL: '/api/',
});
export async function boot() {
@@ -51,7 +51,7 @@ export async function acceptInvite(inviteId, name, password) {
return apiServer
.post(`/invite/${inviteId}`, {
name,
- password
+ password,
})
.catch(responseError);
}
@@ -60,8 +60,8 @@ export function subscribeToEvents(resumePoint) {
const eventsUrl = apiServer.getUri({
url: '/events',
params: {
- resume_point: resumePoint
- }
+ resume_point: resumePoint,
+ },
});
return new EventSource(eventsUrl);
}
diff --git a/ui/lib/components/Message.svelte b/ui/lib/components/Message.svelte
index 5d15d17..74cb2be 100644
--- a/ui/lib/components/Message.svelte
+++ b/ui/lib/components/Message.svelte
@@ -8,7 +8,7 @@
body,
renderedBody,
editable = false,
- deleteMessage = async (id) => {}
+ deleteMessage = async (id) => {},
} = $props();
let deleteArmed = $state(false);
let atFormatted = $derived(at.toLocaleString(DateTime.DATETIME_SHORT));
@@ -32,9 +32,9 @@
class={[
'message',
{
- ['delete-armed']: deleteArmed
+ ['delete-armed']: deleteArmed,
},
- cssClass
+ cssClass,
]}
role="article"
data-at={at}
diff --git a/ui/lib/components/MessageInput.svelte b/ui/lib/components/MessageInput.svelte
index 30038c6..77c39be 100644
--- a/ui/lib/components/MessageInput.svelte
+++ b/ui/lib/components/MessageInput.svelte
@@ -53,7 +53,7 @@
contenteditable="plaintext-only"
class={{
textarea: true,
- disabled
+ disabled,
}}
bind:innerText={value}
{onkeydown}
diff --git a/ui/lib/iterator.test.js b/ui/lib/iterator.test.js
index 4c55358..2189da1 100644
--- a/ui/lib/iterator.test.js
+++ b/ui/lib/iterator.test.js
@@ -25,7 +25,7 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[],
(val) => val,
- (last, next) => last === next
+ (last, next) => last === next,
);
expect(Array.from(chunks)).toStrictEqual([]);
@@ -35,7 +35,7 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[37],
(val) => val,
- (last, next) => last === next
+ (last, next) => last === next,
);
expect(Array.from(chunks)).toStrictEqual([{ key: 37, chunk: [37] }]);
@@ -45,7 +45,7 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[37, 37, 28, 37],
(val) => val,
- (last, next) => last === next
+ (last, next) => last === next,
);
expect(Array.from(chunks)).toStrictEqual([
@@ -53,8 +53,8 @@ describe('chunkBy', async () => {
{ key: 28, chunk: [28] },
{
key: 37,
- chunk: [37]
- }
+ chunk: [37],
+ },
]);
});
});
@@ -64,13 +64,13 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[37, 37, 28, 37],
(val) => val >> 1,
- (last, next) => last === next
+ (last, next) => last === next,
);
expect(Array.from(chunks)).toStrictEqual([
{ key: 18, chunk: [37, 37] },
{ key: 14, chunk: [28] },
- { key: 18, chunk: [37] }
+ { key: 18, chunk: [37] },
]);
});
});
@@ -80,13 +80,13 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[36, 37, 28, 29, 30, 38],
(val) => val,
- (last, next) => last + 1 === next
+ (last, next) => last + 1 === next,
);
expect(Array.from(chunks)).toStrictEqual([
{ key: 37, chunk: [36, 37] },
{ key: 30, chunk: [28, 29, 30] },
- { key: 38, chunk: [38] }
+ { key: 38, chunk: [38] },
]);
});
});
diff --git a/ui/lib/markdown.js b/ui/lib/markdown.js
index 6caf80b..3f58176 100644
--- a/ui/lib/markdown.js
+++ b/ui/lib/markdown.js
@@ -12,8 +12,8 @@ const extension = {
rel="noreferrer"
${titleAttr}
href="${href}">${text}</a>`;
- }
- }
+ },
+ },
};
marked.use(extension);
@@ -21,6 +21,6 @@ marked.use(extension);
export function render(body) {
const rendered = marked.parse(body, { breaks: true });
return DOMPurify.sanitize(rendered, {
- ADD_ATTR: ['target']
+ ADD_ATTR: ['target'],
});
}
diff --git a/ui/lib/markdown.test.js b/ui/lib/markdown.test.js
index 126eacd..7aa10b1 100644
--- a/ui/lib/markdown.test.js
+++ b/ui/lib/markdown.test.js
@@ -7,7 +7,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" rel="noreferrer" target="_blank">a link</a></p>
-`
+`,
);
});
@@ -16,7 +16,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" title="what title" rel="noreferrer" target="_blank">a link</a></p>
-`
+`,
);
});
@@ -28,7 +28,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" rel="noreferrer" target="_blank">a link</a></p>
-`
+`,
);
});
@@ -40,7 +40,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" title="what title" rel="noreferrer" target="_blank">a link</a></p>
-`
+`,
);
});
@@ -49,7 +49,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" rel="noreferrer" target="_blank">a <em>link</em></a></p>
-`
+`,
);
});
});
diff --git a/ui/lib/outbox.svelte.js b/ui/lib/outbox.svelte.js
index 472c58b..183f8ff 100644
--- a/ui/lib/outbox.svelte.js
+++ b/ui/lib/outbox.svelte.js
@@ -19,7 +19,7 @@ class PostToChannel {
channel: this.channel,
sender,
body: this.body,
- renderedBody: this.renderedBody
+ renderedBody: this.renderedBody,
};
}
diff --git a/ui/lib/runs.js b/ui/lib/runs.js
index de00e6a..e020da3 100644
--- a/ui/lib/runs.js
+++ b/ui/lib/runs.js
@@ -13,7 +13,7 @@ function summarizeRun(self, { key, chunk }) {
return {
sender: sender.name,
ownMessage: sender.id === self.id,
- messages: chunk
+ messages: chunk,
};
}
diff --git a/ui/lib/session.svelte.js b/ui/lib/session.svelte.js
index 432fad2..d742dbe 100644
--- a/ui/lib/session.svelte.js
+++ b/ui/lib/session.svelte.js
@@ -36,7 +36,7 @@ class Message {
channel,
sender: users.get(sender),
body,
- renderedBody
+ renderedBody,
});
}
@@ -56,12 +56,12 @@ class Session {
currentUser = $derived(this.remote.currentUser);
users = $derived(this.remote.users.all);
messages = $derived(
- this.remote.messages.all.map((message) => Message.fromRemote(message, this.users))
+ this.remote.messages.all.map((message) => Message.fromRemote(message, this.users)),
);
channels = $derived(
this.remote.channels.all.map((channel) =>
- Channel.fromRemote(channel, this.messages, this.local.all)
- )
+ Channel.fromRemote(channel, this.messages, this.local.all),
+ ),
);
static boot({ user, users, channels, messages, resume_point, heartbeat }) {
@@ -71,7 +71,7 @@ class Session {
channels,
messages,
resumePoint: resume_point,
- heartbeat
+ heartbeat,
});
const local = l.Channels.fromLocalStorage();
return new Session(remote, local);
@@ -84,7 +84,7 @@ class Session {
channels,
messages,
resumePoint: resume_point,
- heartbeat
+ heartbeat,
});
}
diff --git a/ui/lib/state/local/channels.svelte.js b/ui/lib/state/local/channels.svelte.js
index e3ee8df..669aa1e 100644
--- a/ui/lib/state/local/channels.svelte.js
+++ b/ui/lib/state/local/channels.svelte.js
@@ -14,7 +14,7 @@ class Channel {
return new Channel({
draft,
lastReadAt: lastReadAt == null ? null : DateTime.fromISO(lastReadAt),
- scrollPosition
+ scrollPosition,
});
}
@@ -29,7 +29,7 @@ class Channel {
return {
draft,
lastReadAt: lastReadAt?.toISO(),
- scrollPosition
+ scrollPosition,
};
}
}
@@ -49,7 +49,7 @@ export class Channels {
static fromStored(stored) {
const loaded = Object.keys(stored).map((channelId) => [
channelId,
- Channel.fromStored(stored[channelId])
+ Channel.fromStored(stored[channelId]),
]);
const all = new SvelteMap(loaded);
return new Channels({ all });
@@ -98,9 +98,9 @@ export class Channels {
this.all.entries(),
(stored, [channelId, channel]) => ({
...stored,
- [channelId]: channel.toStored()
+ [channelId]: channel.toStored(),
}),
- {}
+ {},
);
}
diff --git a/ui/lib/state/remote/channels.svelte.js b/ui/lib/state/remote/channels.svelte.js
index 19946f2..b2888cb 100644
--- a/ui/lib/state/remote/channels.svelte.js
+++ b/ui/lib/state/remote/channels.svelte.js
@@ -5,7 +5,7 @@ class Channel {
return new Channel({
at: DateTime.fromISO(at),
id,
- name
+ name,
});
}
diff --git a/ui/lib/state/remote/messages.svelte.js b/ui/lib/state/remote/messages.svelte.js
index 0a081bb..7ce28b4 100644
--- a/ui/lib/state/remote/messages.svelte.js
+++ b/ui/lib/state/remote/messages.svelte.js
@@ -9,7 +9,7 @@ class Message {
channel,
sender,
body,
- renderedBody: render(body)
+ renderedBody: render(body),
});
}
diff --git a/ui/lib/state/remote/state.svelte.js b/ui/lib/state/remote/state.svelte.js
index e00d55c..a30e0fe 100644
--- a/ui/lib/state/remote/state.svelte.js
+++ b/ui/lib/state/remote/state.svelte.js
@@ -15,7 +15,7 @@ export class State {
users: Users.boot(users),
channels: Channels.boot(channels),
messages: Messages.boot(messages),
- resumePoint
+ resumePoint,
});
}