@atmo-dev/kit 0.15.0 → 0.15.1

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.
@@ -150,8 +150,9 @@
150
150
  const editorClass =
151
151
  'min-h-[1.5em] outline-none break-words [&_p.is-editor-empty:first-child]:before:content-[attr(data-placeholder)] [&_p.is-editor-empty:first-child]:before:text-base-600 dark:[&_p.is-editor-empty:first-child]:before:text-base-400 [&_p.is-editor-empty:first-child]:before:float-left [&_p.is-editor-empty:first-child]:before:pointer-events-none [&_p.is-editor-empty:first-child]:before:h-0 [&_[data-link-embed]]:whitespace-normal [&_.ProseMirror-selectednode]:rounded-ui [&_.ProseMirror-selectednode]:outline-2 [&_.ProseMirror-selectednode]:outline-offset-2 [&_.ProseMirror-selectednode]:outline-accent-700 dark:[&_.ProseMirror-selectednode]:outline-accent-300';
152
152
  // The same look as `RichText`, so that what is typed is what will be shown.
153
+ // Nothing here reaches into an embed, which brings its own lists, links and code.
153
154
  const markdownClass =
154
- 'space-y-3 leading-relaxed whitespace-pre-wrap [&_strong]:font-semibold [&_h1]:text-xl [&_h2]:text-lg [&_:is(h1,h2,h3,h4,h5,h6)]:leading-snug [&_:is(h1,h2,h3,h4,h5,h6)]:font-semibold [&_blockquote]:space-y-3 [&_blockquote]:border-l-2 [&_blockquote]:border-base-300 [&_blockquote]:pl-4 dark:[&_blockquote]:border-[color-mix(in_srgb,var(--base-800)_80%,var(--base-950))] [&_:is(ul,ol)]:space-y-1 [&_:is(ul,ol)]:pl-6 [&_ul]:list-disc [&_ol]:list-decimal [&_li]:space-y-3 [&_:not(pre)>code]:rounded [&_:not(pre)>code]:bg-[color-mix(in_srgb,var(--base-100)_75%,var(--base-200))] [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:font-mono [&_:not(pre)>code]:text-[0.875em] dark:[&_:not(pre)>code]:bg-base-950 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-[color-mix(in_srgb,var(--base-100)_75%,var(--base-200))] [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-[0.875em] dark:[&_pre]:bg-base-950 [&_hr]:border-base-300 dark:[&_hr]:border-[color-mix(in_srgb,var(--base-800)_80%,var(--base-950))] [&_a]:text-accent-700 [&_a]:underline [&_a]:decoration-accent-700/40 [&_a]:underline-offset-2 dark:[&_a]:text-accent-300 dark:[&_a]:decoration-accent-300/40';
155
+ 'space-y-3 leading-relaxed whitespace-pre-wrap [&_strong:not([data-link-embed]_*)]:font-semibold [&_h1:not([data-link-embed]_*)]:text-xl [&_h2:not([data-link-embed]_*)]:text-lg [&_:is(h1,h2,h3,h4,h5,h6):not([data-link-embed]_*)]:leading-snug [&_:is(h1,h2,h3,h4,h5,h6):not([data-link-embed]_*)]:font-semibold [&_blockquote:not([data-link-embed]_*)]:space-y-3 [&_blockquote:not([data-link-embed]_*)]:border-l-2 [&_blockquote:not([data-link-embed]_*)]:border-base-300 [&_blockquote:not([data-link-embed]_*)]:pl-4 dark:[&_blockquote:not([data-link-embed]_*)]:border-[color-mix(in_srgb,var(--base-800)_80%,var(--base-950))] [&_:is(ul,ol):not([data-link-embed]_*)]:space-y-1 [&_:is(ul,ol):not([data-link-embed]_*)]:pl-6 [&_ul:not([data-link-embed]_*)]:list-disc [&_ol:not([data-link-embed]_*)]:list-decimal [&_li:not([data-link-embed]_*)]:space-y-3 [&_:not(pre)>code:not([data-link-embed]_*)]:rounded [&_:not(pre)>code:not([data-link-embed]_*)]:bg-[color-mix(in_srgb,var(--base-100)_75%,var(--base-200))] [&_:not(pre)>code:not([data-link-embed]_*)]:px-1 [&_:not(pre)>code:not([data-link-embed]_*)]:py-0.5 [&_:not(pre)>code:not([data-link-embed]_*)]:font-mono [&_:not(pre)>code:not([data-link-embed]_*)]:text-[0.875em] dark:[&_:not(pre)>code:not([data-link-embed]_*)]:bg-base-950 [&_pre:not([data-link-embed]_*)]:overflow-x-auto [&_pre:not([data-link-embed]_*)]:rounded-md [&_pre:not([data-link-embed]_*)]:bg-[color-mix(in_srgb,var(--base-100)_75%,var(--base-200))] [&_pre:not([data-link-embed]_*)]:p-3 [&_pre:not([data-link-embed]_*)]:font-mono [&_pre:not([data-link-embed]_*)]:text-[0.875em] dark:[&_pre:not([data-link-embed]_*)]:bg-base-950 [&_hr:not([data-link-embed]_*)]:border-base-300 dark:[&_hr:not([data-link-embed]_*)]:border-[color-mix(in_srgb,var(--base-800)_80%,var(--base-950))] [&_a:not([data-link-embed]_*)]:text-accent-700 [&_a:not([data-link-embed]_*)]:underline [&_a:not([data-link-embed]_*)]:decoration-accent-700/40 [&_a:not([data-link-embed]_*)]:underline-offset-2 dark:[&_a:not([data-link-embed]_*)]:text-accent-300 dark:[&_a:not([data-link-embed]_*)]:decoration-accent-300/40';
155
156
 
