vitepress
Advanced tools
Comparing version 0.21.4 to 0.21.5
import { reactive, inject, markRaw, nextTick, readonly } from 'vue'; | ||
import { inBrowser } from './utils'; | ||
import { siteDataRef } from './data'; | ||
export const RouterSymbol = Symbol(); | ||
@@ -151,3 +152,12 @@ // we are just using URL to parse the pathname and hash - the base doesn't | ||
if (target) { | ||
const targetTop = target.offsetTop; | ||
let offset = siteDataRef.value.scrollOffset; | ||
if (typeof offset === 'string') { | ||
offset = | ||
document.querySelector(offset).getBoundingClientRect().bottom + 24; | ||
} | ||
const targetPadding = parseInt(window.getComputedStyle(target).paddingTop, 10); | ||
const targetTop = window.scrollY + | ||
target.getBoundingClientRect().top - | ||
offset + | ||
targetPadding; | ||
// only smooth scroll if distance is smaller than screen height. | ||
@@ -154,0 +164,0 @@ if (!smooth || Math.abs(targetTop - window.scrollY) > window.innerHeight) { |
@@ -9,2 +9,3 @@ import { AllowedComponentProps } from 'vue'; | ||
import { EmitsOptions } from 'vue'; | ||
import { ExtractPropTypes } from 'vue'; | ||
import { Ref } from 'vue'; | ||
@@ -18,3 +19,3 @@ import { RendererElement } from 'vue'; | ||
[key: string]: any; | ||
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{} & {} & {}>, {}>; | ||
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes< {}>>, {}>; | ||
@@ -81,2 +82,3 @@ export declare const Debug: ComponentOptions<{}, any, any, any, any, any, any, any>; | ||
themeConfig: ThemeConfig | ||
scrollOffset: number | string | ||
locales: Record<string, LocaleConfig> | ||
@@ -83,0 +85,0 @@ /** |
'use strict'; | ||
var serve = require('./serve-9731a371.js'); | ||
var serve = require('./serve-322f3382.js'); | ||
require('fs'); | ||
@@ -5,0 +5,0 @@ require('path'); |
@@ -259,2 +259,3 @@ import { AliasOptions } from 'vite'; | ||
themeConfig: ThemeConfig | ||
scrollOffset: number | string | ||
locales: Record<string, LocaleConfig> | ||
@@ -306,2 +307,7 @@ /** | ||
/** | ||
* Configure the scroll offset when the theme has a sticky header. | ||
* Can be a number or a selector element to get the offset from. | ||
*/ | ||
scrollOffset?: number | string; | ||
/** | ||
* Enable MPA / zero-JS mode | ||
@@ -308,0 +314,0 @@ * @experimental |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var serve = require('./serve-9731a371.js'); | ||
var serve = require('./serve-322f3382.js'); | ||
require('vite'); | ||
@@ -8,0 +8,0 @@ require('readline'); |
@@ -259,2 +259,3 @@ import { AliasOptions } from 'vite'; | ||
themeConfig: ThemeConfig | ||
scrollOffset: number | string | ||
locales: Record<string, LocaleConfig> | ||
@@ -306,2 +307,7 @@ /** | ||
/** | ||
* Configure the scroll offset when the theme has a sticky header. | ||
* Can be a number or a selector element to get the offset from. | ||
*/ | ||
scrollOffset?: number | string; | ||
/** | ||
* Enable MPA / zero-JS mode | ||
@@ -308,0 +314,0 @@ * @experimental |
{ | ||
"name": "vitepress", | ||
"version": "0.21.4", | ||
"version": "0.21.5", | ||
"description": "Vite & Vue powered static site generator", | ||
@@ -14,3 +14,4 @@ "main": "dist/node/index.js", | ||
"types", | ||
"client.d.ts" | ||
"client.d.ts", | ||
"theme.d.ts" | ||
], | ||
@@ -51,4 +52,4 @@ "engines": { | ||
"prismjs": "^1.25.0", | ||
"vite": "^2.7.0", | ||
"vue": "^3.2.26" | ||
"vite": "^2.7.12", | ||
"vue": "^3.2.27" | ||
}, | ||
@@ -64,3 +65,3 @@ "devDependencies": { | ||
"@types/fs-extra": "^9.0.11", | ||
"@types/jest": "^26.0.23", | ||
"@types/jest": "^27.0.0", | ||
"@types/koa": "^2.13.1", | ||
@@ -80,3 +81,3 @@ "@types/koa-static": "^4.0.1", | ||
"enquirer": "^2.3.6", | ||
"esbuild": "^0.13.4", | ||
"esbuild": "^0.14.0", | ||
"escape-html": "^1.0.3", | ||
@@ -91,8 +92,8 @@ "execa": "^5.0.0", | ||
"lru-cache": "^6.0.0", | ||
"markdown-it": "^12.0.6", | ||
"markdown-it-anchor": "^8.1.2", | ||
"markdown-it-attrs": "^4.0.0", | ||
"markdown-it": "^12.3.2", | ||
"markdown-it-anchor": "^8.4.1", | ||
"markdown-it-attrs": "^4.1.3", | ||
"markdown-it-container": "^3.0.0", | ||
"markdown-it-emoji": "^2.0.0", | ||
"markdown-it-table-of-contents": "^0.5.2", | ||
"markdown-it-table-of-contents": "^0.6.0", | ||
"micromatch": "^4.0.4", | ||
@@ -106,3 +107,3 @@ "minimist": "^1.2.5", | ||
"rollup": "^2.56.3", | ||
"rollup-plugin-esbuild": "^4.5.0", | ||
"rollup-plugin-esbuild": "^4.8.2", | ||
"semver": "^7.3.5", | ||
@@ -109,0 +110,0 @@ "sirv": "^1.0.12", |
@@ -25,2 +25,3 @@ // types shared between server and client | ||
themeConfig: ThemeConfig | ||
scrollOffset: number | string | ||
locales: Record<string, LocaleConfig> | ||
@@ -27,0 +28,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1600190
70
62730
Updatedvite@^2.7.12
Updatedvue@^3.2.27