@atmo-dev/kit 0.21.0 → 0.23.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/README.md +1 -1
- package/dist/articles/ArticleView.svelte +21 -7
- package/dist/articles/ArticleView.svelte.d.ts +8 -4
- package/dist/articles/styles.js +3 -2
- package/dist/articles-data.d.ts +1 -0
- package/dist/components/RichText.svelte +34 -17
- package/dist/components/RichText.svelte.d.ts +4 -1
- package/dist/components/RichTextEditor.svelte +67 -11
- package/dist/components/RichTextEditor.svelte.d.ts +0 -2
- package/dist/components/StreamplacePicker.svelte +2 -2
- package/dist/components/StreamplacePicker.svelte.d.ts +1 -1
- package/dist/components/composer/EmojiPanel.svelte +55 -0
- package/dist/components/composer/EmojiPanel.svelte.d.ts +6 -0
- package/dist/components/composer/EmojiPicker.svelte +2 -38
- package/dist/components/data/DataLabel.svelte +120 -0
- package/dist/components/data/DataLabel.svelte.d.ts +10 -0
- package/dist/components/data/issues.d.ts +5 -0
- package/dist/components/data/issues.js +52 -0
- package/dist/components/data/types.d.ts +28 -0
- package/dist/components/data/types.js +1 -0
- package/dist/components/data/visibility.d.ts +7 -0
- package/dist/components/data/visibility.js +15 -0
- package/dist/components/legal/links.js +1 -0
- package/dist/components/legal/types.d.ts +1 -1
- package/dist/components/notifications/NotificationList.svelte +137 -0
- package/dist/components/notifications/NotificationList.svelte.d.ts +19 -0
- package/dist/components/notifications/NotificationPushToggle.svelte +76 -0
- package/dist/components/notifications/NotificationPushToggle.svelte.d.ts +19 -0
- package/dist/components/notifications/NotificationSettings.svelte +125 -0
- package/dist/components/notifications/NotificationSettings.svelte.d.ts +16 -0
- package/dist/components/notifications/types.d.ts +37 -0
- package/dist/components/notifications/types.js +1 -0
- package/dist/editor/ImageDialog.svelte +87 -0
- package/dist/editor/ImageDialog.svelte.d.ts +16 -0
- package/dist/editor/image-node.d.ts +6 -2
- package/dist/editor/image-node.js +36 -37
- package/dist/events/EventCard.svelte +6 -1
- package/dist/events/VodPlayer.svelte +1 -1
- package/dist/events/atmo-rsvp.d.ts +6 -0
- package/dist/events/atmo-rsvp.js +34 -0
- package/dist/events/atproto-helpers.d.ts +1 -0
- package/dist/events/atproto-helpers.js +3 -0
- package/dist/events/event-link-embed.d.ts +7 -3
- package/dist/events/event-link-embed.js +11 -5
- package/dist/events/event-view/StreamPlacePlayer.svelte +14 -108
- package/dist/events/linked-records.d.ts +1 -1
- package/dist/events/linked-records.js +2 -2
- package/dist/events-card.d.ts +9 -0
- package/dist/events-card.js +7 -0
- package/dist/events-data.d.ts +1 -0
- package/dist/events-data.js +1 -0
- package/dist/grain/xrpc.js +11 -4
- package/dist/index.d.ts +14 -2
- package/dist/index.js +7 -1
- package/dist/legal.d.ts +3 -0
- package/dist/legal.js +2 -0
- package/dist/media.d.ts +33 -0
- package/dist/media.js +74 -1
- package/dist/richtext/serialize.js +13 -8
- package/dist/streamplace/StreamCard.svelte +184 -0
- package/dist/streamplace/StreamCard.svelte.d.ts +24 -0
- package/dist/streamplace/StreamLinkEmbed.svelte +59 -0
- package/dist/streamplace/StreamLinkEmbed.svelte.d.ts +5 -0
- package/dist/streamplace/StreamPlayer.svelte +539 -0
- package/dist/streamplace/StreamPlayer.svelte.d.ts +42 -0
- package/dist/streamplace/VideoCard.svelte +159 -0
- package/dist/streamplace/VideoCard.svelte.d.ts +17 -0
- package/dist/streamplace/api.d.ts +74 -0
- package/dist/streamplace/api.js +182 -0
- package/dist/streamplace/broadcast.d.ts +3 -0
- package/dist/streamplace/broadcast.js +110 -0
- package/dist/streamplace/channel.svelte.d.ts +74 -0
- package/dist/streamplace/channel.svelte.js +515 -0
- package/dist/streamplace/chat/Composer.svelte +232 -0
- package/dist/streamplace/chat/Composer.svelte.d.ts +15 -0
- package/dist/streamplace/chat/Embeds.svelte +135 -0
- package/dist/streamplace/chat/Embeds.svelte.d.ts +13 -0
- package/dist/streamplace/chat/Message.svelte +303 -0
- package/dist/streamplace/chat/Message.svelte.d.ts +25 -0
- package/dist/streamplace/chat/StreamChat.svelte +463 -0
- package/dist/streamplace/chat/StreamChat.svelte.d.ts +33 -0
- package/dist/streamplace/chat/StreamChatPopups.svelte +151 -0
- package/dist/streamplace/chat/StreamChatPopups.svelte.d.ts +15 -0
- package/dist/streamplace/chat/UserCard.svelte +76 -0
- package/dist/streamplace/chat/UserCard.svelte.d.ts +12 -0
- package/dist/streamplace/chat/color.d.ts +7 -0
- package/dist/streamplace/chat/color.js +33 -0
- package/dist/streamplace/chat/links.d.ts +10 -0
- package/dist/streamplace/chat/links.js +29 -0
- package/dist/streamplace/facets.d.ts +15 -0
- package/dist/streamplace/facets.js +112 -0
- package/dist/streamplace/link-embed.d.ts +13 -0
- package/dist/streamplace/link-embed.js +16 -0
- package/dist/streamplace/links.d.ts +6 -0
- package/dist/streamplace/links.js +1 -0
- package/dist/streamplace/reactions.d.ts +21 -0
- package/dist/streamplace/reactions.js +46 -0
- package/dist/streamplace/types.d.ts +200 -0
- package/dist/streamplace/types.js +1 -0
- package/dist/streamplace-data.d.ts +11 -0
- package/dist/streamplace-data.js +10 -0
- package/dist/streamplace.d.ts +14 -6
- package/dist/streamplace.js +11 -1
- package/dist/{events/event-view → video}/Player.svelte +69 -21
- package/dist/video/Player.svelte.d.ts +38 -0
- package/dist/video/engines.d.ts +59 -0
- package/dist/video/engines.js +647 -0
- package/package.json +11 -1
- package/dist/events/event-view/Player.svelte.d.ts +0 -24
|
@@ -2,7 +2,11 @@ import { Node } from '@tiptap/core';
|
|
|
2
2
|
export type ImageNodeOptions = {
|
|
3
3
|
/** The address to load a destination from; undefined when it cannot be shown. */
|
|
4
4
|
src: (url: string) => string | undefined;
|
|
5
|
-
|
|
5
|
+
/** Opens the image at this position for its description and caption. */
|
|
6
|
+
edit: (position: number) => void;
|
|
6
7
|
};
|
|
7
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* An image on its own line, written to Markdown as ``. Clicking it, or
|
|
10
|
+
* Enter while it is selected, opens its description and caption.
|
|
11
|
+
*/
|
|
8
12
|
export declare const ImageNode: Node<ImageNodeOptions, any>;
|
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
|
+
import { NodeSelection } from '@tiptap/pm/state';
|
|
2
3
|
import { IMAGE } from './document.js';
|
|
3
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* An image on its own line, written to Markdown as ``. Clicking it, or
|
|
6
|
+
* Enter while it is selected, opens its description and caption.
|
|
7
|
+
*/
|
|
4
8
|
export const ImageNode = Node.create({
|
|
5
9
|
name: IMAGE,
|
|
6
10
|
group: 'block',
|
|
7
11
|
atom: true,
|
|
8
12
|
selectable: true,
|
|
9
13
|
draggable: true,
|
|
10
|
-
addOptions: () => ({ src: () => undefined,
|
|
14
|
+
addOptions: () => ({ src: () => undefined, edit: () => { } }),
|
|
11
15
|
addAttributes: () => ({ url: { default: '' }, alt: { default: '' }, title: { default: '' } }),
|
|
12
|
-
parseHTML: () => [{ tag: '
|
|
13
|
-
renderHTML: ({ node }) => ['
|
|
16
|
+
parseHTML: () => [{ tag: 'figure[data-image]' }],
|
|
17
|
+
renderHTML: ({ node }) => ['figure', { 'data-image': '' }, node.attrs.alt || ''],
|
|
14
18
|
renderText: ({ node }) => node.attrs.alt || '',
|
|
19
|
+
addKeyboardShortcuts() {
|
|
20
|
+
return {
|
|
21
|
+
Enter: ({ editor }) => {
|
|
22
|
+
const { selection } = editor.state;
|
|
23
|
+
if (!(selection instanceof NodeSelection) || selection.node.type.name !== IMAGE)
|
|
24
|
+
return false;
|
|
25
|
+
if (editor.isEditable)
|
|
26
|
+
this.options.edit(selection.from);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
},
|
|
15
31
|
addNodeView() {
|
|
16
32
|
return ({ node, editor, getPos }) => {
|
|
17
33
|
let current = node;
|
|
18
|
-
const dom = document.createElement('
|
|
34
|
+
const dom = document.createElement('figure');
|
|
19
35
|
dom.dataset.image = '';
|
|
20
36
|
dom.contentEditable = 'false';
|
|
21
37
|
const img = document.createElement('img');
|
|
22
38
|
img.draggable = false;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
input.setAttribute('aria-label', this.options.altLabel);
|
|
27
|
-
dom.append(img, input);
|
|
39
|
+
img.referrerPolicy = 'no-referrer';
|
|
40
|
+
const caption = document.createElement('figcaption');
|
|
41
|
+
dom.append(img, caption);
|
|
28
42
|
const show = () => {
|
|
29
43
|
const src = this.options.src(current.attrs.url) ?? '';
|
|
30
|
-
if (
|
|
31
|
-
img.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
img.title = current.attrs.title;
|
|
44
|
+
if (src) {
|
|
45
|
+
if (img.getAttribute('src') !== src)
|
|
46
|
+
img.setAttribute('src', src);
|
|
47
|
+
}
|
|
35
48
|
else
|
|
36
|
-
img.removeAttribute('
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
img.removeAttribute('src');
|
|
50
|
+
img.alt = current.attrs.alt || '';
|
|
51
|
+
const text = String(current.attrs.title ?? '').trim();
|
|
52
|
+
caption.textContent = text;
|
|
53
|
+
caption.hidden = !text;
|
|
40
54
|
};
|
|
41
55
|
show();
|
|
42
|
-
|
|
43
|
-
const pos = getPos();
|
|
44
|
-
if (typeof pos !== 'number' || !editor.isEditable)
|
|
45
|
-
return;
|
|
46
|
-
editor.view.dispatch(editor.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, alt: input.value }));
|
|
47
|
-
});
|
|
48
|
-
input.addEventListener('keydown', (event) => {
|
|
49
|
-
if (event.key !== 'Enter' && event.key !== 'Escape')
|
|
50
|
-
return;
|
|
51
|
-
event.preventDefault();
|
|
56
|
+
dom.addEventListener('click', () => {
|
|
52
57
|
const pos = getPos();
|
|
53
|
-
if (typeof pos === 'number')
|
|
54
|
-
|
|
55
|
-
.chain()
|
|
56
|
-
.focus()
|
|
57
|
-
.setTextSelection(pos + current.nodeSize)
|
|
58
|
-
.run();
|
|
58
|
+
if (typeof pos === 'number' && editor.isEditable)
|
|
59
|
+
this.options.edit(pos);
|
|
59
60
|
});
|
|
60
61
|
return {
|
|
61
62
|
dom,
|
|
@@ -66,8 +67,6 @@ export const ImageNode = Node.create({
|
|
|
66
67
|
show();
|
|
67
68
|
return true;
|
|
68
69
|
},
|
|
69
|
-
// Typing in the description stays there.
|
|
70
|
-
stopEvent: (event) => event.target === input,
|
|
71
70
|
ignoreMutation: () => true
|
|
72
71
|
};
|
|
73
72
|
};
|
|
@@ -84,6 +84,9 @@
|
|
|
84
84
|
return getEventExternalImage(event);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
let link = $derived(href ?? eventUrl(event, actor));
|
|
88
|
+
// Like other Kit links: paths in this app stay in the tab, anything else opens a new one.
|
|
89
|
+
let leaves = $derived(!/^\/(?!\/)/.test(link));
|
|
87
90
|
let thumbnail = $derived(getThumbnail(event));
|
|
88
91
|
let location = $derived(getLocationSummary(getLocations(event.locations)));
|
|
89
92
|
let mode = $derived(getModeLabel(event.mode));
|
|
@@ -91,7 +94,9 @@
|
|
|
91
94
|
</script>
|
|
92
95
|
|
|
93
96
|
<a
|
|
94
|
-
href={
|
|
97
|
+
href={link}
|
|
98
|
+
target={leaves ? '_blank' : undefined}
|
|
99
|
+
rel={leaves ? 'noopener noreferrer' : undefined}
|
|
95
100
|
class="group grid grid-cols-[5rem_minmax(0,1fr)] gap-3 rounded-ui outline-offset-4 transition-colors focus-visible:outline-2 focus-visible:outline-accent-700 sm:grid-cols-[6rem_minmax(0,1fr)] sm:gap-3.5 dark:focus-visible:outline-accent-300"
|
|
96
101
|
>
|
|
97
102
|
<div class="w-full">
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FlatEventRecord } from './contrail.js';
|
|
2
|
+
/**
|
|
3
|
+
* A public event from atmo.rsvp's own index, by handle or DID and record key. Works from the
|
|
4
|
+
* browser. The host is fixed; apps with their own index pass their own loader instead.
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadAtmoRsvpEvent(actor: string, rkey: string, fetchImpl?: typeof fetch): Promise<FlatEventRecord>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isLinkedActor } from '../grain.js';
|
|
2
|
+
const ORIGIN = 'https://atmo.rsvp';
|
|
3
|
+
/**
|
|
4
|
+
* A public event from atmo.rsvp's own index, by handle or DID and record key. Works from the
|
|
5
|
+
* browser. The host is fixed; apps with their own index pass their own loader instead.
|
|
6
|
+
*/
|
|
7
|
+
export async function loadAtmoRsvpEvent(actor, rkey, fetchImpl = fetch) {
|
|
8
|
+
if (!isLinkedActor(actor) || !/^[A-Za-z0-9._~:-]{1,512}$/.test(rkey) || rkey.startsWith('.'))
|
|
9
|
+
throw new Error('Invalid event reference');
|
|
10
|
+
const response = await fetchImpl(`${ORIGIN}/p/${encodeURIComponent(actor)}/e/${encodeURIComponent(rkey)}/data.json`, {
|
|
11
|
+
headers: { accept: 'application/json' },
|
|
12
|
+
signal: AbortSignal.timeout(6000),
|
|
13
|
+
redirect: 'error'
|
|
14
|
+
});
|
|
15
|
+
if (!response.ok)
|
|
16
|
+
throw new Error(`Event unavailable (${response.status})`);
|
|
17
|
+
const record = (await response.json());
|
|
18
|
+
const value = record?.value;
|
|
19
|
+
if (typeof record?.did !== 'string' ||
|
|
20
|
+
!record.did.startsWith('did:') ||
|
|
21
|
+
record.rkey !== rkey ||
|
|
22
|
+
(actor.startsWith('did:') && record.did !== actor) ||
|
|
23
|
+
!value ||
|
|
24
|
+
typeof value.name !== 'string' ||
|
|
25
|
+
typeof value.startsAt !== 'string')
|
|
26
|
+
throw new Error('Invalid event');
|
|
27
|
+
return {
|
|
28
|
+
...value,
|
|
29
|
+
cid: typeof record.cid === 'string' ? record.cid : null,
|
|
30
|
+
did: record.did,
|
|
31
|
+
rkey,
|
|
32
|
+
uri: `at://${record.did}/community.lexicon.calendar.event/${rkey}`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -8,6 +8,7 @@ export declare function configureAtproto(options: {
|
|
|
8
8
|
cdn?: string;
|
|
9
9
|
}): void;
|
|
10
10
|
export declare function appviewUrl(): string;
|
|
11
|
+
export declare function cdnUrl(): string;
|
|
11
12
|
export declare function getCDNImageBlobUrl({ did, blob, format }: {
|
|
12
13
|
did: string;
|
|
13
14
|
blob: {
|
|
@@ -16,6 +16,9 @@ export function configureAtproto(options) {
|
|
|
16
16
|
export function appviewUrl() {
|
|
17
17
|
return services.appview;
|
|
18
18
|
}
|
|
19
|
+
export function cdnUrl() {
|
|
20
|
+
return services.cdn;
|
|
21
|
+
}
|
|
19
22
|
export function getCDNImageBlobUrl({ did, blob, format = 'webp' }) {
|
|
20
23
|
return `${services.cdn}/img/feed_thumbnail/plain/${did}/${blob.ref.$link}@${format}`;
|
|
21
24
|
}
|
|
@@ -10,9 +10,13 @@ export type EventLinkEmbedRef = {
|
|
|
10
10
|
};
|
|
11
11
|
/** The event a link points to; null when there is none to show. */
|
|
12
12
|
export declare function loadLinkedEvent(ref: EventLinkEmbedRef): Promise<FlatEventRecord | null>;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Links to event pages, shown as event cards. With no options: links to atmo.rsvp, read from
|
|
15
|
+
* its public index.
|
|
16
|
+
*/
|
|
17
|
+
export declare function eventLinkEmbed(options?: {
|
|
18
|
+
/** Defaults to reading atmo.rsvp's public index; required for any other origin. */
|
|
19
|
+
loadEvent?: NonNullable<LinkedRecordsClient['getEvent']>;
|
|
16
20
|
/** Defaults to atmo.rsvp. */
|
|
17
21
|
origins?: readonly string[];
|
|
18
22
|
/** Whether this app serves event pages itself; otherwise the card opens the linked URL. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { loadAtmoRsvpEvent } from './atmo-rsvp.js';
|
|
1
2
|
import { parseEventLink } from './linked-records.js';
|
|
2
3
|
/** The event a link points to; null when there is none to show. */
|
|
3
4
|
export async function loadLinkedEvent(ref) {
|
|
@@ -6,16 +7,21 @@ export async function loadLinkedEvent(ref) {
|
|
|
6
7
|
}
|
|
7
8
|
// One function for every such embed, so that its component is loaded once.
|
|
8
9
|
const load = () => import('./event-view/EventLinkEmbed.svelte');
|
|
9
|
-
/**
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Links to event pages, shown as event cards. With no options: links to atmo.rsvp, read from
|
|
12
|
+
* its public index.
|
|
13
|
+
*/
|
|
14
|
+
export function eventLinkEmbed(options = {}) {
|
|
15
|
+
// The built-in loader only knows atmo.rsvp's events.
|
|
16
|
+
if (!options.loadEvent && options.origins)
|
|
17
|
+
throw new Error('eventLinkEmbed: `origins` needs a `loadEvent` for those origins');
|
|
18
|
+
const loadEvent = options.loadEvent ?? loadAtmoRsvpEvent;
|
|
11
19
|
return {
|
|
12
20
|
id: 'event',
|
|
13
21
|
label: 'event',
|
|
14
22
|
match(url) {
|
|
15
23
|
const link = parseEventLink(url.href, options.origins);
|
|
16
|
-
return link && !options.skip?.(link)
|
|
17
|
-
? { ...link, local: !!options.local, loadEvent: options.loadEvent }
|
|
18
|
-
: null;
|
|
24
|
+
return link && !options.skip?.(link) ? { ...link, local: !!options.local, loadEvent } : null;
|
|
19
25
|
},
|
|
20
26
|
load,
|
|
21
27
|
data: loadLinkedEvent
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
import { Icon } from '../../index.js';
|
|
4
|
+
import { liveThumbnail, whepUrl } from '../../streamplace/api.js';
|
|
5
|
+
import { startWebRTC } from '../../video/engines.js';
|
|
4
6
|
import { ExternalLink } from '@sketchyicons/svelte';
|
|
5
|
-
import Player from '
|
|
7
|
+
import Player from '../../video/Player.svelte';
|
|
6
8
|
|
|
7
9
|
let {
|
|
8
10
|
handle,
|
|
@@ -17,116 +19,20 @@
|
|
|
17
19
|
let error = $state(false);
|
|
18
20
|
let controlsVisible = $state(true);
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const posterUrl = $derived(
|
|
23
|
-
`https://stream.place/api/playback/${encodeURIComponent(handle)}/stream.jpg`
|
|
24
|
-
);
|
|
22
|
+
const posterUrl = $derived(liveThumbnail(handle));
|
|
25
23
|
|
|
26
24
|
onMount(() => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
const node = videoEl;
|
|
26
|
+
if (!node) return;
|
|
27
|
+
// One attempt, as before: an event page says "offline" at once instead of retrying.
|
|
28
|
+
const engine = startWebRTC(
|
|
29
|
+
node,
|
|
30
|
+
whepUrl(handle),
|
|
31
|
+
{ onready: () => void node.play().catch(() => {}), onfail: () => (error = true) },
|
|
32
|
+
{ attempts: 1 }
|
|
33
|
+
);
|
|
34
|
+
return () => engine.destroy();
|
|
37
35
|
});
|
|
38
|
-
|
|
39
|
-
function waitForIceGathering(peer: RTCPeerConnection, timeoutMs = 2000): Promise<void> {
|
|
40
|
-
return new Promise((resolve) => {
|
|
41
|
-
if (peer.iceGatheringState === 'complete') {
|
|
42
|
-
resolve();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
let done = false;
|
|
47
|
-
const finish = () => {
|
|
48
|
-
if (done) return;
|
|
49
|
-
done = true;
|
|
50
|
-
peer.removeEventListener('icegatheringstatechange', onStateChange);
|
|
51
|
-
clearTimeout(timer);
|
|
52
|
-
resolve();
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const onStateChange = () => {
|
|
56
|
-
if (peer.iceGatheringState === 'complete') {
|
|
57
|
-
finish();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
peer.addEventListener('icegatheringstatechange', onStateChange);
|
|
62
|
-
const timer = setTimeout(finish, timeoutMs);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async function init() {
|
|
67
|
-
if (!videoEl) return;
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
pc = new RTCPeerConnection({
|
|
71
|
-
iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
|
|
72
|
-
bundlePolicy: 'max-bundle'
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
pc.addTransceiver('video', { direction: 'recvonly' });
|
|
76
|
-
pc.addTransceiver('audio', { direction: 'recvonly' });
|
|
77
|
-
|
|
78
|
-
pc.addEventListener('track', (event) => {
|
|
79
|
-
if (!videoEl) return;
|
|
80
|
-
if (event.streams && event.streams[0]) {
|
|
81
|
-
videoEl.srcObject = event.streams[0];
|
|
82
|
-
} else {
|
|
83
|
-
let stream = videoEl.srcObject as MediaStream | null;
|
|
84
|
-
if (!stream) {
|
|
85
|
-
stream = new MediaStream();
|
|
86
|
-
videoEl.srcObject = stream;
|
|
87
|
-
}
|
|
88
|
-
stream.addTrack(event.track);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
const offer = await pc.createOffer();
|
|
93
|
-
await pc.setLocalDescription(offer);
|
|
94
|
-
await waitForIceGathering(pc, 2000);
|
|
95
|
-
|
|
96
|
-
const sdp = pc.localDescription?.sdp;
|
|
97
|
-
if (!sdp) {
|
|
98
|
-
error = true;
|
|
99
|
-
pc.close();
|
|
100
|
-
pc = null;
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const response = await fetch(
|
|
105
|
-
`https://stream.place/api/playback/${encodeURIComponent(handle)}/webrtc?rendition=source`,
|
|
106
|
-
{
|
|
107
|
-
method: 'POST',
|
|
108
|
-
headers: { 'Content-Type': 'application/sdp' },
|
|
109
|
-
body: sdp
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
if (!response.ok) {
|
|
114
|
-
error = true;
|
|
115
|
-
pc.close();
|
|
116
|
-
pc = null;
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const answerSdp = await response.text();
|
|
121
|
-
await pc.setRemoteDescription({ type: 'answer', sdp: answerSdp });
|
|
122
|
-
} catch {
|
|
123
|
-
error = true;
|
|
124
|
-
if (pc) {
|
|
125
|
-
pc.close();
|
|
126
|
-
pc = null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
36
|
</script>
|
|
131
37
|
|
|
132
38
|
{#snippet watchOnStreamPlace(hidden = false)}
|
|
@@ -3,7 +3,7 @@ import type { FlatEventRecord } from './contrail.js';
|
|
|
3
3
|
import { type SembleClient } from '../semble.js';
|
|
4
4
|
export { parseGrainLink, isLinkedActor } from '../grain.js';
|
|
5
5
|
export { parseSembleLink } from '../semble.js';
|
|
6
|
-
export { parseStreamplaceLink } from '../streamplace.js';
|
|
6
|
+
export { parseStreamplaceLink } from '../streamplace/links.js';
|
|
7
7
|
export type { GrainReference, GrainAlbum, GrainPhoto, GrainGallery, GrainAlbumPage } from '../grain.js';
|
|
8
8
|
export type { SembleReference, SembleCard, SembleCollection, SembleCollectionPage, SembleCollectionList } from '../semble.js';
|
|
9
9
|
export type EventLink = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isLinkedActor, parseGrainLink } from '../grain.js';
|
|
2
2
|
import { parseSembleLink } from '../semble.js';
|
|
3
|
-
import { parseStreamplaceLink } from '../streamplace.js';
|
|
3
|
+
import { parseStreamplaceLink } from '../streamplace/links.js';
|
|
4
4
|
export { parseGrainLink, isLinkedActor } from '../grain.js';
|
|
5
5
|
export { parseSembleLink } from '../semble.js';
|
|
6
|
-
export { parseStreamplaceLink } from '../streamplace.js';
|
|
6
|
+
export { parseStreamplaceLink } from '../streamplace/links.js';
|
|
7
7
|
/**
|
|
8
8
|
* Recognize a link to an event page, `/p/<handle or DID>/e/<rkey>`, on one of the given origins.
|
|
9
9
|
* Syntax only; the event may not exist.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event cards and event links shown as cards, without the full event page: no map, players or
|
|
3
|
+
* editor, so none of the optional peers of `@atmo-dev/kit/events` are needed.
|
|
4
|
+
*/
|
|
5
|
+
export { default as EventCard } from './events/EventCard.svelte';
|
|
6
|
+
export { eventLinkEmbed } from './events/event-link-embed.js';
|
|
7
|
+
export type { EventLinkEmbedRef } from './events/event-link-embed.js';
|
|
8
|
+
export { loadAtmoRsvpEvent } from './events/atmo-rsvp.js';
|
|
9
|
+
export type { FlatEventRecord } from './events/contrail.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event cards and event links shown as cards, without the full event page: no map, players or
|
|
3
|
+
* editor, so none of the optional peers of `@atmo-dev/kit/events` are needed.
|
|
4
|
+
*/
|
|
5
|
+
export { default as EventCard } from './events/EventCard.svelte';
|
|
6
|
+
export { eventLinkEmbed } from './events/event-link-embed.js';
|
|
7
|
+
export { loadAtmoRsvpEvent } from './events/atmo-rsvp.js';
|
package/dist/events-data.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type { EditorAdapter, EditorBlobRef, EditorViewer } from './events/editor
|
|
|
4
4
|
export type { EventEditorPrefill, Visibility as EventVisibility } from './events/editor/types.js';
|
|
5
5
|
export type { EventData, EventLexiconMain, EventLocationVariant, EventStatus, EventMode as EventLexiconMode } from './events/event-types.js';
|
|
6
6
|
export type { FlatEventRecord, HostProfile, AttendeeInfo, AttendeeListLoader } from './events/contrail.js';
|
|
7
|
+
export { loadAtmoRsvpEvent } from './events/atmo-rsvp.js';
|
|
7
8
|
export { eventUrl, isEventOngoing, RSVP_GOING, RSVP_INTERESTED } from './events/contrail.js';
|
|
8
9
|
export * from './events/conference.js';
|
|
9
10
|
export * from './events/linked-records.js';
|
package/dist/events-data.js
CHANGED
package/dist/grain/xrpc.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { isLinkedActor, parseGrainLink } from './urls.js';
|
|
2
|
-
// Grain's
|
|
2
|
+
// Grain's API is deliberately isolated here; never proxy a user-supplied host.
|
|
3
3
|
const ORIGIN = 'https://grain.social';
|
|
4
|
+
// The feed listing one account's galleries. `social.grain.feed.describeFeeds` names it; it is
|
|
5
|
+
// fixed here to save a request per page, as Grain's own client keeps the answer too.
|
|
6
|
+
const ACTOR_FEED = 'at://did:web:grain.social/social.grain.feed.generator/actor';
|
|
7
|
+
// Retired endpoints answer with one gallery telling people to update, not with an error.
|
|
8
|
+
const isUpdateNotice = (value) => text(object(value).uri).endsWith('/update-notice');
|
|
4
9
|
function object(value) {
|
|
5
10
|
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
6
11
|
}
|
|
@@ -50,6 +55,8 @@ function photo(value) {
|
|
|
50
55
|
};
|
|
51
56
|
}
|
|
52
57
|
function album(value) {
|
|
58
|
+
if (isUpdateNotice(value))
|
|
59
|
+
throw new Error('Grain endpoint retired');
|
|
53
60
|
const g = object(value), record = object(g.record), creator = object(g.creator);
|
|
54
61
|
const ref = parseGrainLink(text(g.uri));
|
|
55
62
|
const did = text(creator.did);
|
|
@@ -95,7 +102,7 @@ export function createGrainXrpcClient(fetchImpl = fetch) {
|
|
|
95
102
|
const ref = parseGrainLink(reference);
|
|
96
103
|
if (!ref)
|
|
97
104
|
throw new Error('Invalid Grain reference');
|
|
98
|
-
const data = await request('social.grain.
|
|
105
|
+
const data = await request('social.grain.gallery.getGallery', { gallery: ref.atUri });
|
|
99
106
|
const result = album(data.gallery);
|
|
100
107
|
const canonical = parseGrainLink(result.uri);
|
|
101
108
|
if (canonical.rkey !== ref.rkey ||
|
|
@@ -109,8 +116,8 @@ export function createGrainXrpcClient(fetchImpl = fetch) {
|
|
|
109
116
|
async listAlbums(actor, cursor) {
|
|
110
117
|
if (!isLinkedActor(actor))
|
|
111
118
|
throw new Error('Invalid actor');
|
|
112
|
-
const data = await request('
|
|
113
|
-
feed:
|
|
119
|
+
const data = await request('social.grain.feed.getFeed', {
|
|
120
|
+
feed: ACTOR_FEED,
|
|
114
121
|
actor,
|
|
115
122
|
limit: '24',
|
|
116
123
|
...(cursor ? { cursor } : {})
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export { default as PhotoLightbox } from './components/PhotoLightbox.svelte';
|
|
|
31
31
|
export type { PhotoLightboxProps } from './components/PhotoLightbox.svelte';
|
|
32
32
|
export { default as PhotoGrid } from './components/PhotoGrid.svelte';
|
|
33
33
|
export type { PhotoGridProps } from './components/PhotoGrid.svelte';
|
|
34
|
-
export type { Photo } from './media.js';
|
|
34
|
+
export type { Photo, SizedImage } from './media.js';
|
|
35
35
|
export { default as GrainAlbumPicker } from './components/GrainAlbumPicker.svelte';
|
|
36
36
|
export type { GrainAlbumPickerProps } from './components/GrainAlbumPicker.svelte';
|
|
37
37
|
export { default as GrainAlbumView } from './components/GrainAlbumView.svelte';
|
|
@@ -44,7 +44,7 @@ export { default as SembleCollectionView } from './components/SembleCollectionVi
|
|
|
44
44
|
export type { SembleCollectionViewProps } from './components/SembleCollectionView.svelte';
|
|
45
45
|
export * from './grain.js';
|
|
46
46
|
export * from './semble.js';
|
|
47
|
-
export * from './streamplace.js';
|
|
47
|
+
export * from './streamplace/links.js';
|
|
48
48
|
export { default as InsetImage } from './components/InsetImage.svelte';
|
|
49
49
|
export { default as Badge } from './components/Badge.svelte';
|
|
50
50
|
export { default as Modal } from './components/Modal.svelte';
|
|
@@ -56,9 +56,21 @@ export { default as LegalFooter } from './components/legal/LegalFooter.svelte';
|
|
|
56
56
|
export type { LegalFooterProps } from './components/legal/LegalFooter.svelte';
|
|
57
57
|
export { createLegalDrafts, getLegalDraftIssues, getLegalDocumentIssues } from './components/legal/drafts.js';
|
|
58
58
|
export type { LegalDocumentKind, LegalDocumentData, LegalSection, LegalLink, LegalFooterLink, LegalFooterLinks, LegalDraftConfig } from './components/legal/types.js';
|
|
59
|
+
export { default as DataLabel } from './components/data/DataLabel.svelte';
|
|
60
|
+
export type { DataLabelProps } from './components/data/DataLabel.svelte';
|
|
61
|
+
export { getDataLabelIssues } from './components/data/issues.js';
|
|
62
|
+
export { dataVisibilityLevels } from './components/data/visibility.js';
|
|
63
|
+
export type { DataLabelData, DataLabelEntry, DataVisibility } from './components/data/types.js';
|
|
59
64
|
export { default as ReportDialog } from './components/report/ReportDialog.svelte';
|
|
60
65
|
export type { ReportDialogProps } from './components/report/ReportDialog.svelte';
|
|
61
66
|
export type { ReportReasonType, ReportInput, ReportFailure, ReportSubmit } from './components/report/types.js';
|
|
67
|
+
export { default as NotificationList } from './components/notifications/NotificationList.svelte';
|
|
68
|
+
export type { NotificationListProps } from './components/notifications/NotificationList.svelte';
|
|
69
|
+
export { default as NotificationSettings } from './components/notifications/NotificationSettings.svelte';
|
|
70
|
+
export type { NotificationSettingsProps } from './components/notifications/NotificationSettings.svelte';
|
|
71
|
+
export { default as NotificationPushToggle } from './components/notifications/NotificationPushToggle.svelte';
|
|
72
|
+
export type { NotificationPushToggleProps } from './components/notifications/NotificationPushToggle.svelte';
|
|
73
|
+
export type { NotificationActor, NotificationItem, NotificationPreference, NotificationChannel, NotificationPreferenceValue, NotificationPushState } from './components/notifications/types.js';
|
|
62
74
|
export { default as Tabs } from './components/Tabs.svelte';
|
|
63
75
|
export type { TabItem } from './components/Tabs.svelte';
|
|
64
76
|
export { default as Icon } from './components/Icon.svelte';
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export { default as SembleCollectionPicker } from './components/SembleCollection
|
|
|
30
30
|
export { default as SembleCollectionView } from './components/SembleCollectionView.svelte';
|
|
31
31
|
export * from './grain.js';
|
|
32
32
|
export * from './semble.js';
|
|
33
|
-
export * from './streamplace.js';
|
|
33
|
+
export * from './streamplace/links.js';
|
|
34
34
|
export { default as InsetImage } from './components/InsetImage.svelte';
|
|
35
35
|
export { default as Badge } from './components/Badge.svelte';
|
|
36
36
|
export { default as Modal } from './components/Modal.svelte';
|
|
@@ -39,7 +39,13 @@ export { iconColors, iconSvg, iconPng } from './icon-maker/index.js';
|
|
|
39
39
|
export { default as LegalDocument } from './components/legal/LegalDocument.svelte';
|
|
40
40
|
export { default as LegalFooter } from './components/legal/LegalFooter.svelte';
|
|
41
41
|
export { createLegalDrafts, getLegalDraftIssues, getLegalDocumentIssues } from './components/legal/drafts.js';
|
|
42
|
+
export { default as DataLabel } from './components/data/DataLabel.svelte';
|
|
43
|
+
export { getDataLabelIssues } from './components/data/issues.js';
|
|
44
|
+
export { dataVisibilityLevels } from './components/data/visibility.js';
|
|
42
45
|
export { default as ReportDialog } from './components/report/ReportDialog.svelte';
|
|
46
|
+
export { default as NotificationList } from './components/notifications/NotificationList.svelte';
|
|
47
|
+
export { default as NotificationSettings } from './components/notifications/NotificationSettings.svelte';
|
|
48
|
+
export { default as NotificationPushToggle } from './components/notifications/NotificationPushToggle.svelte';
|
|
43
49
|
export { default as Tabs } from './components/Tabs.svelte';
|
|
44
50
|
export { default as Icon } from './components/Icon.svelte';
|
|
45
51
|
export { default as IconRail } from './components/IconRail.svelte';
|
package/dist/legal.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/** Framework-free authoring helpers for scripts; UI components use the main entry. */
|
|
2
2
|
export { createLegalDrafts, getLegalDraftIssues, getLegalDocumentIssues } from './components/legal/drafts.js';
|
|
3
3
|
export type { LegalDocumentData, LegalDocumentKind, LegalDraftConfig, LegalSection, LegalFooterLinks } from './components/legal/types.js';
|
|
4
|
+
export { getDataLabelIssues } from './components/data/issues.js';
|
|
5
|
+
export { dataVisibilityLevels } from './components/data/visibility.js';
|
|
6
|
+
export type { DataLabelData, DataLabelEntry, DataVisibility } from './components/data/types.js';
|
package/dist/legal.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
/** Framework-free authoring helpers for scripts; UI components use the main entry. */
|
|
2
2
|
export { createLegalDrafts, getLegalDraftIssues, getLegalDocumentIssues } from './components/legal/drafts.js';
|
|
3
|
+
export { getDataLabelIssues } from './components/data/issues.js';
|
|
4
|
+
export { dataVisibilityLevels } from './components/data/visibility.js';
|
package/dist/media.d.ts
CHANGED
|
@@ -8,3 +8,36 @@ export type Photo = {
|
|
|
8
8
|
height?: number;
|
|
9
9
|
contentWarning?: boolean;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* An image with what the browser needs before it loads: its size, so that its space is kept
|
|
13
|
+
* (no layout shift), and smaller versions to choose from. Only `src` is required; each other
|
|
14
|
+
* field is left off the `<img>` when absent or invalid.
|
|
15
|
+
*/
|
|
16
|
+
export type SizedImage = {
|
|
17
|
+
src: string;
|
|
18
|
+
/** Candidates with width descriptors, e.g. `a.webp 1000w, b.webp 2000w`. */
|
|
19
|
+
srcset?: string;
|
|
20
|
+
/** Used with `srcset`; `100vw` when there is none. */
|
|
21
|
+
sizes?: string;
|
|
22
|
+
/** Intrinsic size in pixels; both or neither. */
|
|
23
|
+
width?: number;
|
|
24
|
+
height?: number;
|
|
25
|
+
/** Without it, an image loads lazily unless its `fetchpriority` is `high`. */
|
|
26
|
+
loading?: 'lazy' | 'eager';
|
|
27
|
+
fetchpriority?: 'high' | 'low' | 'auto';
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* An image address that is safe to load: HTTP(S), a path on the app's own origin, or a
|
|
31
|
+
* `blob:` address. Never a script, and never a path a browser would read as another host.
|
|
32
|
+
*/
|
|
33
|
+
export declare function safeImageSrc(value: unknown): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The safe candidates of a `srcset`, each an address and a width descriptor (`1000w`). An
|
|
36
|
+
* address may itself contain commas, as image-resizing URLs often do.
|
|
37
|
+
*/
|
|
38
|
+
export declare function safeSrcset(value: unknown): string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* An image as an `<img>` can take it: a safe address, valid candidates, both dimensions or
|
|
41
|
+
* neither, and how it loads. A plain address is an image without the rest.
|
|
42
|
+
*/
|
|
43
|
+
export declare function sizedImage(value: string | SizedImage | null | undefined, defaults?: Pick<SizedImage, 'loading'>): SizedImage | undefined;
|