@frontfactory/vitepress-theme 1.8.0 → 1.9.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 (45) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +20 -7
  3. package/config.d.ts +4 -3
  4. package/config.js +58 -37
  5. package/dist/style.css +1 -1
  6. package/node/blog.d.ts +3 -0
  7. package/node/blog.js +19 -0
  8. package/node/llms.js +4 -3
  9. package/node/og.js +5 -6
  10. package/node/pages.js +14 -6
  11. package/node/rss.js +6 -9
  12. package/package.json +1 -1
  13. package/src/blog/posts.data.ts +3 -2
  14. package/src/components/FfBackToTop.vue +1 -1
  15. package/src/components/FfCopyStatus.vue +1 -1
  16. package/src/components/FfDocMeta.vue +300 -17
  17. package/src/components/FfHero.vue +14 -33
  18. package/src/components/FfHeroActions.vue +44 -0
  19. package/src/components/FfHeroCommand.vue +3 -2
  20. package/src/components/FfPost.vue +4 -3
  21. package/src/composables/blog.ts +7 -4
  22. package/src/composables/copy.ts +36 -0
  23. package/src/composables/options.ts +9 -1
  24. package/src/composables/tabs.ts +2 -35
  25. package/src/content/Tabs.vue +27 -6
  26. package/src/internal.ts +1 -0
  27. package/src/layout/FfLayout.vue +3 -3
  28. package/src/styles/_base.scss +5 -9
  29. package/src/styles/_blocks.scss +4 -7
  30. package/src/styles/_blog.scss +4 -5
  31. package/src/styles/_code.scss +6 -12
  32. package/src/styles/_content.scss +153 -63
  33. package/src/styles/_doc.scss +14 -24
  34. package/src/styles/_home.scss +11 -49
  35. package/src/styles/_mixins.scss +63 -0
  36. package/src/styles/_motion.scss +12 -10
  37. package/src/styles/_nav.scss +12 -19
  38. package/src/styles/_sidebar.scss +5 -8
  39. package/src/styles/_tokens.scss +19 -4
  40. package/src/types.ts +30 -4
  41. package/types/components/FfHeroActions.vue.d.ts +19 -0
  42. package/types/composables/copy.d.ts +6 -0
  43. package/types/composables/tabs.d.ts +0 -5
  44. package/types/internal.d.ts +1 -0
  45. package/types/types.d.ts +28 -4
@@ -91,7 +91,6 @@
91
91
  }
92
92
  }
93
93
 
94
- .VPNavBar.has-sidebar .curtain,
95
94
  .VPNavBar .divider {
96
95
  display: none;
97
96
  }
@@ -152,15 +151,6 @@
152
151
 
153
152
  // Site name: display face, and a small accent square standing in for a logo when there is none.
154
153
 
155
- .VPNavBarTitle .title {
156
- border-bottom: 0;
157
- gap: 0.625rem;
158
- font-family: #{mg.ref("font-display")};
159
- font-size: 0.9375rem;
160
- font-weight: 620;
161
- letter-spacing: -0.01em;
162
- }
163
-
164
154
  .VPNavBarTitle .title:not(:has(.logo))::before {
165
155
  content: "";
166
156
  width: 0.5rem;
@@ -183,8 +173,14 @@
183
173
  align-items: center;
184
174
  min-width: 0;
185
175
  height: 100%;
176
+ border-bottom: 0;
177
+ gap: 0.625rem;
178
+ font-family: #{mg.ref("font-display")};
179
+ font-size: #{mg.ref("size-ui-lg")};
180
+ font-weight: 620;
181
+ letter-spacing: #{mg.ref("tracking-tight")};
186
182
  color: var(--vp-c-text-1);
187
- transition: opacity 0.25s;
183
+ transition: opacity #{mg.ref("motion-duration-fade")} #{mg.ref("motion-ease")};
188
184
  }
189
185
 
190
186
  // Wherever the bar runs out of room, the title text gives way first.
@@ -248,7 +244,7 @@
248
244
 
