vitepress 0.21.4 → 0.21.5

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,5 +1,6 @@
1
1
  import { reactive, inject, markRaw, nextTick, readonly } from 'vue';
2
2
  import { inBrowser } from './utils';
3
+ import { siteDataRef } from './data';
3
4
  export const RouterSymbol = Symbol();
4
5
  // we are just using URL to parse the pathname and hash - the base doesn't
5
6
  // matter and is only passed to support same-host hrefs.
@@ -148,7 +149,16 @@ function scrollTo(el, hash, smooth = false) {
148
149
  console.warn(e);
149
150
  }
150
151
  if (target) {
151
- const targetTop = target.offsetTop;
152
+ let offset = siteDataRef.value.scrollOffset;
153
+ if (typeof offset === 'string') {
154
+ offset =
155
+ document.querySelector(offset).getBoundingClientRect().bottom + 24;
156
+ }
157
+ const targetPadding = parseInt(window.getComputedStyle(target).paddingTop, 10);
158
+ const targetTop = window.scrollY +
159
+ target.getBoundingClientRect().top -
160
+ offset +
161
+ targetPadding;
152
162
  // only smooth scroll if distance is smaller than screen height.
153
163
  if (!smooth || Math.abs(targetTop - window.scrollY) > window.innerHeight) {
154
164
  window.scrollTo(0, targetTop);
@@ -6,6 +6,7 @@ import { ComponentOptions } from 'vue';
6
6
  import { ComponentOptionsMixin } from 'vue';
7
7
  import { DefineComponent } from 'vue';
8
8
  import { EmitsOptions } from 'vue';
9
+ import { ExtractPropTypes } from 'vue';
9
10
  import { Ref } from 'vue';
10
11
  import { RendererElement } from 'vue';
11
12
  import { RendererNode } from 'vue';
@@ -14,7 +15,7 @@ import { VNodeProps } from 'vue';
14
15
 
15
16
  export declare const Content: DefineComponent< {}, () => VNode<RendererNode, RendererElement, {
16
17
  [key: string]: any;
17
- }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{} & {} & {}>, {}>;
18
+ }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes< {}>>, {}>;
18
19
 
19
20
  export declare const Debug: ComponentOptions<{}, any, any, any, any, any, any, any>;
20
21
 
@@ -76,6 +77,7 @@ export declare interface SiteData<ThemeConfig = any> {
76
77
  description: string
77
78
  head: HeadConfig[]
78
79
  themeConfig: ThemeConfig
80
+ scrollOffset: number | string
79
81
  locales: Record<string, LocaleConfig>
80
82
  /**
81
83
  * Available locales for the site when it has defined `locales` in its
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var serve = require('./serve-9731a371.js');
3
+ var serve = require('./serve-322f3382.js');
4
4
  require('fs');
5
5
  require('path');
6
6
  require('url');
@@ -256,6 +256,7 @@ export declare interface SiteData<ThemeConfig = any> {
256
256
  description: string
257
257
  head: HeadConfig[]
258
258
  themeConfig: ThemeConfig
259
+ scrollOffset: number | string
259
260
  locales: Record<string, LocaleConfig>
260
261
  /**
261
262
  * Available locales for the site when it has defined `locales` in its
@@ -301,6 +302,11 @@ export declare interface UserConfig<ThemeConfig = any> {
301
302
  srcExclude?: string[];
302
303
  outDir?: string;
303
304
  shouldPreload?: (link: string, page: string) => boolean;
305
+ /**
306
+ * Configure the scroll offset when the theme has a sticky header.
307
+ * Can be a number or a selector element to get the offset from.
308
+ */
309
+ scrollOffset?: number | string;
304
310
  /**
305
311
  * Enable MPA / zero-JS mode
306
312
  * @experimental
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var serve = require('./serve-9731a371.js');
5
+ var serve = require('./serve-322f3382.js');
6
6
  require('vite');
7
7
  require('readline');
8
8
  require('assert');
@@ -13455,7 +13455,8 @@ async function resolveSiteData(root, userConfig, command = "serve", mode = "deve
13455
13455
  head: userConfig.head || [],
13456
13456
  themeConfig: userConfig.themeConfig || {},
13457
13457
  locales: userConfig.locales || {},
13458
- langs: createLangDictionary(userConfig)
13458
+ langs: createLangDictionary(userConfig),
13459
+ scrollOffset: userConfig.scrollOffset || 90
13459
13460
  };
13460
13461
  }
13461
13462
 
@@ -24508,7 +24509,7 @@ Renderer$1.prototype.renderToken = function renderToken(tokens, idx, options) {
24508
24509
 
24509
24510
  /**
24510
24511
  * Renderer.renderInline(tokens, options, env) -> String
24511
- * - tokens (Array): list on block tokens to renter
24512
+ * - tokens (Array): list on block tokens to render
24512
24513
  * - options (Object): params of parser instance
24513
24514
  * - env (Object): additional data from parsed input (references, for example)
24514
24515
  *
@@ -24535,7 +24536,7 @@ Renderer$1.prototype.renderInline = function (tokens, options, env) {
24535
24536
 
24536
24537
  /** internal
24537
24538
  * Renderer.renderInlineAsText(tokens, options, env) -> String
24538
- * - tokens (Array): list on block tokens to renter
24539
+ * - tokens (Array): list on block tokens to render
24539
24540
  * - options (Object): params of parser instance
24540
24541
  * - env (Object): additional data from parsed input (references, for example)
24541
24542
  *
@@ -24562,7 +24563,7 @@ Renderer$1.prototype.renderInlineAsText = function (tokens, options, env) {
24562
24563
 
24563
24564
  /**
24564
24565
  * Renderer.render(tokens, options, env) -> String
24565
- * - tokens (Array): list on block tokens to renter
24566
+ * - tokens (Array): list on block tokens to render
24566
24567
  * - options (Object): params of parser instance
24567
24568
  * - env (Object): additional data from parsed input (references, for example)
24568
24569
  *
@@ -26492,7 +26493,7 @@ var list$1 = function list(state, startLine, endLine, silent) {
26492
26493
  // This code can fail if plugins use blkIndent as well as lists,
26493
26494
  // but I hope the spec gets fixed long before that happens.
26494
26495
  //
26495
- if (state.tShift[startLine] >= state.blkIndent) {
26496
+ if (state.sCount[startLine] >= state.blkIndent) {
26496
26497
  isTerminatingParagraph = true;
26497
26498
  }
26498
26499
  }
@@ -27644,7 +27645,7 @@ var isSpace$3 = utils$3.isSpace;
27644
27645
 
27645
27646
 
27646
27647
  var newline = function newline(state, silent) {
27647
- var pmax, max, pos = state.pos;
27648
+ var pmax, max, ws, pos = state.pos;
27648
27649
 
27649
27650
  if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
27650
27651
 
@@ -27658,7 +27659,11 @@ var newline = function newline(state, silent) {
27658
27659
  if (!silent) {
27659
27660
  if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
27660
27661
  if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
27661
- state.pending = state.pending.replace(/ +$/, '');
27662
+ // Find whitespaces tail of pending chars.
27663
+ ws = pmax - 1;
27664
+ while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 0x20) ws--;
27665
+
27666
+ state.pending = state.pending.slice(0, ws);
27662
27667
  state.push('hardbreak', 'br', 0);
27663
27668
  } else {
27664
27669
  state.pending = state.pending.slice(0, -1);
@@ -27819,7 +27824,6 @@ strikethrough.tokenize = function strikethrough(state, silent) {
27819
27824
  state.delimiters.push({
27820
27825
  marker: marker,
27821
27826
  length: 0, // disable "rule of 3" length checks meant for emphasis
27822
- jump: i / 2, // for `~~` 1 marker = 2 characters
27823
27827
  token: state.tokens.length - 1,
27824
27828
  end: -1,
27825
27829
  open: scanned.can_open,
@@ -27944,15 +27948,6 @@ emphasis.tokenize = function emphasis(state, silent) {
27944
27948
  //
27945
27949
  length: scanned.length,
27946
27950
 
27947
- // An amount of characters before this one that's equivalent to
27948
- // current one. In plain English: if this delimiter does not open
27949
- // an emphasis, neither do previous `jump` characters.
27950
- //
27951
- // Used to skip sequences like "*****" in one step, for 1st asterisk
27952
- // value will be 0, for 2nd it's 1 and so on.
27953
- //
27954
- jump: i,
27955
-
27956
27951
  // A position of the token this delimiter corresponds to.
27957
27952
  //
27958
27953
  token: state.tokens.length - 1,
@@ -28006,9 +28001,11 @@ function postProcess(state, delimiters) {
28006
28001
  //
28007
28002
  isStrong = i > 0 &&
28008
28003
  delimiters[i - 1].end === startDelim.end + 1 &&
28004
+ // check that first two markers match and adjacent
28005
+ delimiters[i - 1].marker === startDelim.marker &&
28009
28006
  delimiters[i - 1].token === startDelim.token - 1 &&
28010
- delimiters[startDelim.end + 1].token === endDelim.token + 1 &&
28011
- delimiters[i - 1].marker === startDelim.marker;
28007
+ // check that last two markers are adjacent (we can safely assume they match)
28008
+ delimiters[startDelim.end + 1].token === endDelim.token + 1;
28012
28009
 
28013
28010
  ch = String.fromCharCode(startDelim.marker);
28014
28011
 
@@ -28511,9 +28508,28 @@ function processDelimiters(state, delimiters) {
28511
28508
  openersBottom = {},
28512
28509
  max = delimiters.length;
28513
28510
 
28511
+ if (!max) return;
28512
+
28513
+ // headerIdx is the first delimiter of the current (where closer is) delimiter run
28514
+ var headerIdx = 0;
28515
+ var lastTokenIdx = -2; // needs any value lower than -1
28516
+ var jumps = [];
28517
+
28514
28518
  for (closerIdx = 0; closerIdx < max; closerIdx++) {
28515
28519
  closer = delimiters[closerIdx];
28516
28520
 
28521
+ jumps.push(0);
28522
+
28523
+ // markers belong to same delimiter run if:
28524
+ // - they have adjacent tokens
28525
+ // - AND markers are the same
28526
+ //
28527
+ if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) {
28528
+ headerIdx = closerIdx;
28529
+ }
28530
+
28531
+ lastTokenIdx = closer.token;
28532
+
28517
28533
  // Length is only used for emphasis-specific "rule of 3",
28518
28534
  // if it's not defined (in strikethrough or 3rd party plugins),
28519
28535
  // we can default it to 0 to disable those checks.
@@ -28532,14 +28548,11 @@ function processDelimiters(state, delimiters) {
28532
28548
 
28533
28549
  minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length % 3)];
28534
28550
 
28535
- openerIdx = closerIdx - closer.jump - 1;
28536
-
28537
- // avoid crash if `closer.jump` is pointing outside of the array, see #742
28538
- if (openerIdx < -1) openerIdx = -1;
28551
+ openerIdx = headerIdx - jumps[headerIdx] - 1;
28539
28552
 
28540
28553
  newMinOpenerIdx = openerIdx;
28541
28554
 
28542
- for (; openerIdx > minOpenerIdx; openerIdx -= opener.jump + 1) {
28555
+ for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {
28543
28556
  opener = delimiters[openerIdx];
28544
28557
 
28545
28558
  if (opener.marker !== closer.marker) continue;
@@ -28569,15 +28582,19 @@ function processDelimiters(state, delimiters) {
28569
28582
  // sure algorithm has linear complexity (see *_*_*_*_*_... case).
28570
28583
  //
28571
28584
  lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ?
28572
- delimiters[openerIdx - 1].jump + 1 :
28585
+ jumps[openerIdx - 1] + 1 :
28573
28586
  0;
28574
28587
 
28575
- closer.jump = closerIdx - openerIdx + lastJump;
28588
+ jumps[closerIdx] = closerIdx - openerIdx + lastJump;
28589
+ jumps[openerIdx] = lastJump;
28590
+
28576
28591
  closer.open = false;
28577
28592
  opener.end = closerIdx;
28578
- opener.jump = lastJump;
28579
28593
  opener.close = false;
28580
28594
  newMinOpenerIdx = -1;
28595
+ // treat next token as start of run,
28596
+ // it optimizes skips in **<...>**a**<...>** pathological case
28597
+ lastTokenIdx = -2;
28581
28598
  break;
28582
28599
  }
28583
28600
  }
@@ -35151,7 +35168,7 @@ const headingPlugin = (md, include = ["h2", "h3"]) => {
35151
35168
  };
35152
35169
  };
35153
35170
 
35154
- var e=!1,n={false:"push",true:"unshift",after:"push",before:"unshift"},t={isPermalinkSymbol:!0};function r(r,a,i,l){var o;if(!e){var c="Using deprecated markdown-it-anchor permalink option, see https://github.com/valeriangalliat/markdown-it-anchor#todo-anchor-or-file";"object"==typeof process&&process&&process.emitWarning?process.emitWarning(c):console.warn(c),e=!0;}var s=[Object.assign(new i.Token("link_open","a",1),{attrs:[].concat(a.permalinkClass?[["class",a.permalinkClass]]:[],[["href",a.permalinkHref(r,i)]],Object.entries(a.permalinkAttrs(r,i)))}),Object.assign(new i.Token("html_block","",0),{content:a.permalinkSymbol,meta:t}),new i.Token("link_close","a",-1)];a.permalinkSpace&&i.tokens[l+1].children[n[a.permalinkBefore]](Object.assign(new i.Token("text","",0),{content:" "})),(o=i.tokens[l+1].children)[n[a.permalinkBefore]].apply(o,s);}function a(e){return "#"+e}function i(e){return {}}var l={class:"header-anchor",symbol:"#",renderHref:a,renderAttrs:i};function o(e){function n(t){return t=Object.assign({},n.defaults,t),function(n,r,a,i){return e(n,t,r,a,i)}}return n.defaults=Object.assign({},l),n.renderPermalinkImpl=e,n}var c=o(function(e,r,a,i,l){var o,c=[Object.assign(new i.Token("link_open","a",1),{attrs:[].concat(r.class?[["class",r.class]]:[],[["href",r.renderHref(e,i)]],r.ariaHidden?[["aria-hidden","true"]]:[],Object.entries(r.renderAttrs(e,i)))}),Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t}),new i.Token("link_close","a",-1)];r.space&&i.tokens[l+1].children[n[r.placement]](Object.assign(new i.Token("text","",0),{content:" "})),(o=i.tokens[l+1].children)[n[r.placement]].apply(o,c);});Object.assign(c.defaults,{space:!0,placement:"after",ariaHidden:!1});var s$1=o(c.renderPermalinkImpl);s$1.defaults=Object.assign({},c.defaults,{ariaHidden:!0});var d$1=o(function(e,n,t,r,a){var i=[Object.assign(new r.Token("link_open","a",1),{attrs:[].concat(n.class?[["class",n.class]]:[],[["href",n.renderHref(e,r)]],Object.entries(n.renderAttrs(e,r)))})].concat(r.tokens[a+1].children,[new r.Token("link_close","a",-1)]);r.tokens[a+1]=Object.assign(new r.Token("inline","",0),{children:i});}),u=o(function(e,r,a,i,l){var o;if(!["visually-hidden","aria-label","aria-describedby","aria-labelledby"].includes(r.style))throw new Error("`permalink.linkAfterHeader` called with unknown style option `"+r.style+"`");if(!["aria-describedby","aria-labelledby"].includes(r.style)&&!r.assistiveText)throw new Error("`permalink.linkAfterHeader` called without the `assistiveText` option in `"+r.style+"` style");if("visually-hidden"===r.style&&!r.visuallyHiddenClass)throw new Error("`permalink.linkAfterHeader` called without the `visuallyHiddenClass` option in `visually-hidden` style");var c=i.tokens[l+1].children.filter(function(e){return "text"===e.type||"code_inline"===e.type}).reduce(function(e,n){return e+n.content},""),s=[],d=[];r.class&&d.push(["class",r.class]),d.push(["href",r.renderHref(e,i)]),d.push.apply(d,Object.entries(r.renderAttrs(e,i))),"visually-hidden"===r.style?(s.push(Object.assign(new i.Token("span_open","span",1),{attrs:[["class",r.visuallyHiddenClass]]}),Object.assign(new i.Token("text","",0),{content:r.assistiveText(c)}),new i.Token("span_close","span",-1)),r.space&&s[n[r.placement]](Object.assign(new i.Token("text","",0),{content:" "})),s[n[r.placement]](Object.assign(new i.Token("span_open","span",1),{attrs:[["aria-hidden","true"]]}),Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t}),new i.Token("span_close","span",-1))):s.push(Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t})),"aria-label"===r.style?d.push(["aria-label",r.assistiveText(c)]):["aria-describedby","aria-labelledby"].includes(r.style)&&d.push([r.style,e]);var u=[Object.assign(new i.Token("link_open","a",1),{attrs:d})].concat(s,[new i.Token("link_close","a",-1)]);(o=i.tokens).splice.apply(o,[l+3,0].concat(u));});function f(e,n,t,r){var a=e,i=r;if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new Error("User defined `id` attribute `"+e+"` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(n,a);)a=e+"-"+i,i+=1;return n[a]=!0,a}function b(e,n){n=Object.assign({},b.defaults,n),e.core.ruler.push("anchor",function(e){for(var t,a={},i=e.tokens,l=Array.isArray(n.level)?(t=n.level,function(e){return t.includes(e)}):function(e){return function(n){return n>=e}}(n.level),o=0;o<i.length;o++){var c=i[o];if("heading_open"===c.type&&l(Number(c.tag.substr(1)))){var s=i[o+1].children.filter(function(e){return "text"===e.type||"code_inline"===e.type}).reduce(function(e,n){return e+n.content},""),d=c.attrGet("id");d=null==d?f(n.slugify(s),a,!1,n.uniqueSlugStartIndex):f(d,a,!0,n.uniqueSlugStartIndex),c.attrSet("id",d),!1!==n.tabIndex&&c.attrSet("tabindex",""+n.tabIndex),"function"==typeof n.permalink?n.permalink(d,n,e,o):(n.permalink||n.renderPermalink&&n.renderPermalink!==r)&&n.renderPermalink(d,n,e,o),o=i.indexOf(c),n.callback&&n.callback(c,{slug:d,title:s});}}});}Object.assign(u.defaults,{style:"visually-hidden",space:!0,placement:"after"}),b.permalink={__proto__:null,legacy:r,renderHref:a,renderAttrs:i,makePermalink:o,linkInsideHeader:c,ariaHidden:s$1,headerLink:d$1,linkAfterHeader:u},b.defaults={level:1,slugify:function(e){return encodeURIComponent(String(e).trim().toLowerCase().replace(/\s+/g,"-"))},uniqueSlugStartIndex:1,tabIndex:"-1",permalink:!1,renderPermalink:r,permalinkClass:s$1.defaults.class,permalinkSpace:s$1.defaults.space,permalinkSymbol:"¶",permalinkBefore:"before"===s$1.defaults.placement,permalinkHref:s$1.defaults.renderHref,permalinkAttrs:s$1.defaults.renderAttrs},b.default=b;
35171
+ var e=!1,n={false:"push",true:"unshift",after:"push",before:"unshift"},t={isPermalinkSymbol:!0};function r(r,a,i,l){var o;if(!e){var c="Using deprecated markdown-it-anchor permalink option, see https://github.com/valeriangalliat/markdown-it-anchor#todo-anchor-or-file";"object"==typeof process&&process&&process.emitWarning?process.emitWarning(c):console.warn(c),e=!0;}var s=[Object.assign(new i.Token("link_open","a",1),{attrs:[].concat(a.permalinkClass?[["class",a.permalinkClass]]:[],[["href",a.permalinkHref(r,i)]],Object.entries(a.permalinkAttrs(r,i)))}),Object.assign(new i.Token("html_block","",0),{content:a.permalinkSymbol,meta:t}),new i.Token("link_close","a",-1)];a.permalinkSpace&&i.tokens[l+1].children[n[a.permalinkBefore]](Object.assign(new i.Token("text","",0),{content:" "})),(o=i.tokens[l+1].children)[n[a.permalinkBefore]].apply(o,s);}function a(e){return "#"+e}function i(e){return {}}var l={class:"header-anchor",symbol:"#",renderHref:a,renderAttrs:i};function o(e){function n(t){return t=Object.assign({},n.defaults,t),function(n,r,a,i){return e(n,t,r,a,i)}}return n.defaults=Object.assign({},l),n.renderPermalinkImpl=e,n}var c=o(function(e,r,a,i,l){var o,c=[Object.assign(new i.Token("link_open","a",1),{attrs:[].concat(r.class?[["class",r.class]]:[],[["href",r.renderHref(e,i)]],r.ariaHidden?[["aria-hidden","true"]]:[],Object.entries(r.renderAttrs(e,i)))}),Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t}),new i.Token("link_close","a",-1)];r.space&&i.tokens[l+1].children[n[r.placement]](Object.assign(new i.Token("text","",0),{content:" "})),(o=i.tokens[l+1].children)[n[r.placement]].apply(o,c);});Object.assign(c.defaults,{space:!0,placement:"after",ariaHidden:!1});var s$1=o(c.renderPermalinkImpl);s$1.defaults=Object.assign({},c.defaults,{ariaHidden:!0});var d$1=o(function(e,n,t,r,a){var i=[Object.assign(new r.Token("link_open","a",1),{attrs:[].concat(n.class?[["class",n.class]]:[],[["href",n.renderHref(e,r)]],Object.entries(n.renderAttrs(e,r)))})].concat(n.safariReaderFix?[new r.Token("span_open","span",1)]:[],r.tokens[a+1].children,n.safariReaderFix?[new r.Token("span_close","span",-1)]:[],[new r.Token("link_close","a",-1)]);r.tokens[a+1]=Object.assign(new r.Token("inline","",0),{children:i});});Object.assign(d$1.defaults,{safariReaderFix:!1});var u=o(function(e,r,a,i,l){var o;if(!["visually-hidden","aria-label","aria-describedby","aria-labelledby"].includes(r.style))throw new Error("`permalink.linkAfterHeader` called with unknown style option `"+r.style+"`");if(!["aria-describedby","aria-labelledby"].includes(r.style)&&!r.assistiveText)throw new Error("`permalink.linkAfterHeader` called without the `assistiveText` option in `"+r.style+"` style");if("visually-hidden"===r.style&&!r.visuallyHiddenClass)throw new Error("`permalink.linkAfterHeader` called without the `visuallyHiddenClass` option in `visually-hidden` style");var c=i.tokens[l+1].children.filter(function(e){return "text"===e.type||"code_inline"===e.type}).reduce(function(e,n){return e+n.content},""),s=[],d=[];r.class&&d.push(["class",r.class]),d.push(["href",r.renderHref(e,i)]),d.push.apply(d,Object.entries(r.renderAttrs(e,i))),"visually-hidden"===r.style?(s.push(Object.assign(new i.Token("span_open","span",1),{attrs:[["class",r.visuallyHiddenClass]]}),Object.assign(new i.Token("text","",0),{content:r.assistiveText(c)}),new i.Token("span_close","span",-1)),r.space&&s[n[r.placement]](Object.assign(new i.Token("text","",0),{content:" "})),s[n[r.placement]](Object.assign(new i.Token("span_open","span",1),{attrs:[["aria-hidden","true"]]}),Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t}),new i.Token("span_close","span",-1))):s.push(Object.assign(new i.Token("html_inline","",0),{content:r.symbol,meta:t})),"aria-label"===r.style?d.push(["aria-label",r.assistiveText(c)]):["aria-describedby","aria-labelledby"].includes(r.style)&&d.push([r.style,e]);var u=[Object.assign(new i.Token("link_open","a",1),{attrs:d})].concat(s,[new i.Token("link_close","a",-1)]);(o=i.tokens).splice.apply(o,[l+3,0].concat(u));});function f(e,n,t,r){var a=e,i=r;if(t&&Object.prototype.hasOwnProperty.call(n,a))throw new Error("User defined `id` attribute `"+e+"` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(n,a);)a=e+"-"+i,i+=1;return n[a]=!0,a}function b(e,n){n=Object.assign({},b.defaults,n),e.core.ruler.push("anchor",function(e){for(var t,a={},i=e.tokens,l=Array.isArray(n.level)?(t=n.level,function(e){return t.includes(e)}):function(e){return function(n){return n>=e}}(n.level),o=0;o<i.length;o++){var c=i[o];if("heading_open"===c.type&&l(Number(c.tag.substr(1)))){var s=i[o+1].children.filter(function(e){return "text"===e.type||"code_inline"===e.type}).reduce(function(e,n){return e+n.content},""),d=c.attrGet("id");d=null==d?f(n.slugify(s),a,!1,n.uniqueSlugStartIndex):f(d,a,!0,n.uniqueSlugStartIndex),c.attrSet("id",d),!1!==n.tabIndex&&c.attrSet("tabindex",""+n.tabIndex),"function"==typeof n.permalink?n.permalink(d,n,e,o):(n.permalink||n.renderPermalink&&n.renderPermalink!==r)&&n.renderPermalink(d,n,e,o),o=i.indexOf(c),n.callback&&n.callback(c,{slug:d,title:s});}}});}Object.assign(u.defaults,{style:"visually-hidden",space:!0,placement:"after"}),b.permalink={__proto__:null,legacy:r,renderHref:a,renderAttrs:i,makePermalink:o,linkInsideHeader:c,ariaHidden:s$1,headerLink:d$1,linkAfterHeader:u},b.defaults={level:1,slugify:function(e){return encodeURIComponent(String(e).trim().toLowerCase().replace(/\s+/g,"-"))},uniqueSlugStartIndex:1,tabIndex:"-1",permalink:!1,renderPermalink:r,permalinkClass:s$1.defaults.class,permalinkSpace:s$1.defaults.space,permalinkSymbol:"¶",permalinkBefore:"before"===s$1.defaults.placement,permalinkHref:s$1.defaults.renderHref,permalinkAttrs:s$1.defaults.renderAttrs},b.default=b;
35155
35172
 
35156
35173
  var utils$1 = {};
35157
35174
 
@@ -35727,7 +35744,8 @@ var patterns = options => {
35727
35744
  token.nesting = 0;
35728
35745
  let content = tokens[i + 1].content;
35729
35746
  let start = content.lastIndexOf(options.leftDelimiter);
35730
- token.attrs = utils.getAttrs(content, start, options);
35747
+ let attrs = utils.getAttrs(content, start, options);
35748
+ utils.addAttrs(attrs, token);
35731
35749
  token.markup = content;
35732
35750
  tokens.splice(i + 1, 2);
35733
35751
  }
@@ -35744,7 +35762,7 @@ var patterns = options => {
35744
35762
  {
35745
35763
  position: -1,
35746
35764
  content: utils.hasDelimiters('end', options),
35747
- type: (t) => t !== 'code_inline'
35765
+ type: (t) => t !== 'code_inline' && t !== 'math_inline'
35748
35766
  }
35749
35767
  ]
35750
35768
  }
@@ -35827,6 +35845,12 @@ function test(tokens, i, t) {
35827
35845
  let ii = t.shift !== undefined
35828
35846
  ? i + t.shift
35829
35847
  : t.position;
35848
+
35849
+ if (t.shift !== undefined && ii < 0) {
35850
+ // we should never shift to negative indexes (rolling around to back of array)
35851
+ return res;
35852
+ }
35853
+
35830
35854
  let token = get(tokens, ii); // supports negative ii
35831
35855
 
35832
35856
 
@@ -36129,16 +36153,25 @@ var markdownItEmoji = function emoji_plugin(md, options) {
36129
36153
  bare_emoji_plugin(md, opts);
36130
36154
  };
36131
36155
 
36132
- var slugify = function(s){
36133
- return encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, '-'))
36156
+ /*
36157
+ * markdown-it-table-of-contents
36158
+ *
36159
+ * The algorithm works as follows:
36160
+ * Step 1: Gather all headline tokens from a Markdown document and put them in an array.
36161
+ * Step 2: Turn the flat array into a nested tree, respecting the correct headline level.
36162
+ * Step 3: Turn the nested tree into HTML code.
36163
+ */
36164
+
36165
+ const slugify = function (s) {
36166
+ return encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, '-'));
36134
36167
  };
