@atmo-dev/kit 0.11.1 → 0.13.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.
Files changed (53) hide show
  1. package/dist/components/RichText.svelte +17 -1
  2. package/dist/components/RichText.svelte.d.ts +8 -0
  3. package/dist/components/SembleCollectionPicker.svelte +221 -0
  4. package/dist/components/SembleCollectionPicker.svelte.d.ts +14 -0
  5. package/dist/components/SembleCollectionView.svelte +153 -0
  6. package/dist/components/SembleCollectionView.svelte.d.ts +10 -0
  7. package/dist/events/EventComments.svelte +15 -2
  8. package/dist/events/EventView.svelte +100 -28
  9. package/dist/events/VodPlayer.svelte +14 -73
  10. package/dist/events/VodPlayer.svelte.d.ts +0 -1
  11. package/dist/events/editor/LinkedRecordsPicker.svelte +44 -3
  12. package/dist/events/editor/LinksSection.svelte +29 -9
  13. package/dist/events/editor/adapter.d.ts +3 -0
  14. package/dist/events/event-view/EventLinkEmbed.svelte +49 -0
  15. package/dist/events/event-view/EventLinkEmbed.svelte.d.ts +14 -0
  16. package/dist/events/event-view/Player.svelte +431 -0
  17. package/dist/events/event-view/Player.svelte.d.ts +24 -0
  18. package/dist/events/event-view/PostLinkEmbed.svelte +71 -0
  19. package/dist/events/event-view/PostLinkEmbed.svelte.d.ts +11 -0
  20. package/dist/events/event-view/ProfileLinkEmbed.svelte +67 -0
  21. package/dist/events/event-view/ProfileLinkEmbed.svelte.d.ts +11 -0
  22. package/dist/events/event-view/StreamPlacePlayer.svelte +13 -46
  23. package/dist/events/event-view/StreamPlacePlayer.svelte.d.ts +0 -1
  24. package/dist/events/linked-records.d.ts +20 -0
  25. package/dist/events/linked-records.js +32 -2
  26. package/dist/events/schedule/ScheduleEventCell.svelte +2 -1
  27. package/dist/events/urls.d.ts +17 -0
  28. package/dist/events/urls.js +11 -0
  29. package/dist/events-data.d.ts +1 -0
  30. package/dist/events-data.js +1 -0
  31. package/dist/index.d.ts +7 -1
  32. package/dist/index.js +5 -1
  33. package/dist/richtext/document.d.ts +9 -0
  34. package/dist/richtext/document.js +35 -0
  35. package/dist/richtext.d.ts +1 -1
  36. package/dist/richtext.js +1 -1
  37. package/dist/semble/types.d.ts +46 -0
  38. package/dist/semble/types.js +1 -0
  39. package/dist/semble/urls.d.ts +2 -0
  40. package/dist/semble/urls.js +43 -0
  41. package/dist/semble/xrpc.d.ts +3 -0
  42. package/dist/semble/xrpc.js +131 -0
  43. package/dist/semble.d.ts +3 -0
  44. package/dist/semble.js +2 -0
  45. package/dist/social/posts.d.ts +7 -0
  46. package/dist/social/posts.js +21 -0
  47. package/dist/social/urls.d.ts +10 -0
  48. package/dist/social/urls.js +43 -1
  49. package/dist/social.d.ts +3 -1
  50. package/dist/social.js +2 -1
  51. package/package.json +5 -6
  52. package/dist/events/event-view/plyr-icons.d.ts +0 -3
  53. package/dist/events/event-view/plyr-icons.js +0 -46
@@ -1,5 +1,26 @@
1
1
  import { isActorIdentifier, isRecordKey } from '@atcute/lexicons/syntax';
2
2
  import { blueskyProfileUrl } from './urls.js';
3
+ /**
4
+ * Whether an AppView view carries a moderation label anywhere: for a post, on the post, its
5
+ * author, or anything it embeds (a quoted post and its author, at any depth). Apps without the
6
+ * viewer's moderation preferences can use it to leave such content out. Pass a single post
7
+ * view, not a thread: a thread's replies would count too.
8
+ */
9
+ export function hasModerationLabel(value, depth = 0) {
10
+ if (!value || typeof value !== 'object')
11
+ return false;
12
+ // Deeper than any real view nests: treat as labeled rather than render it unchecked.
13
+ if (depth > 12)
14
+ return true;
15
+ if (Array.isArray(value))
16
+ return value.some((item) => hasModerationLabel(item, depth + 1));
17
+ const { labels } = value;
18
+ // Views list labels; records self-label with `{ values: [...] }`.
19
+ const list = Array.isArray(labels) ? labels : labels?.values;
20
+ if (Array.isArray(list) && list.some((label) => !label?.neg))
21
+ return true;
22
+ return Object.entries(value).some(([key, child]) => key !== 'labels' && hasModerationLabel(child, depth + 1));
23
+ }
3
24
  /** Convert record-view variants without mistaking blocked authors or starter packs for posts. */