156
157
  onMount(() => {
157
158
  let instance: Editor | undefined;
@@ -4,6 +4,8 @@
4
4
  import { Avatar, Button, ToggleGroup, ToggleGroupItem } from '../index.js';
5
5
  import { onMount, untrack } from 'svelte';
6
6
  import { InlineEditor, RichTextEditor, type Editor } from '../index.js';
7
+ import { linkEmbedOptions, selectLinkEmbeds } from '../embeds/context.js';
8
+ import { eventLinkEmbed } from './event-link-embed.js';
7
9
  import DateTimePicker from '../components/DateTimePicker.svelte';
8
10
  import TimezonePicker from '../components/TimezonePicker.svelte';
9
11
  import { parseDateTime } from '@internationalized/date';
@@ -95,6 +97,25 @@
95
97
  initialThumbnailFile ? null : eventData === null ? DEFAULT_PRESET : null
96
98
  );
97
99
  let images = $derived(adapter.features.images !== false);
100
+ const embedOptions = linkEmbedOptions();
101
+ /** As on the event page: the app's embeds, plus cards for links to other events. */
102
+ let descriptionEmbeds = $derived.by(() => {
103
+ const loadEvent = adapter.linkedRecords?.getEvent;
104
+ const origin = globalThis.location?.origin;
105
+ return [
106
+ ...(loadEvent
107
+ ? [
108
+ eventLinkEmbed({
109
+ loadEvent,
110
+ origins: [...new Set(['https://atmo.rsvp', ...(origin ? [origin] : [])])],
111
+ skip: (link) =>
112
+ link.rkey === rkey && (link.actor === actorDid || link.actor === viewer.handle)
113
+ })
114
+ ]
115
+ : []),
116
+ ...selectLinkEmbeds(true, embedOptions())
117
+ ];
118
+ });
98
119
  let showVisibility = $derived(adapter.features.visibility !== false);
99
120
  let submitting = $state(false);
100
121
  let error: string | null = $state(null);
@@ -439,7 +460,8 @@
439
460
  label="Event description"
440
461
  bind:value={description}
441
462
  markdown
442
- embeds
463
+ embeds={descriptionEmbeds}
464
+ socialClient={viewer.preferredSocialClient}
443
465
  placeholder="What's this event about? @mentions, #hashtags and links will be detected automatically."
444
466
  class="min-h-24 leading-relaxed text-base-700 focus-within:outline-none dark:text-base-300"
445
467
  />
@@ -1,6 +1,6 @@
1
- import { fromMarkdown } from 'mdast-util-from-markdown';
2
- import { gfmStrikethrough } from 'micromark-extension-gfm-strikethrough';
3
- import { gfmStrikethroughFromMarkdown } from 'mdast-util-gfm-strikethrough';
1
+ // The parser is bundled into the kit. Its packages' development builds need bundler setup in
2
+ // every app (they import CommonJS), and this is the same production build everywhere.
3
+ import { markdownTree } from './vendor/markdown-tree.js';
4
4
  import { safeWebUrl } from './document.js';
5
5
  import { applyRanges, detectLinks, hasFacets, resolveFacets } from './facets.js';
6
6
  import { parsePlainText } from './plain.js';
@@ -224,10 +224,7 @@ function collectDefinitions(node, definitions, depth = 0) {
224
224
  export function parseMarkdown(text, options = {}) {
225
225
  if (exceedsMarkdownLimits(text))
226
226
  return parsePlainText(text, options);
227
- const tree = fromMarkdown(text, {
228
- extensions: [gfmStrikethrough({ singleTilde: false })],
229
- mdastExtensions: [gfmStrikethroughFromMarkdown()]
230
- });
227
+ const tree = markdownTree(text);
231
228
  const definitions = new Map();
232
229
  collectDefinitions(tree, definitions);
233
230
  const context = {
@@ -0,0 +1,5 @@
1
+ /**
2
+ * CommonMark plus ~~strikethrough~~, as an mdast `Root` with source positions. The parser is
3
+ * bundled here, so apps need no bundler configuration for it.
4
+ */
5
+ export function markdownTree(text: string): unknown;