36135
- var defaults$2 = {
36136
- includeLevel: [ 1, 2 ],
36168
+ const defaults$2 = {
36169
+ includeLevel: [1, 2],
36137
36170
  containerClass: 'table-of-contents',
36138
36171
  slugify: slugify,
36139
36172
  markerPattern: /^\[\[toc\]\]/im,
36140
36173
  listType: 'ul',
36141
- format: function(content, md) {
36174
+ format: function (content, md) {
36142
36175
  return md.renderInline(content);
36143
36176
  },
36144
36177
  forceFullToc: false,
@@ -36147,17 +36180,182 @@ var defaults$2 = {
36147
36180
  transformLink: undefined,
36148
36181
  };
36149
36182
 
36150
- var markdownItTableOfContents = function(md, o) {
36151
- var options = Object.assign({}, defaults$2, o);
36152
- var tocRegexp = options.markerPattern;
36153
- var gstate;
36183
+ /**
36184
+ * @typedef {Object} HeadlineItem
36185
+ * @property {number} level Headline level
36186
+ * @property {string} anchor Anchor target
36187
+ * @property {string} text Text of headline
36188
+ */
36189
+
36190
+ /**
36191
+ * @typedef {Object} TocItem
36192
+ * @property {number} level Item level
36193
+ * @property {string} text Text of link
36194
+ * @property {string} anchor Target of link
36195
+ * @property {Array<TocItem>} children Sub-items for this list item
36196
+ * @property {TocItem} parent Parent this item belongs to
36197
+ */
36198
+
36199
+ /**
36200
+ * Finds all headline items for the defined levels in a Markdown document.
36201
+ * @param {Array<number>} levels includeLevels like `[1, 2, 3]`
36202
+ * @param {*} tokens Tokens gathered by the plugin
36203
+ * @param {*} options Plugin options
36204
+ * @returns {Array<HeadlineItem>}
36205
+ */
36206
+ function findHeadlineElements(levels, tokens, options) {
36207
+ const headings = [];
36208
+ let currentHeading = null;
36209
+
36210
+ tokens.forEach(token => {
36211
+ if (token.type === 'heading_open') {
36212
+ const id = findExistingIdAttr(token);
36213
+ const level = parseInt(token.tag.toLowerCase().replace('h', ''), 10);
36214
+ if (levels.indexOf(level) >= 0) {
36215
+ currentHeading = {
36216
+ level: level,
36217
+ text: null,
36218
+ anchor: id || null
36219
+ };
36220
+ }
36221
+ }
36222
+ else if (currentHeading && token.type === 'inline') {
36223
+ const textContent = token.children
36224
+ .filter((childToken) => childToken.type === 'text' || childToken.type === 'code_inline')
36225
+ .reduce((acc, t) => acc + t.content, '');
36226
+ currentHeading.text = textContent;
36227
+ if (! currentHeading.anchor) {
36228
+ currentHeading.anchor = options.slugify(textContent, token.content);
36229
+ }
36230
+ }
36231
+ else if (token.type === 'heading_close') {
36232
+ if (currentHeading) {
36233
+ headings.push(currentHeading);
36234
+ }
36235
+ currentHeading = null;
36236
+ }
36237
+ });
36238
+
36239
+ return headings;
36240
+ }
36241
+
36242
+ /**
36243
+ * Helper to find an existing id attr on a token. Should be a heading_open token, but could be anything really
36244
+ * Provided by markdown-it-anchor or markdown-it-attrs
36245
+ * @param {any} token Token
36246
+ * @returns {string} Id attribute to use as anchor
36247
+ */
36248
+ function findExistingIdAttr(token) {
36249
+ if (token && token.attrs && token.attrs.length > 0) {
36250
+ const idAttr = token.attrs.find( (attr) => {
36251
+ if (Array.isArray(attr) && attr.length >= 2) {
36252
+ return attr[0] === 'id';
36253
+ }
36254
+ return false;
36255
+ });
36256
+ if (idAttr && Array.isArray(idAttr) && idAttr.length >= 2) {
36257
+ const [key, val] = idAttr;
36258
+ return val;
36259
+ }
36260
+ }
36261
+ return null;
36262
+ }
36263
+
36264
+ /**
36265
+ * Helper to get minimum headline level so that the TOC is nested correctly
36266
+ * @param {Array<HeadlineItem>} headlineItems Search these
36267
+ * @returns {number} Minimum level
36268
+ */
36269
+ function getMinLevel(headlineItems) {
36270
+ return Math.min(...headlineItems.map(item => item.level));
36271
+ }
36272
+
36273
+ /**
36274
+ * Helper that creates a TOCItem
36275
+ * @param {number} level
36276
+ * @param {string} text
36277
+ * @param {string} anchor
36278
+ * @param {TocItem} rootNode
36279
+ * @returns {TocItem}
36280
+ */
36281
+ function addListItem(level, text, anchor, rootNode) {
36282
+ const listItem = { level, text, anchor, children: [], parent: rootNode };
36283
+ rootNode.children.push(listItem);
36284
+ return listItem;
36285
+ }
36286
+
36287
+ /**
36288
+ * Turns a list of flat headline items into a nested tree object representing the TOC
36289
+ * @param {Array<HeadlineItem>} headlineItems
36290
+ * @returns {TocItem} Tree of TOC items
36291
+ */
36292
+ function flatHeadlineItemsToNestedTree(headlineItems) {
36293
+ // create a root node with no text that holds the entire TOC. this won't be rendered, but only its children
36294
+ const toc = { level: getMinLevel(headlineItems) - 1, anchor: null, text: null, children: [], parent: null };
36295
+ // pointer that tracks the last root item of the current list
36296
+ let currentRootNode = toc;
36297
+ // pointer that tracks the last item (to turn it into a new root node if necessary)
36298
+ let prevListItem = currentRootNode;
36299
+
36300
+ headlineItems.forEach(headlineItem => {
36301
+ // if level is bigger, take the previous node, add a child list, set current list to this new child list
36302
+ if (headlineItem.level > prevListItem.level) {
36303
+ // eslint-disable-next-line no-unused-vars
36304
+ Array.from({ length: headlineItem.level - prevListItem.level }).forEach(_ => {
36305
+ currentRootNode = prevListItem;
36306
+ prevListItem = addListItem(headlineItem.level, null, null, currentRootNode);
36307
+ });
36308
+ prevListItem.text = headlineItem.text;
36309
+ prevListItem.anchor = headlineItem.anchor;
36310
+ }
36311
+ // if level is same, add to the current list
36312
+ else if (headlineItem.level === prevListItem.level) {
36313
+ prevListItem = addListItem(headlineItem.level, headlineItem.text, headlineItem.anchor, currentRootNode);
36314
+ }
36315
+ // if level is smaller, set current list to currentlist.parent
36316
+ else if (headlineItem.level < prevListItem.level) {
36317
+ for (let i = 0; i < prevListItem.level - headlineItem.level; i++) {
36318
+ currentRootNode = currentRootNode.parent;
36319
+ }
36320
+ prevListItem = addListItem(headlineItem.level, headlineItem.text, headlineItem.anchor, currentRootNode);
36321
+ }
36322
+ });
36323
+
36324
+ return toc;
36325
+ }
36326
+
36327
+ /**
36328
+ * Recursively turns a nested tree of tocItems to HTML.
36329
+ * @param {TocItem} tocItem
36330
+ * @returns {string}
36331
+ */
36332
+ function tocItemToHtml(tocItem, options, md) {
36333
+ return '<' + options.listType + '>' + tocItem.children.map(childItem => {
36334
+ let li = '<li>';
36335
+ let anchor = childItem.anchor;
36336
+ if (options && options.transformLink) {
36337
+ anchor = options.transformLink(anchor);
36338
+ }
36339
+
36340
+ let text = childItem.text ? options.format(childItem.text, md, anchor) : null;
36341
+
36342
+ li += anchor ? `<a href="#${anchor}">${text}</a>` : (text || '');
36343
+
36344
+ return li + (childItem.children.length > 0 ? tocItemToHtml(childItem, options, md) : '') + '</li>';
36345
+ }).join('') + '</' + options.listType + '>';
36346
+ }
36347
+
36348
+ var markdownItTableOfContents = function (md, o) {
36349
+ const options = Object.assign({}, defaults$2, o);
36350
+ const tocRegexp = options.markerPattern;
36351
+ let gstate;
36154
36352
 
36155
36353
  function toc(state, silent) {
36156
- var token;
36157
- var match;
36354
+ let token;
36355
+ let match;
36158
36356
 
36159
36357
  // Reject if the token does not start with [
36160
- if (state.src.charCodeAt(state.pos) !== 0x5B /* [ */ ) {
36358
+ if (state.src.charCodeAt(state.pos) !== 0x5B /* [ */) {
36161
36359
  return false;
36162
36360
  }
36163
36361
  // Don't run any pairs in validation mode
@@ -36167,7 +36365,7 @@ var markdownItTableOfContents = function(md, o) {
36167
36365
 
36168
36366
  // Detect TOC markdown
36169
36367
  match = tocRegexp.exec(state.src.substr(state.pos));
36170
- match = !match ? [] : match.filter(function(m) { return m; });
36368
+ match = !match ? [] : match.filter(function (m) { return m; });
36171
36369
  if (match.length < 1) {
36172
36370
  return false;
36173
36371
  }
@@ -36189,8 +36387,8 @@ var markdownItTableOfContents = function(md, o) {
36189
36387
  return true;
36190
36388
  }
36191
36389
 
36192
- md.renderer.rules.toc_open = function(tokens, index) {
36193
- var tocOpenHtml = '<div class="'+ options.containerClass +'">';
36390
+ md.renderer.rules.toc_open = function (tokens, index) {
36391
+ var tocOpenHtml = '<div class="' + options.containerClass + '">';
36194
36392
 
36195
36393
  if (options.containerHeaderHtml) {
36196
36394
  tocOpenHtml += options.containerHeaderHtml;
@@ -36199,7 +36397,7 @@ var markdownItTableOfContents = function(md, o) {
36199
36397
  return tocOpenHtml;
36200
36398
  };
36201
36399
 
36202
- md.renderer.rules.toc_close = function(tokens, index) {
36400
+ md.renderer.rules.toc_close = function (tokens, index) {
36203
36401
  var tocFooterHtml = '';
36204
36402
 
36205
36403
  if (options.containerFooterHtml) {
@@ -36209,69 +36407,19 @@ var markdownItTableOfContents = function(md, o) {
36209
36407
  return tocFooterHtml + '</div>';
36210
36408
  };
36211
36409
 
36212
- md.renderer.rules.toc_body = function(tokens, index) {
36410
+ md.renderer.rules.toc_body = function (tokens, index) {
36213
36411
  if (options.forceFullToc) {
36214
- throw("forceFullToc was removed in version 0.5.0. For more information, see https://github.com/Oktavilla/markdown-it-table-of-contents/pull/41")
36412
+ throw ("forceFullToc was removed in version 0.5.0. For more information, see https://github.com/Oktavilla/markdown-it-table-of-contents/pull/41");
36215
36413
  } else {
36216
- return renderChildsTokens(0, gstate.tokens)[1];
36414
+ const headlineItems = findHeadlineElements(options.includeLevel, gstate.tokens, options);
36415
+ const toc = flatHeadlineItemsToNestedTree(headlineItems);
36416
+ const html = tocItemToHtml(toc, options, md);
36417
+ return html;
36217
36418
  }
36218
36419
  };
36219
36420
 
36220
- function renderChildsTokens(pos, tokens) {
36221
- var headings = [],
36222
- buffer = '',
36223
- currentLevel,
36224
- subHeadings,
36225
- size = tokens.length,
36226
- i = pos;
36227
- while(i < size) {
36228
- var token = tokens[i];
36229
- var heading = tokens[i - 1];
36230
- var level = token.tag && parseInt(token.tag.substr(1, 1));
36231
- if (token.type !== 'heading_close' || options.includeLevel.indexOf(level) == -1 || heading.type !== 'inline') {
36232
- i++; continue; // Skip if not matching criteria
36233
- }
36234
- if (!currentLevel) {
36235
- currentLevel = level;// We init with the first found level
36236
- } else {
36237
- if (level > currentLevel) {
36238
- subHeadings = renderChildsTokens(i, tokens);
36239
- buffer += subHeadings[1];
36240
- i = subHeadings[0];
36241
- continue;
36242
- }
36243
- if (level < currentLevel) {
36244
- // Finishing the sub headings
36245
- buffer += "</li>";
36246
- headings.push(buffer);
36247
- return [i, "<"+ options.listType +">"+ headings.join('') +"</"+ options.listType +">"];
36248
- }
36249
- if (level == currentLevel) {
36250
- // Finishing the sub headings
36251
- buffer += "</li>";
36252
- headings.push(buffer);
36253
- }
36254
- }
36255
- var content = heading.children
36256
- .filter((token) => token.type === 'text' || token.type === 'code_inline')
36257
- .reduce((acc, t) => acc + t.content, '');
36258
- var slugifiedContent = options.slugify(content);
36259
- var link = "#"+slugifiedContent;
36260
- if (options.transformLink) {
36261
- link = options.transformLink(link);
36262
- }
36263
- buffer = `<li><a href="${link}">`;
36264
- buffer += options.format(content, md, link);
36265
- buffer += `</a>`;
36266
- i++;
36267
- }
36268
- buffer += buffer === '' ? '' : '</li>';
36269
- headings.push(buffer);
36270
- return [i, "<"+ options.listType +">"+ headings.join('') +"</"+ options.listType +">"];
36271
- }
36272
-
36273
36421
  // Catch all the tokens for iteration later
36274
- md.core.ruler.push('grab_state', function(state) {
36422
+ md.core.ruler.push('grab_state', function (state) {
36275
36423
  gstate = state;
36276
36424
  });
36277
36425
 
@@ -36431,12 +36579,12 @@ export default {}<\/script>`);
36431
36579
  return tags;
36432
36580
  }
36433
36581
  const inferTitle = (frontmatter, content) => {
36434
- if (frontmatter.home) {
36435
- return "Home";
36436
- }
36437
36582
  if (frontmatter.title) {
36438
36583
  return deeplyParseHeader(frontmatter.title);
36439
36584
  }
36585
+ if (frontmatter.home) {
36586
+ return "Home";
36587
+ }
36440
36588
  const match = content.match(/^\s*#+\s+(.*)/m);
36441
36589
  if (match) {
36442
36590
  return deeplyParseHeader(match[1].trim());
@@ -40083,7 +40231,7 @@ async function renderPage(config, page, result, appChunk, cssChunk, pageToHashMa
40083
40231
  const { __pageData } = require(path__default["default"].join(config.tempDir, pageServerJsFileName));
40084
40232
  const pageData = JSON.parse(__pageData);
40085
40233
  let preloadLinks = config.mpa ? appChunk ? [appChunk.fileName] : [] : result && appChunk ? [
40086
- ...new Set([
40234
+ .../* @__PURE__ */ new Set([
40087
40235
  ...resolvePageImports(config, page, result, appChunk),
40088
40236
  pageClientJsFileName,
40089
40237
  appChunk.fileName
@@ -256,6 +256,7 @@ export declare interface SiteData<ThemeConfig = any> {
256
256
  description: string
257
257
  head: HeadConfig[]
258
258
  themeConfig: ThemeConfig
259
+ scrollOffset: number | string
259
260
  locales: Record<string, LocaleConfig>
260
261
  /**
261
262
  * Available locales for the site when it has defined `locales` in its
@@ -301,6 +302,11 @@ export declare interface UserConfig<ThemeConfig = any> {
301
302
  srcExclude?: string[];
302
303
  outDir?: string;
303
304
  shouldPreload?: (link: string, page: string) => boolean;
305
+ /**
306
+ * Configure the scroll offset when the theme has a sticky header.
307
+ * Can be a number or a selector element to get the offset from.
308
+ */
309
+ scrollOffset?: number | string;
304
310
  /**
305
311
  * Enable MPA / zero-JS mode
306
312
  * @experimental
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitepress",
3
- "version": "0.21.4",
3
+ "version": "0.21.5",
4
4
  "description": "Vite & Vue powered static site generator",
5
5
  "main": "dist/node/index.js",
6
6
  "typings": "types/index.d.ts",
@@ -11,7 +11,8 @@
11
11
  "bin",
12
12
  "dist",
13
13
  "types",
14
- "client.d.ts"
14
+ "client.d.ts",
15
+ "theme.d.ts"
15
16
  ],
16
17
  "engines": {
17
18
  "node": ">=12.0.0"
@@ -47,8 +48,8 @@
47
48
  "@docsearch/js": "^3.0.0-alpha.41",
48
49
  "@vitejs/plugin-vue": "^2.0.0",
49
50
  "prismjs": "^1.25.0",
50
- "vite": "^2.7.0",
51
- "vue": "^3.2.26"
51
+ "vite": "^2.7.12",
52
+ "vue": "^3.2.27"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@microsoft/api-extractor": "^7.18.9",
@@ -59,7 +60,7 @@
59
60
  "@types/compression": "^1.7.0",
60
61
  "@types/debug": "^4.1.7",
61
62
  "@types/fs-extra": "^9.0.11",
62
- "@types/jest": "^26.0.23",
63
+ "@types/jest": "^27.0.0",
63
64
  "@types/koa": "^2.13.1",
64
65
  "@types/koa-static": "^4.0.1",
65
66
  "@types/lru-cache": "^5.1.0",
@@ -74,7 +75,7 @@
74
75
  "debug": "^4.3.2",
75
76
  "diacritics": "^1.3.0",
76
77
  "enquirer": "^2.3.6",
77
- "esbuild": "^0.13.4",
78
+ "esbuild": "^0.14.0",
78
79
  "escape-html": "^1.0.3",
79
80
  "execa": "^5.0.0",
80
81
  "fast-glob": "^3.2.7",
@@ -84,12 +85,12 @@
84
85
  "jest": "^27.0.1",
85
86
  "lint-staged": "^11.0.0",
86
87
  "lru-cache": "^6.0.0",
87
- "markdown-it": "^12.0.6",
88
- "markdown-it-anchor": "^8.1.2",
89
- "markdown-it-attrs": "^4.0.0",
88
+ "markdown-it": "^12.3.2",
89
+ "markdown-it-anchor": "^8.4.1",
90
+ "markdown-it-attrs": "^4.1.3",
90
91
  "markdown-it-container": "^3.0.0",
91
92
  "markdown-it-emoji": "^2.0.0",
92
- "markdown-it-table-of-contents": "^0.5.2",
93
+ "markdown-it-table-of-contents": "^0.6.0",
93
94
  "micromatch": "^4.0.4",
94
95
  "minimist": "^1.2.5",
95
96
  "npm-run-all": "^4.1.5",
@@ -98,7 +99,7 @@
98
99
  "prettier": "^2.3.0",
99
100
  "rimraf": "^3.0.2",
100
101
  "rollup": "^2.56.3",
101
- "rollup-plugin-esbuild": "^4.5.0",
102
+ "rollup-plugin-esbuild": "^4.8.2",
102
103
  "semver": "^7.3.5",
103
104
  "sirv": "^1.0.12",
104
105
  "ts-jest": "^27.0.1",
package/theme.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ // so that users can do `import DefaultTheme from 'vitepress/theme'`
2
+ import { ComponentOptions } from 'vue'
3
+
4
+ declare const defaultTheme: {
5
+ Layout: ComponentOptions
6
+ NotFound: ComponentOptions
7
+ }
8
+
9
+ export default defaultTheme
package/types/shared.d.ts CHANGED
@@ -22,6 +22,7 @@ export interface SiteData<ThemeConfig = any> {
22
22
  description: string
23
23
  head: HeadConfig[]
24
24
  themeConfig: ThemeConfig
25
+ scrollOffset: number | string
25
26
  locales: Record<string, LocaleConfig>
26
27
  /**
27
28
  * Available locales for the site when it has defined `locales` in its