@deot/docs-markdown 1.1.1 → 1.1.3
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.
- package/README.md +1 -0
- package/dist/index.cjs +6 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -150,6 +150,7 @@ createApp(App).mount('#app');
|
|
|
150
150
|
支持的 `views` 值为 `runtime` 和 `files`。`viewport` 可为 `auto`、正数宽度或 `[width, height]`。
|
|
151
151
|
`title` 为可选字符串,显示在运行时顶栏左侧;空串或不传不渲染。有标题时会生成锚点 id(可用 `#...` 跳转),规则与 markdown heading 一致;也可用 `id` 显式覆盖。
|
|
152
152
|
`expandable` 为可选:`true` 展开到剩余视口,正数为展开目标高度(px);未配置时不显示展开控件。
|
|
153
|
+
`previewScroller` 为可选布尔值:开启后在 iframe 内用 `@deot/vc` Scroller 替换原生滚动条;会动态探测 `Scroller`,不存在则回退。
|
|
153
154
|
|
|
154
155
|
Playground 会在浏览器里编译 Vue SFC 的 `<style lang="scss">` 以及独立 `.scss` / `.sass` 文件。下划线 partial(如 `_variables.scss`)只作为 `@use` 依赖,不会单独注入预览。
|
|
155
156
|
|
package/dist/index.cjs
CHANGED
|
@@ -171,6 +171,11 @@ var validateTitleId = (propsData) => {
|
|
|
171
171
|
if (typeof propsData.id === "string") return "";
|
|
172
172
|
return "id 必须是字符串";
|
|
173
173
|
};
|
|
174
|
+
var validatePreviewScroller = (propsData) => {
|
|
175
|
+
if (!("previewScroller" in propsData)) return "";
|
|
176
|
+
if (typeof propsData.previewScroller === "boolean") return "";
|
|
177
|
+
return "previewScroller 必须是布尔值";
|
|
178
|
+
};
|
|
174
179
|
var parseRuntimeProps = (tokens) => {
|
|
175
180
|
for (const token of tokens) {
|
|
176
181
|
const sources = [];
|
|
@@ -261,7 +266,7 @@ md.core.ruler.after("markdown-tabs", "runtime-files", (state) => {
|
|
|
261
266
|
const placeholder = new state.Token("html_block", "", 0);
|
|
262
267
|
placeholder.block = true;
|
|
263
268
|
const propsData = parseRuntimeProps(innerTokens);
|
|
264
|
-
const propsError = validateRuntimeViews(propsData) || validateRuntimeViewport(propsData) || validatePreviewInset(propsData) || validateExpandable(propsData) || validateTitle(propsData) || validateTitleId(propsData);
|
|
269
|
+
const propsError = validateRuntimeViews(propsData) || validateRuntimeViewport(propsData) || validatePreviewInset(propsData) || validateExpandable(propsData) || validateTitle(propsData) || validateTitleId(propsData) || validatePreviewScroller(propsData);
|
|
265
270
|
const propsAttr = renderPlaygroundAttrs(propsData);
|
|
266
271
|
if (!fences.length) placeholder.content = renderPlaygroundError("至少需要声明一个代码文件");
|
|
267
272
|
else if (propsError) placeholder.content = renderPlaygroundError(propsError);
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { PlaygroundFiles } from '@deot/docs-playground';
|
|
|
8
8
|
import type { PlaygroundOptions } from '@deot/docs-playground';
|
|
9
9
|
import type { PlaygroundPreviewInset } from '@deot/docs-playground';
|
|
10
10
|
import type { PlaygroundPreviewOptions } from '@deot/docs-playground';
|
|
11
|
+
import type { PlaygroundPreviewScroller } from '@deot/docs-playground';
|
|
11
12
|
import type { PlaygroundView } from '@deot/docs-playground';
|
|
12
13
|
import type { PlaygroundViewport } from '@deot/docs-playground';
|
|
13
14
|
import { PublicProps } from 'vue';
|
|
@@ -70,6 +71,7 @@ export declare interface MarkdownPlaygroundConfig {
|
|
|
70
71
|
options?: PlaygroundOptions;
|
|
71
72
|
previewInset?: PlaygroundPreviewInset;
|
|
72
73
|
expandable?: PlaygroundExpandable;
|
|
74
|
+
previewScroller?: PlaygroundPreviewScroller;
|
|
73
75
|
previewOptions?: PlaygroundPreviewOptions;
|
|
74
76
|
}
|
|
75
77
|
|
package/dist/index.js
CHANGED
|
@@ -143,6 +143,11 @@ var validateTitleId = (propsData) => {
|
|
|
143
143
|
if (typeof propsData.id === "string") return "";
|
|
144
144
|
return "id 必须是字符串";
|
|
145
145
|
};
|
|
146
|
+
var validatePreviewScroller = (propsData) => {
|
|
147
|
+
if (!("previewScroller" in propsData)) return "";
|
|
148
|
+
if (typeof propsData.previewScroller === "boolean") return "";
|
|
149
|
+
return "previewScroller 必须是布尔值";
|
|
150
|
+
};
|
|
146
151
|
var parseRuntimeProps = (tokens) => {
|
|
147
152
|
for (const token of tokens) {
|
|
148
153
|
const sources = [];
|
|
@@ -233,7 +238,7 @@ md.core.ruler.after("markdown-tabs", "runtime-files", (state) => {
|
|
|
233
238
|
const placeholder = new state.Token("html_block", "", 0);
|
|
234
239
|
placeholder.block = true;
|
|
235
240
|
const propsData = parseRuntimeProps(innerTokens);
|
|
236
|
-
const propsError = validateRuntimeViews(propsData) || validateRuntimeViewport(propsData) || validatePreviewInset(propsData) || validateExpandable(propsData) || validateTitle(propsData) || validateTitleId(propsData);
|
|
241
|
+
const propsError = validateRuntimeViews(propsData) || validateRuntimeViewport(propsData) || validatePreviewInset(propsData) || validateExpandable(propsData) || validateTitle(propsData) || validateTitleId(propsData) || validatePreviewScroller(propsData);
|
|
237
242
|
const propsAttr = renderPlaygroundAttrs(propsData);
|
|
238
243
|
if (!fences.length) placeholder.content = renderPlaygroundError("至少需要声明一个代码文件");
|
|
239
244
|
else if (propsError) placeholder.content = renderPlaygroundError(propsError);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deot/docs-markdown",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"style": "dist/index.style.css",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@deot/docs-locale": "^1.1.0",
|
|
24
|
-
"@deot/docs-playground": "^1.1.
|
|
24
|
+
"@deot/docs-playground": "^1.1.2",
|
|
25
25
|
"@deot/docs-theme": "^1.1.0",
|
|
26
26
|
"@deot/helper-dom": "^1.1.5",
|
|
27
27
|
"json5": "^2.2.3",
|