249
245
  .VPNavBarMenuLink,
250
246
  .VPNavBarMenuGroup .button {
251
- font-size: 0.875rem;
247
+ font-size: #{mg.ref("size-ui")};
252
248
  font-weight: 500;
253
249
  color: #{mg.ref("color-ink-muted")};
254
250
  transition: color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
@@ -265,7 +261,6 @@
265
261
 
266
262
  // Search trigger
267
263
 
268
- .VPNavBarSearch .DocSearch-Button,
269
264
  .VPNavBarSearchButton {
270
265
  display: flex;
271
266
  align-items: center;
@@ -275,9 +270,8 @@
275
270
  border: #{mg.ref("rule-width")} solid #{mg.ref("color-rule")};
276
271
  border-radius: #{mg.ref("radius-sm")};
277
272
  background: transparent;
278
- font-size: 0.8125rem;
273
+ font-size: #{mg.ref("size-small")};
279
274
  color: #{mg.ref("color-ink-faint")};
280
- transition: border-color #{mg.ref("motion-duration")} #{mg.ref("motion-ease")};
281
275
  }
282
276
 
283
277
  .VPNavBarSearchButton:hover {
@@ -285,8 +279,7 @@
285
279
  color: #{mg.ref("color-ink-muted")};
286
280
  }
287
281
 
288
- .VPNavBarSearchButton .keys kbd,
289
- .VPNavBarSearchButton .keys .key-cmd {
282
+ .VPNavBarSearchButton .keys kbd {
290
283
  border: 0;
291
284
  border-radius: 0;
292
285
  background: transparent;
@@ -305,13 +298,13 @@
305
298
  }
306
299
 
307
300
  .VPSwitch .check {
308
- border-radius: 2px;
301
+ border-radius: #{mg.ref("radius-xs")};
309
302
  background: #{mg.ref("color-surface-alt")};
310
303
  box-shadow: none;
311
304
  }
312
305
 
313
306
  .VPSwitch .icon {
314
- border-radius: 2px;
307
+ border-radius: #{mg.ref("radius-xs")};
315
308
  }
316
309
 
317
310
  // ----------------------------------------------------------------------------------------- //
@@ -23,11 +23,8 @@
23
23
 
24
24
  .VPSidebar .nav {
25
25
  padding-top: 1.5rem;
26
- }
27
-
28
- // Sections are numbered from the stylesheet: 01, 02, 03 — no config, no markup.
29
26
 
30
- .VPSidebar .nav {
27
+ // Sections are numbered from the stylesheet: 01, 02, 03 — no config, no markup.
31
28
  counter-reset: ff-section;
32
29
  }
33
30
 
@@ -62,7 +59,7 @@
62
59
  .VPSidebar .group > .VPSidebarItem.level-0 > .item::before {
63
60
  content: counter(ff-section, decimal-leading-zero);
64
61
  font-family: #{mg.ref("font-mono")};
65
- font-size: 0.8125rem;
62
+ font-size: #{mg.ref("size-small")};
66
63
  font-weight: 600;
67
64
  line-height: 1.4;
68
65
  letter-spacing: 0.02em;
@@ -72,7 +69,7 @@
72
69
  .VPSidebarItem.level-0 > .item > .text {
73
70
  padding: 0;
74
71
  font-family: #{mg.ref("font-mono")};
75
- font-size: 0.8125rem;
72
+ font-size: #{mg.ref("size-small")};
76
73
  font-weight: 600;
77
74
  line-height: 1.4;
78
75
  text-transform: uppercase;
@@ -88,7 +85,7 @@
88
85
  .VPSidebarItem.level-2 .text,
89
86
  .VPSidebarItem.level-3 .text {
90
87
  padding: 0.25rem 0;
91
- font-size: 0.875rem;
88
+ font-size: #{mg.ref("size-ui")};
92
89
  font-weight: 450;
93
90
  line-height: 1.6;
94
91
  color: #{mg.ref("color-ink-muted")};
@@ -125,7 +122,7 @@
125
122
  .VPSidebarItem.level-2 .text,
126
123
  .VPSidebarItem.level-3 .text {
127
124
  padding: 0.375rem 0;
128
- font-size: 0.8125rem;
125
+ font-size: #{mg.ref("size-small")};
129
126
  }
130
127
 
131
128
  .VPSidebarItem.is-active > .item > .indicator {
@@ -27,6 +27,10 @@ $scales: (
27
27
  ),
28
28
  "tracking": (
29
29
  "display": -0.025em,
30
+ "title": -0.03em,
31
+ "heading": -0.02em,
32
+ "subheading": -0.015em,
33
+ "tight": -0.01em,
30
34
  "label": 0.1em,
31
35
  "label-tight": 0.06em,
32
36
  "label-wide": 0.08em
@@ -34,6 +38,9 @@ $scales: (
34
38
  "size": (
35
39
  "label": 0.6875rem,
36
40
  "meta": 0.75rem,
41
+ "small": 0.8125rem,
42
+ "ui": 0.875rem,
43
+ "ui-lg": 0.9375rem,
37
44
  "body": 1rem,
38
45
  "lead": 1.125rem,
39
46
  "h1": clamp(1.625rem, 1.3rem + 1.3vw, 2rem),
@@ -46,8 +53,9 @@ $scales: (
46
53
  "tight": 1.15
47
54
  ),
48
55
  "radius": (
49
- "sm": 5px,
50
- "md": 10px
56
+ "xs": 0.125rem,
57
+ "sm": 0.3125rem,
58
+ "md": 0.625rem
51
59
  ),
52
60
  "rule": (
53
61
  "width": 1px,
@@ -56,12 +64,19 @@ $scales: (
56
64
  "motion": (
57
65
  "duration": 200ms,
58
66
  "duration-slow": 420ms,
67
+ "duration-fade": 250ms,
59
68
  "duration-enter": 650ms,
69
+ "duration-enter-panel": 800ms,
70
+ "duration-enter-image": 900ms,
71
+ "stagger": 20ms,
60
72
  "ease": cubic-bezier(0.2, 0.6, 0.2, 1)
61
73
  ),
62
74
  "banner": (
63
75
  "height": 2.6875rem
64
76
  ),
77
+ "z": (
78
+ "float": 20
79
+ ),
65
80
 
66
81
  /* The two washes of light behind the hero. Off by default: they are a house style, not a*/
67
82
  /* structural part of the layout, and they read as noise under a headline that is already*/
@@ -291,7 +306,7 @@ $presets: (
291
306
  --vp-button-alt-hover-text: #{mg.ref("color-ink")};
292
307
  --vp-button-alt-hover-bg: transparent;
293
308
  --vp-button-alt-active-bg: #{mg.ref("color-surface-alt")};
294
- --vp-custom-block-font-size: 0.9375rem;
295
- --vp-custom-block-code-font-size: 0.8125rem;
309
+ --vp-custom-block-font-size: #{mg.ref("size-ui-lg")};
310
+ --vp-custom-block-code-font-size: #{mg.ref("size-small")};
296
311
  --vp-home-hero-name-color: #{mg.ref("color-ink")};
297
312
  }
package/src/types.ts CHANGED
@@ -88,12 +88,28 @@ export interface ThemeLabels {
88
88
  feedbackThanks?: string
89
89
  /** Button copying the page as Markdown. Defaults to `Copy as Markdown`. */
90
90
  copyMarkdown?: string
91
+ /** Second line of the Markdown menu item. Defaults to `Page source`. */
92
+ copyMarkdownHint?: string
93
+ /** Accessible name of the chevron opening the page actions menu. Defaults to `More page actions`. */
94
+ pageActions?: string
95
+ /** Main button copying the page URL. Defaults to `Copy link`. */
96
+ copyLink?: string
97
+ /** Trigger of the menu when there is nothing to copy. Defaults to `Share`. */
98
+ share?: string
99
+ /** Confirmation shown once the page URL is copied. Defaults to `Link copied`. */
100
+ linkCopied?: string
101
+ /** Share menu item; `{0}` is the network name. Defaults to `Share on {0}`. */
102
+ shareOn?: string
91
103
  /** Accessible name of the version menu, followed by the current version. Defaults to `Version`. */
92
104
  versionSwitcher?: string
93
105
  /** Author line of a post; `{0}` is the name. Defaults to `By {0}`. */
94
106
  blogBy?: string
95
107
  /** Message of a blog index without any post. Defaults to `No posts yet`. */
96
108
  blogEmpty?: string
109
+ /** Tooltip of the back-to-top control, unless the default theme's `returnToTopLabel` is set. Defaults to `Return to top`. */
110
+ returnToTop?: string
111
+ /** Screen-reader announcement once a code block is copied. Defaults to `Copied`. */
112
+ codeCopied?: string
97
113
  }
98
114
 
99
115
  /** One author of the blog, declared in `ff.blog.authors` and referred to by key from a post. */
@@ -126,7 +142,7 @@ export interface BlogConfig {
126
142
  export interface OgFont {
127
143
  /** Family name, also used to draw the text. The first font of the list is the one used. */
128
144
  name: string
129
- /** TTF, OTF or WOFF file (not WOFF2), relative to the site's source directory. */
145
+ /** TTF, OTF or WOFF file (not WOFF2), relative to the VitePress root (the folder holding `.vitepress`). */
130
146
  path: string
131
147
  weight?: number
132
148
  style?: 'normal' | 'italic'
@@ -221,10 +237,20 @@ export interface ThemeOptions {
221
237
  */
222
238
  feedback?: boolean | FeedbackConfig
223
239
  /**
224
- * Button in the page kicker that copies the page's Markdown source. Off by default. The source
225
- * is injected by `ffTransformPageData`, which a site defining its own `transformPageData` must
226
- * call from it.
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
242
+ * `transformPageData` must call from it. Mastodon has no universal share intent, so its link
243
+ * targets `mastodonInstance` (defaults to `mastodon.social`).
227
244
  */
245
+ pageActions?:
246
+ | boolean
247
+ | {
248
+ copyMarkdown?: boolean
249
+ copyLink?: boolean
250
+ share?: Array<'x' | 'linkedin' | 'bluesky' | 'mastodon'>
251
+ mastodonInstance?: string
252
+ }
253
+ /** @deprecated Use `pageActions: { copyMarkdown: true }`. */
228
254
  copyMarkdown?: boolean
229
255
  /**
230
256
  * Writes `llms.txt` and `llms-full.txt` to the output directory at the end of the build. Off by
@@ -0,0 +1,19 @@
1
+ import type { HeroAction } from './FfHero.vue';
2
+ type __VLS_Props = {
3
+ actions: HeroAction[];
4
+ };
5
+ declare const __VLS_template: () => {
6
+ __VLS_Slots: {
7
+ before?: (props: {}) => any;
8
+ };
9
+ };
10
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,6 @@
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ /** Copies a string to the clipboard and flags it as copied for two seconds. */
3
+ export declare function useCopy(text: MaybeRefOrGetter<string>): {
4
+ copied: import("vue").Ref<boolean, boolean>;
5
+ copy: () => Promise<void>;
6
+ };
@@ -8,8 +8,3 @@ export declare function useTabs(labels: MaybeRefOrGetter<string[]>, syncKey?: Ma
8
8
  select: (index: number) => void;
9
9
  onKeydown: (event: KeyboardEvent) => void;
10
10
  };
11
- /** Copies a string to the clipboard and flags it as copied for two seconds. */
12
- export declare function useCopy(text: MaybeRefOrGetter<string>): {
13
- copied: import("vue").Ref<boolean, boolean>;
14
- copy: () => Promise<void>;
15
- };
@@ -7,3 +7,4 @@ export { default as VPSponsors } from 'vitepress/dist/client/theme-default/compo
7
7
  export { useLangs } from 'vitepress/dist/client/theme-default/composables/langs.js';
8
8
  export { useLayout } from 'vitepress/dist/client/theme-default/composables/layout.js';
9
9
  export { normalizeLink } from 'vitepress/dist/client/theme-default/support/utils.js';
10
+ export { isExternal } from 'vitepress/dist/client/shared.js';
package/types/types.d.ts CHANGED
@@ -83,12 +83,28 @@ export interface ThemeLabels {
83
83
  feedbackThanks?: string;
84
84
  /** Button copying the page as Markdown. Defaults to `Copy as Markdown`. */
85
85
  copyMarkdown?: string;
86
+ /** Second line of the Markdown menu item. Defaults to `Page source`. */
87
+ copyMarkdownHint?: string;
88
+ /** Accessible name of the chevron opening the page actions menu. Defaults to `More page actions`. */
89
+ pageActions?: string;
90
+ /** Main button copying the page URL. Defaults to `Copy link`. */
91
+ copyLink?: string;
92
+ /** Trigger of the menu when there is nothing to copy. Defaults to `Share`. */
93
+ share?: string;
94
+ /** Confirmation shown once the page URL is copied. Defaults to `Link copied`. */
95
+ linkCopied?: string;
96
+ /** Share menu item; `{0}` is the network name. Defaults to `Share on {0}`. */
97
+ shareOn?: string;
86
98
  /** Accessible name of the version menu, followed by the current version. Defaults to `Version`. */
87
99
  versionSwitcher?: string;
88
100
  /** Author line of a post; `{0}` is the name. Defaults to `By {0}`. */
89
101
  blogBy?: string;
90
102
  /** Message of a blog index without any post. Defaults to `No posts yet`. */
91
103
  blogEmpty?: string;
104
+ /** Tooltip of the back-to-top control, unless the default theme's `returnToTopLabel` is set. Defaults to `Return to top`. */
105
+ returnToTop?: string;
106
+ /** Screen-reader announcement once a code block is copied. Defaults to `Copied`. */
107
+ codeCopied?: string;
92
108
  }
93
109
  /** One author of the blog, declared in `ff.blog.authors` and referred to by key from a post. */
94
110
  export interface BlogAuthor {
@@ -117,7 +133,7 @@ export interface BlogConfig {
117
133
  export interface OgFont {
118
134
  /** Family name, also used to draw the text. The first font of the list is the one used. */
119
135
  name: string;
120
- /** TTF, OTF or WOFF file (not WOFF2), relative to the site's source directory. */
136
+ /** TTF, OTF or WOFF file (not WOFF2), relative to the VitePress root (the folder holding `.vitepress`). */
121
137
  path: string;
122
138
  weight?: number;
123
139
  style?: 'normal' | 'italic';
@@ -205,10 +221,18 @@ export interface ThemeOptions {
205
221
  */
206
222
  feedback?: boolean | FeedbackConfig;
207
223
  /**
208
- * Button in the page kicker that copies the page's Markdown source. Off by default. The source
209
- * is injected by `ffTransformPageData`, which a site defining its own `transformPageData` must
210
- * call from it.
224
+ * Menu in the page kicker with page actions. Off by default; `true` turns on every action. The
225
+ * Markdown source is injected by `ffTransformPageData`, which a site defining its own
226
+ * `transformPageData` must call from it. Mastodon has no universal share intent, so its link
227
+ * targets `mastodonInstance` (defaults to `mastodon.social`).
211
228
  */
229
+ pageActions?: boolean | {
230
+ copyMarkdown?: boolean;
231
+ copyLink?: boolean;
232
+ share?: Array<'x' | 'linkedin' | 'bluesky' | 'mastodon'>;
233
+ mastodonInstance?: string;
234
+ };
235
+ /** @deprecated Use `pageActions: { copyMarkdown: true }`. */
212
236
  copyMarkdown?: boolean;
213
237
  /**
214
238
  * Writes `llms.txt` and `llms-full.txt` to the output directory at the end of the build. Off by