@frontfactory/vitepress-theme 1.9.0 → 1.10.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.
@@ -1,9 +1,8 @@
1
1
  <script setup lang="ts">
2
- import {
3
- computed, onMounted, ref, watchEffect
4
- } from 'vue';
2
+ import { computed, ref } from 'vue';
5
3
  import { useData } from 'vitepress';
6
4
  import { useLabels, useThemeOptions } from '../composables/options';
5
+ import { useFrameListener } from '../composables/frame';
7
6
 
8
7
  const { theme } = useData();
9
8
  const options = useThemeOptions();
@@ -21,18 +20,6 @@ function update() {
21
20
  visible.value = window.scrollY > window.innerHeight;
22
21
  }
23
22
 
24
- // At most one state update per frame, however many scroll events fire.
25
- let frame = 0;
26
-
27
- function onScroll() {
28
- if (!frame) {
29
- frame = requestAnimationFrame(() => {
30
- frame = 0;
31
- update();
32
- });
33
- }
34
- }
35
-
36
23
  function toTop() {
37
24
  window.scrollTo({
38
25
  top: 0,
@@ -40,26 +27,9 @@ function toTop() {
40
27
  });
41
28
  }
42
29
 
43
- // Listens only while the control is enabled, and follows the option if it changes (locale switch).
44
- // The effect is stopped with the component, which runs its cleanup.
45
- onMounted(() => {
46
- watchEffect((onCleanup) => {
47
- if (!enabled.value) {
48
- return;
49
- }
50
-
51
- update();
52
- window.addEventListener('scroll', onScroll, {
53
- passive: true
54
- });
55
-
56
- onCleanup(() => {
57
- cancelAnimationFrame(frame);
58
- frame = 0;
59
- window.removeEventListener('scroll', onScroll);
60
- });
61
- });
62
- });
30
+ useFrameListener(enabled, update, [
31
+ 'scroll'
32
+ ]);
63
33
  </script>
64
34
 
65
35
  <template>
@@ -4,6 +4,7 @@ import {
4
4
  } from 'vue';
5
5
  import { useLabels, useThemeOptions } from '../composables/options';
6
6
  import { normalizeLink } from '../internal';
7
+ import { BANNER_DISMISSED_CLASS, bannerKey } from '../../node/banner.js';
7
8
 
8
9
  const options = useThemeOptions();
9
10
  const labels = useLabels();
@@ -14,7 +15,7 @@ let observer: ResizeObserver | undefined;
14
15
 
15
16
  // The class is set on <html> by an inline script injected in the head, so a dismissed banner never
16
17
  // paints. See transformHead() in config.js.
17
- const DISMISSED = 'ff-banner-dismissed';
18
+ const DISMISSED = BANNER_DISMISSED_CLASS;
18
19
 
19
20
  function height() {
20
21
  const root = document.documentElement;
@@ -34,7 +35,7 @@ function dismiss() {
34
35
  }
35
36
 
36
37
  try {
37
- localStorage.setItem(`ff-banner-${banner.value.id}`, 'dismissed');
38
+ localStorage.setItem(bannerKey(banner.value.id), 'dismissed');
38
39
  } catch {
39
40
  // Private mode or full quota: the banner is dismissed for this page view only.
40
41
  }
@@ -1,26 +1,19 @@
1
1
  <script setup lang="ts">
2
2
  import {
3
- onMounted, onUnmounted, ref
3
+ computed, onMounted, onUnmounted
4
4
  } from 'vue';
5
5
  import { useLabels } from '../composables/options';
6
+ import { useTransientFlag } from '../composables/transient';
6
7
 
7
8
  const labels = useLabels();
8
- const message = ref('');
9
+ const { active, start, stop } = useTransientFlag();
10
+ const message = computed(() => (active.value ? labels.value.codeCopied : ''));
9
11
 
10
12
  // VitePress confirms a code block copy with a CSS `::before` only, which screen readers never
11
13
  // hear. Its click handler adds `.copied` once the clipboard write succeeds, so the class is what
12
14
  // gets watched rather than the click itself.
13
15
  const BUTTON = 'div[class*="language-"] > button.copy';
14
16
 
15
- let timer: ReturnType<typeof setTimeout> | undefined;
16
-
17
- function announce() {
18
- message.value = labels.value.codeCopied;
19
-
20
- clearTimeout(timer);
21
- timer = setTimeout(() => (message.value = ''), 2000);
22
- }
23
-
24
17
  function onClick(event: MouseEvent) {
25
18
  const button = (event.target as Element | null)?.closest?.(BUTTON);
26
19
 
@@ -29,12 +22,12 @@ function onClick(event: MouseEvent) {
29
22
  }
30
23
 
31
24
  // Cleared first, so a second copy within two seconds is announced again.
32
- message.value = '';
25
+ stop();
33
26
 
34
27
  const observer = new MutationObserver(() => {
35
28
  if (button.classList.contains('copied')) {
36
29
  observer.disconnect();
37
- announce();
30
+ start();
38
31
  }
39
32
  });
40
33
 
@@ -52,7 +45,6 @@ onMounted(() => window.addEventListener('click', onClick));
52
45
 
53
46
  onUnmounted(() => {
54
47
  window.removeEventListener('click', onClick);
55
- clearTimeout(timer);
56
48
  });
57
49
  </script>
58
50
 
@@ -5,6 +5,8 @@ import {
5
5
  import { useData } from 'vitepress';
6
6
  import { useLayout } from '../internal';
7
7
  import { useCopy } from '../composables/copy';
8
+ import { resolveOption } from '../../node/options.js';
9
+ import { resolvePageActions, type Network } from '../../node/page-actions.js';
8
10
  import { formatRelative } from '../composables/relativeTime';
9
11
  import {
10
12
  format, useLabels, useThemeOptions
@@ -16,13 +18,9 @@ const { sidebarGroups } = useLayout();
16
18
  const options = useThemeOptions();
17
19
  const labels = useLabels();
18
20
 
19
- const meta = computed(() => {
20
- if (options.value.meta === false || frontmatter.value.docMeta === false) {
21
- return null;
22
- }
23
-
24
- return options.value.meta ?? {};
25
- });
21
+ const meta = computed(() =>
22
+ resolveOption(options.value.meta ?? true, frontmatter.value.docMeta === false)
23
+ );
26
24
 
27
25
  // --------------------------------------------------------------------------------------------- //
28
26
  // Section, read from the sidebar the site already declares
@@ -118,8 +116,6 @@ const updatedAt = computed(() =>
118
116
  // `pageActions: { copyMarkdown: true }`.
119
117
  // --------------------------------------------------------------------------------------------- //
120
118
 
121
- type Network = 'x' | 'linkedin' | 'bluesky' | 'mastodon';
122
-
123
119
  // 24px viewBox paths: the interface icons are stroked, the brand ones (Simple Icons, CC0) filled.
124
120
  const icons = {
125
121
  copy: 'M10 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2zM4 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2',
@@ -194,15 +190,11 @@ MetaIcon.props = [
194
190
  const markdown = computed(() => (page.value as { ffMarkdown?: string }).ffMarkdown ?? '');
195
191
 
196
192
  const actions = computed(() => {
197
- const { pageActions, copyMarkdown } = options.value;
198
- const all = pageActions === true;
199
- const config = typeof pageActions === 'object' ? pageActions : {};
193
+ const resolved = resolvePageActions(options.value);
200
194
 
201
195
  return {
202
- markdown: (all || config.copyMarkdown || copyMarkdown === true) && !!markdown.value,
203
- link: all || !!config.copyLink,
204
- share: all ? (Object.keys(networks) as Network[]) : (config.share ?? []),
205
- instance: config.mastodonInstance ?? 'mastodon.social'
196
+ ...resolved,
197
+ markdown: resolved.markdown && !!markdown.value
206
198
  };
207
199
  });
208
200
 
@@ -4,20 +4,15 @@ import {
4
4
  } from 'vue';
5
5
  import { useData } from 'vitepress';
6
6
  import { useLabels, useThemeOptions } from '../composables/options';
7
+ import { resolveOption } from '../../node/options.js';
7
8
 
8
9
  const { page, frontmatter, lang } = useData();
9
10
  const options = useThemeOptions();
10
11
  const labels = useLabels();
11
12
 
12
- const config = computed(() => {
13
- const { feedback } = options.value;
14
-
15
- if (!feedback || frontmatter.value.feedback === false) {
16
- return null;
17
- }
18
-
19
- return feedback === true ? {} : feedback;
20
- });
13
+ const config = computed(() =>
14
+ resolveOption(options.value.feedback, frontmatter.value.feedback === false)
15
+ );
21
16
 
22
17
  const question = computed(() => config.value?.question || labels.value.feedbackQuestion);
23
18
 
@@ -5,6 +5,7 @@ import {
5
5
  formatDate, resolveAuthor, useBlog
6
6
  } from '../composables/blog';
7
7
  import { format, useLabels } from '../composables/options';
8
+ import { toTags } from '../../node/blog.js';
8
9
  import { normalizeLink } from '../internal';
9
10
 
10
11
  const { frontmatter, lang } = useData();
@@ -13,7 +14,7 @@ const labels = useLabels();
13
14
 
14
15
  const date = computed(() => (isPost.value ? new Date(frontmatter.value.date).toISOString() : ''));
15
16
  const author = computed(() => resolveAuthor(authors.value, frontmatter.value.author));
16
- const tags = computed<string[]>(() => (Array.isArray(frontmatter.value.tags) ? frontmatter.value.tags : []));
17
+ const tags = computed<string[]>(() => (toTags(frontmatter.value.tags) as string[]));
17
18
  </script>
18
19
 
19
20
  <template>
@@ -1,9 +1,8 @@
1
1
  <script setup lang="ts">
2
- import {
3
- computed, onMounted, ref, watchEffect
4
- } from 'vue';
2
+ import { computed, ref } from 'vue';
5
3
  import { useData } from 'vitepress';
6
4
  import { useThemeOptions } from '../composables/options';
5
+ import { useFrameListener } from '../composables/frame';
7
6
 
8
7
  const { frontmatter } = useData();
9
8
  const options = useThemeOptions();
@@ -18,43 +17,10 @@ function update() {
18
17
  progress.value = range > 0 ? Math.min(Math.max(window.scrollY / range, 0), 1) : 0;
19
18
  }
20
19
 
21
- // At most one state update per frame, however many scroll events fire.
22
- let frame = 0;
23
-
24
- function onChange() {
25
- if (!frame) {
26
- frame = requestAnimationFrame(() => {
27
- frame = 0;
28
- update();
29
- });
30
- }
31
- }
32
-
33
- // Listens only while the bar is enabled, and follows the option if it changes (locale switch,
34
- // per-page frontmatter). The effect is stopped with the component, which runs its cleanup.
35
- onMounted(() => {
36
- watchEffect((onCleanup) => {
37
- if (!enabled.value) {
38
- return;
39
- }
40
-
41
- update();
42
- window.addEventListener('scroll', onChange, {
43
- passive: true
44
- });
45
-
46
- window.addEventListener('resize', onChange, {
47
- passive: true
48
- });
49
-
50
- onCleanup(() => {
51
- cancelAnimationFrame(frame);
52
- frame = 0;
53
- window.removeEventListener('scroll', onChange);
54
- window.removeEventListener('resize', onChange);
55
- });
56
- });
57
- });
20
+ useFrameListener(enabled, update, [
21
+ 'scroll',
22
+ 'resize'
23
+ ]);
58
24
  </script>
59
25
 
60
26
  <template>
@@ -1,8 +1,11 @@
1
1
  import { computed } from 'vue';
2
2
  import { useData } from 'vitepress';
3
3
  import { useThemeOptions } from './options';
4
- import { blogDir, hasValidDate } from '../../node/blog.js';
5
- import type { BlogAuthor } from '../types';
4
+ import {
5
+ blogDir, isPostPath, resolveAuthor
6
+ } from '../../node/blog.js';
7
+
8
+ export { resolveAuthor };
6
9
 
7
10
  /** Blog options, with the directory normalised (no slash at either end). */
8
11
  export function useBlog() {
@@ -12,11 +15,9 @@ export function useBlog() {
12
15
  const dir = computed(() => blogDir(options.value));
13
16
 
14
17
  // A post is a dated page under the blog directory, the index excluded.
15
- const isPost = computed(() => {
16
- const path = page.value.relativePath;
17
-
18
- return path.startsWith(`${dir.value}/`) && path !== `${dir.value}/index.md` && hasValidDate(frontmatter.value.date);
19
- });
18
+ const isPost = computed(() =>
19
+ isPostPath(dir.value, page.value.relativePath, frontmatter.value.date)
20
+ );
20
21
 
21
22
  return {
22
23
  dir,
@@ -25,13 +26,6 @@ export function useBlog() {
25
26
  };
26
27
  }
27
28
 
28
- /** `author` is a key of `ff.blog.authors`, or a plain name used as is. */
29
- export function resolveAuthor(authors: Record<string, BlogAuthor>, value?: string): BlogAuthor | null {
30
- return value ? authors[value] ?? {
31
- name: value
32
- } : null;
33
- }
34
-
35
29
  // UTC, so the server and the browser print the same day whatever their time zone.
36
30
  export function formatDate(date: string, lang: string) {
37
31
  return new Intl.DateTimeFormat(lang, {
@@ -1,11 +1,9 @@
1
- import {
2
- onUnmounted, ref, toValue, type MaybeRefOrGetter
3
- } from 'vue';
1
+ import { toValue, type MaybeRefOrGetter } from 'vue';
2
+ import { useTransientFlag } from './transient';
4
3
 
5
4
  /** Copies a string to the clipboard and flags it as copied for two seconds. */
6
5
  export function useCopy(text: MaybeRefOrGetter<string>) {
7
- const copied = ref(false);
8
- let timer: ReturnType<typeof setTimeout> | undefined;
6
+ const { active: copied, start } = useTransientFlag();
9
7
 
10
8
  async function copy() {
11
9
  const value = toValue(text);
@@ -21,14 +19,9 @@ export function useCopy(text: MaybeRefOrGetter<string>) {
21
19
  return;
22
20
  }
23
21
 
24
- copied.value = true;
25
-
26
- clearTimeout(timer);
27
- timer = setTimeout(() => (copied.value = false), 2000);
22
+ start();
28
23
  }
29
24
 
30
- onUnmounted(() => clearTimeout(timer));
31
-
32
25
  return {
33
26
  copied,
34
27
  copy
@@ -0,0 +1,50 @@
1
+ import {
2
+ onMounted, toValue, watchEffect, type MaybeRefOrGetter
3
+ } from 'vue';
4
+
5
+ /**
6
+ * Runs `update` once, then at most once per frame however many of the window `events` fire. Listens
7
+ * only while `enabled` is true and follows it if it changes; everything is undone on unmount.
8
+ */
9
+ export function useFrameListener(
10
+ enabled: MaybeRefOrGetter<boolean>,
11
+ update: () => void,
12
+ events: string[]
13
+ ) {
14
+ let frame = 0;
15
+
16
+ function onEvent() {
17
+ if (!frame) {
18
+ frame = requestAnimationFrame(() => {
19
+ frame = 0;
20
+ update();
21
+ });
22
+ }
23
+ }
24
+
25
+ // The effect is stopped with the component, which runs its cleanup.
26
+ onMounted(() => {
27
+ watchEffect((onCleanup) => {
28
+ if (!toValue(enabled)) {
29
+ return;
30
+ }
31
+
32
+ update();
33
+
34
+ for (const name of events) {
35
+ window.addEventListener(name, onEvent, {
36
+ passive: true
37
+ });
38
+ }
39
+
40
+ onCleanup(() => {
41
+ cancelAnimationFrame(frame);
42
+ frame = 0;
43
+
44
+ for (const name of events) {
45
+ window.removeEventListener(name, onEvent);
46
+ }
47
+ });
48
+ });
49
+ });
50
+ }
@@ -0,0 +1,27 @@
1
+ import { onUnmounted, ref } from 'vue';
2
+
3
+ /** A flag that turns itself off `ms` milliseconds after `start()`; the timer dies with the component. */
4
+ export function useTransientFlag(ms = 2000) {
5
+ const active = ref(false);
6
+ let timer: ReturnType<typeof setTimeout> | undefined;
7
+
8
+ function stop() {
9
+ clearTimeout(timer);
10
+ active.value = false;
11
+ }
12
+
13
+ function start() {
14
+ active.value = true;
15
+
16
+ clearTimeout(timer);
17
+ timer = setTimeout(() => (active.value = false), ms);
18
+ }
19
+
20
+ onUnmounted(() => clearTimeout(timer));
21
+
22
+ return {
23
+ active,
24
+ start,
25
+ stop
26
+ };
27
+ }
@@ -46,11 +46,8 @@
46
46
  .vp-doc [class*="language-"] > button.copy {
47
47
  top: 0.4375rem;
48
48
  right: 0.625rem;
49
- width: 1.75rem;
50
- height: 1.75rem;
51
- border-radius: #{mg.ref("radius-sm")};
52
- background-color: transparent;
53
- background-size: 0.875rem;
49
+
50
+ @include mixins.copy-button;
54
51
 
55
52
  // Fully opaque at rest: dimmed, the grey icon falls under the 3:1 non-text contrast minimum.
56
53
  opacity: 1;
@@ -58,14 +55,15 @@
58
55
 
59
56
  .vp-doc [class*="language-"] > button.copy.copied,
60
57
  .vp-doc [class*="language-"] > button.copy:hover.copied {
61
- border-radius: 0 #{mg.ref("radius-sm")} #{mg.ref("radius-sm")} 0;
58
+ @include mixins.copy-button-copied;
62
59
  }
63
60
 
64
61
  .vp-doc [class*="language-"] > button.copy.copied::before,
65
62
  .vp-doc [class*="language-"] > button.copy:hover.copied::before {
66
63
  top: 0;
67
- height: 1.75rem;
68
- border-radius: #{mg.ref("radius-sm")} 0 0 #{mg.ref("radius-sm")};
64
+
65
+ @include mixins.copied-flag;
66
+
69
67
  background: #{mg.ref("color-surface")};
70
68
  font-family: #{mg.ref("font-mono")};
71
69
  font-size: #{mg.ref("size-label")};
@@ -303,11 +303,16 @@
303
303
  border-bottom: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
304
304
  }
305
305
 
306
+ // The stamp's own `<p class="VPLastUpdated">` sets its font and line height, so the rule has to
307
+ // target it rather than its wrapper; the `<time>` inherits. Both items share one line height
308
+ // so the row centres them on the same baseline.
309
+
306
310
  .VPDocFooter .edit-link-button,
307
- .VPDocFooter .last-updated {
311
+ .VPDocFooter .last-updated .VPLastUpdated {
308
312
  font-family: #{mg.ref("font-mono")};
309
313
  font-size: #{mg.ref("size-meta")};
310
314
  font-weight: 400;
315
+ line-height: #{mg.ref("leading-body")};
311
316
  color: #{mg.ref("color-ink-faint")};
312
317
  }
313
318
 
@@ -315,6 +320,12 @@
315
320
  color: #{mg.ref("color-accent")};
316
321
  }
317
322
 
323
+ // Vue condenses the whitespace between the label and the `<time>`, so the gap is drawn here.
324
+
325
+ .VPDocFooter .last-updated .VPLastUpdated time {
326
+ margin-inline-start: 1ch;
327
+ }
328
+
318
329
  .VPDocFooter .prev-next {
319
330
  margin-top: 0;
320
331
  padding-top: 0;
@@ -240,10 +240,9 @@
240
240
  color: #{mg.ref("color-accent")};
241
241
  }
242
242
 
243
- // Mirrors the copy button on code blocks (see _code.scss): same icon, size and border-radius
244
- // choreography, so the two don't read as two different controls. It stays fully opaque here
245
- // rather than fading in on hover — this one isn't tucked in the corner of a block, it's the
246
- // install line's only affordance.
243
+ // The copy button shares its size and radius with the one on code blocks (see the mixins). It
244
+ // stays fully opaque here rather than fading in on hover — this one isn't tucked in the corner
245
+ // of a block, it's the install line's only affordance.
247
246
 
248
247
  .ff-hero-copy-group {
249
248
  position: relative;
@@ -263,11 +262,12 @@
263
262
  z-index: 1;
264
263
  display: flex;
265
264
  align-items: center;
266
- height: 1.75rem;
267
265
  padding: 0 0.625rem;
268
266
  border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule-strong")};
269
267
  border-right: 0;
270
- border-radius: #{mg.ref("radius-sm")} 0 0 #{mg.ref("radius-sm")};
268
+
269
+ @include mixins.copied-flag;
270
+
271
271
  background: #{mg.ref("color-surface-alt")};
272
272
  color: #{mg.ref("color-ink-muted")};
273
273
  white-space: nowrap;
@@ -275,15 +275,13 @@
275
275
 
276
276
  .ff-hero-copy {
277
277
  flex-shrink: 0;
278
- width: 1.75rem;
279
- height: 1.75rem;
280
278
  border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
281
- border-radius: #{mg.ref("radius-sm")};
282
- background-color: transparent;
279
+
280
+ @include mixins.copy-button;
281
+
283
282
  background-image: var(--vp-icon-copy);
284
283
  background-position: 50%;
285
284
  background-repeat: no-repeat;
286
- background-size: 0.875rem;
287
285
  cursor: pointer;
288
286
  }
289
287
 
@@ -293,7 +291,8 @@
293
291
  }
294
292
 
295
293
  .ff-hero-copy.copied {
296
- border-radius: 0 #{mg.ref("radius-sm")} #{mg.ref("radius-sm")} 0;
294
+ @include mixins.copy-button-copied;
295
+
297
296
  border-color: #{mg.ref("color-rule-strong")};
298
297
  background-color: #{mg.ref("color-surface-alt")};
299
298
  background-image: var(--vp-icon-copied);
@@ -336,6 +335,15 @@
336
335
  border-top: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
337
336
  }
338
337
 
338
+ // Single column, the image or panel is the container's last cell and would end flush against
339
+ // the colophon rule: give it the same 3rem the container puts between its own cells.
340
+ @include bp.down("md") {
341
+ .ff-hero.has-image .ff-hero-meta,
342
+ .ff-hero.has-panel .ff-hero-meta {
343
+ margin-top: 3rem;
344
+ }
345
+ }
346
+
339
347
  .ff-hero-meta-item {
340
348
  padding-left: 1.5rem;
341
349
  border-left: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
@@ -53,6 +53,30 @@
53
53
  }
54
54
  }
55
55
 
56
+ // The square copy button of a code block and of the hero install line: same size, radius and icon
57
+ // size, so the two do not read as two different controls.
58
+
59
+ @mixin copy-button {
60
+ width: 1.75rem;
61
+ height: 1.75rem;
62
+ border-radius: #{mg.ref("radius-sm")};
63
+ background-color: transparent;
64
+ background-size: 0.875rem;
65
+ }
66
+
67
+ // Once copied, the button squares off its left edge to sit flush against the "Copied" flag.
68
+
69
+ @mixin copy-button-copied {
70
+ border-radius: 0 #{mg.ref("radius-sm")} #{mg.ref("radius-sm")} 0;
71
+ }
72
+
73
+ // The "Copied" flag, flush against the left of the button: same height, rounded on its far side.
74
+
75
+ @mixin copied-flag {
76
+ height: 1.75rem;
77
+ border-radius: #{mg.ref("radius-sm")} 0 0 #{mg.ref("radius-sm")};
78
+ }
79
+
56
80
  // The page title: the doc h1 and the blog title read as the same voice.
57
81
 
58
82
  @mixin page-title {
package/src/types.ts CHANGED
@@ -237,8 +237,9 @@ export interface ThemeOptions {
237
237
  */
238
238
  feedback?: boolean | FeedbackConfig
239
239
  /**
240
- * Menu in the page kicker with page actions. Off by default; `true` turns on every action. The
241
- * Markdown source is injected by `ffTransformPageData`, which a site defining its own
240
+ * Menu in the page kicker with page actions. By default only "Copy link" is on; `true` turns on
241
+ * every action and `false` turns the menu off.
242
+ * The Markdown source is injected by `ffTransformPageData`, which a site defining its own
242
243
  * `transformPageData` must call from it. Mastodon has no universal share intent, so its link
243
244
  * targets `mastodonInstance` (defaults to `mastodon.social`).
244
245
  */
@@ -1,10 +1,9 @@
1
- import type { BlogAuthor } from '../types';
1
+ import { resolveAuthor } from '../../node/blog.js';
2
+ export { resolveAuthor };
2
3
  /** Blog options, with the directory normalised (no slash at either end). */
3
4
  export declare function useBlog(): {
4
5
  dir: import("vue").ComputedRef<string>;
5
6
  isPost: import("vue").ComputedRef<boolean>;
6
- authors: import("vue").ComputedRef<Record<string, BlogAuthor>>;
7
+ authors: import("vue").ComputedRef<Record<string, import("../types.js").BlogAuthor>>;
7
8
  };
8
- /** `author` is a key of `ff.blog.authors`, or a plain name used as is. */
9
- export declare function resolveAuthor(authors: Record<string, BlogAuthor>, value?: string): BlogAuthor | null;
10
9
  export declare function formatDate(date: string, lang: string): string;
@@ -0,0 +1,6 @@
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Runs `update` once, then at most once per frame however many of the window `events` fire. Listens
4
+ * only while `enabled` is true and follows it if it changes; everything is undone on unmount.
5
+ */
6
+ export declare function useFrameListener(enabled: MaybeRefOrGetter<boolean>, update: () => void, events: string[]): void;
@@ -0,0 +1,6 @@
1
+ /** A flag that turns itself off `ms` milliseconds after `start()`; the timer dies with the component. */
2
+ export declare function useTransientFlag(ms?: number): {
3
+ active: import("vue").Ref<boolean, boolean>;
4
+ start: () => void;
5
+ stop: () => void;
6
+ };