4
25
  function recordEmbed(record, depth) {
5
26
  const type = record.$type;
@@ -7,3 +7,13 @@ export declare function socialProfileUrl(identifier: string, client?: PreferredS
7
7
  export declare function socialHashtagUrl(tag: string, client?: PreferredSocialClient | null): string;
8
8
  /** Open a feed-post AT URI in the viewer's preferred Bluesky-compatible client. */
9
9
  export declare function socialPostUrl(uri: string, client?: PreferredSocialClient | null): string | null;
10
+ /** Recognize a post link on Bluesky or another listed client. Syntax only; the post may not exist. */
11
+ export declare function parseSocialPostUrl(value: string): {
12
+ actor: string;
13
+ rkey: string;
14
+ uri: string;
15
+ } | null;
16
+ /** Recognize a profile link on Bluesky or another listed client. Syntax only. */
17
+ export declare function parseSocialProfileUrl(value: string): {
18
+ actor: string;
19
+ } | null;
@@ -1,5 +1,5 @@
1
1
  import { isActorIdentifier, isDid, isRecordKey } from '@atcute/lexicons/syntax';
2
- import { socialClientInfo } from './preferred-client.js';
2
+ import { socialClientInfo, socialClients } from './preferred-client.js';
3
3
  /** Bluesky expects literal DIDs in its routes, including colons and did:web escapes. */
4
4
  export function blueskyProfileUrl(identifier) {
5
5
  return socialProfileUrl(identifier);
@@ -20,3 +20,45 @@ export function socialPostUrl(uri, client) {
20
20
  return null;
21
21
  return `${socialProfileUrl(match[1], client)}/post/${encodeURIComponent(match[2])}`;
22
22
  }
23
+ const postHosts = new Set(socialClients.map(({ url }) => new URL(url).hostname));
24
+ /** The path of a link to one of the listed clients, e.g. `/profile/alice.example`. */
25
+ function clientPath(value) {
26
+ try {
27
+ const url = new URL(value);
28
+ if (url.protocol !== 'https:' || url.username || url.password || url.port)
29
+ return null;
30
+ return postHosts.has(url.hostname) ? url.pathname : null;
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ /** Recognize a post link on Bluesky or another listed client. Syntax only; the post may not exist. */
37
+ export function parseSocialPostUrl(value) {
38
+ try {
39
+ const match = /^\/profile\/([^/]+)\/post\/([^/]+)\/?$/.exec(clientPath(value) ?? '');
40
+ if (!match)
41
+ return null;
42
+ const actor = decodeURIComponent(match[1]);
43
+ const rkey = decodeURIComponent(match[2]);
44
+ if (!isActorIdentifier(actor) || !isRecordKey(rkey))
45
+ return null;
46
+ return { actor, rkey, uri: `at://${actor}/app.bsky.feed.post/${rkey}` };
47
+ }
48
+ catch {
49
+ return null;
50
+ }
51
+ }
52
+ /** Recognize a profile link on Bluesky or another listed client. Syntax only. */
53
+ export function parseSocialProfileUrl(value) {
54
+ try {
55
+ const match = /^\/profile\/([^/]+)\/?$/.exec(clientPath(value) ?? '');
56
+ if (!match)
57
+ return null;
58
+ const actor = decodeURIComponent(match[1]);
59
+ return isActorIdentifier(actor) ? { actor } : null;
60
+ }
61
+ catch {
62
+ return null;
63
+ }
64
+ }
package/dist/social.d.ts CHANGED
@@ -2,4 +2,6 @@ export { PREFERRED_CLIENT_COLLECTION, PREFERRED_CLIENT_RKEY, PREFERRED_CLIENT_SC
2
2
  export type { SocialClientId, PreferredSocialClient } from './social/preferred-client.js';
3
3
  export { defaultExternalEmbedProviders, youtubeEmbedProvider, klipyEmbedProvider, resolveExternalEmbed } from './social/external-embeds.js';
4
4
  export type { ExternalPostEmbed, ExternalEmbedProvider, ExternalEmbedPlayer } from './social/external-embeds.js';
5
- export { blueskyProfileUrl, socialProfileUrl, socialPostUrl, socialHashtagUrl } from './social/urls.js';
5
+ export { blueskyPostToPostData, hasModerationLabel } from './social/posts.js';
6
+ export type { PostData, PostEmbed, BlueskyPostView } from './social/posts.js';
7
+ export { blueskyProfileUrl, socialProfileUrl, socialPostUrl, socialHashtagUrl, parseSocialPostUrl, parseSocialProfileUrl } from './social/urls.js';
package/dist/social.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { PREFERRED_CLIENT_COLLECTION, PREFERRED_CLIENT_RKEY, PREFERRED_CLIENT_SCOPE, socialClients, normalizeSocialClientUrl, parsePreferredSocialClient, preferredSocialClientRecord, socialClientInfo } from './social/preferred-client.js';
2
2
  export { defaultExternalEmbedProviders, youtubeEmbedProvider, klipyEmbedProvider, resolveExternalEmbed } from './social/external-embeds.js';
3
- export { blueskyProfileUrl, socialProfileUrl, socialPostUrl, socialHashtagUrl } from './social/urls.js';
3
+ export { blueskyPostToPostData, hasModerationLabel } from './social/posts.js';
4
+ export { blueskyProfileUrl, socialProfileUrl, socialPostUrl, socialHashtagUrl, parseSocialPostUrl, parseSocialProfileUrl } from './social/urls.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atmo-dev/kit",
3
- "version": "0.11.1",
3
+ "version": "0.13.0",
4
4
  "description": "The shared UI foundation for Atmo apps.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -48,6 +48,10 @@
48
48
  "types": "./dist/grain.d.ts",
49
49
  "default": "./dist/grain.js"
50
50
  },
51
+ "./semble": {
52
+ "types": "./dist/semble.d.ts",
53
+ "default": "./dist/semble.js"
54
+ },
51
55
  "./streamplace": {
52
56
  "types": "./dist/streamplace.d.ts",
53
57
  "default": "./dist/streamplace.js"
@@ -77,7 +81,6 @@
77
81
  },
78
82
  "peerDependencies": {
79
83
  "maplibre-gl": "^6.16.0",
80
- "plyr": "^3.8.5",
81
84
  "svelte": ">=5.48.0 <6",
82
85
  "svelte-maplibre-gl": "^2.2.1",
83
86
  "tailwindcss": "^4.0.0"
@@ -88,9 +91,6 @@
88
91
  },
89
92
  "svelte-maplibre-gl": {
90
93
  "optional": true
91
- },
92
- "plyr": {
93
- "optional": true
94
94
  }
95
95
  },
96
96
  "devDependencies": {
@@ -116,7 +116,6 @@
116
116
  "globals": "^17.6.0",
117
117
  "maplibre-gl": "^6.16.0",
118
118
  "playwright": "^1.60.0",
119
- "plyr": "^3.8.5",
120
119
  "prettier": "^3.8.3",
121
120
  "prettier-plugin-svelte": "^4.1.0",
122
121
  "prettier-plugin-tailwindcss": "^0.8.0",
@@ -1,3 +0,0 @@
1
- import type Plyr from 'plyr';
2
- /** Called in the browser before constructing either video player. */
3
- export declare function sketchyPlyrIcons(): Pick<Plyr.Options, 'iconPrefix' | 'iconUrl' | 'loadSprite'>;
@@ -1,46 +0,0 @@
1
- import { Captions, CaptionsOff, Maximize, Minimize, Pause, Play, Settings, Volume2, VolumeX } from '@sketchyicons/svelte';
2
- const prefix = 'atmo-sketchy-plyr';
3
- const icons = {
4
- play: Play,
5
- pause: Pause,
6
- volume: Volume2,
7
- muted: VolumeX,
8
- 'captions-on': Captions,
9
- 'captions-off': CaptionsOff,
10
- 'enter-fullscreen': Maximize,
11
- 'exit-fullscreen': Minimize,
12
- settings: Settings
13
- };
14
- /** Called in the browser before constructing either video player. */
15
- export function sketchyPlyrIcons() {
16
- // One local sprite serves every player, without fetching Plyr's stock CDN icons.
17
- if (!document.getElementById(prefix)) {
18
- const ns = 'http://www.w3.org/2000/svg';
19
- const sprite = document.createElementNS(ns, 'svg');
20
- sprite.id = prefix;
21
- sprite.setAttribute('width', '0');
22
- sprite.setAttribute('height', '0');
23
- sprite.setAttribute('aria-hidden', 'true');
24
- sprite.setAttribute('focusable', 'false');
25
- sprite.style.position = 'absolute';
26
- for (const [name, nodes] of Object.entries(icons)) {
27
- const symbol = document.createElementNS(ns, 'symbol');
28
- symbol.id = `${prefix}-${name}`;
29
- symbol.setAttribute('viewBox', '0 0 24 24');
30
- symbol.setAttribute('stroke', 'currentColor');
31
- symbol.setAttribute('stroke-width', '1.75');
32
- symbol.setAttribute('stroke-linecap', 'round');
33
- symbol.setAttribute('stroke-linejoin', 'round');
34
- for (const [, attributes] of nodes) {
35
- const path = document.createElementNS(ns, 'path');
36
- path.setAttribute('d', String(attributes.d));
37
- path.setAttribute('fill', String(attributes.fill ?? 'none'));
38
- symbol.appendChild(path);
39
- }
40
- sprite.appendChild(symbol);
41
- }
42
- document.body.appendChild(sprite);
43
- }
44
- // An empty iconUrl makes Plyr reference the local symbols by fragment only.
45
- return { iconPrefix: prefix, iconUrl: '', loadSprite: false };
46
- }