diff --git a/.oxlintrc.json b/.oxlintrc.json
index cc24e72..698338e 100644
--- a/.oxlintrc.json
+++ b/.oxlintrc.json
@@ -15,7 +15,7 @@
},
"globals": {
"defineProps": "readonly",
- "defineEmits": "readonly"
+ "defineModel": "readonly"
},
"rules": {
"id-length": "off",
diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts
index f4ef4da..2603404 100644
--- a/.vitepress/theme/index.ts
+++ b/.vitepress/theme/index.ts
@@ -4,6 +4,7 @@ import { h } from 'vue';
import './variables.css';
import './main.css';
import 'virtual:group-icons.css';
+import ApiOutline from '../../components/ApiOutline.vue';
import CarbonAds from '../../components/CarbonAds.vue';
import ModuleIndex from '../../components/ModuleIndex.vue';
import StatusContent from '../../components/StatusContent.vue';
@@ -22,6 +23,7 @@ export default {
app.component('ModuleIndex', ModuleIndex);
app.component('StatusContent', StatusContent);
app.component('TesterContent', TesterContent);
+ app.component('ApiOutline', ApiOutline);
if (typeof window !== 'undefined') {
router.onBeforeRouteChange = (to) => {
diff --git a/components/ApiOutline.vue b/components/ApiOutline.vue
new file mode 100644
index 0000000..8af6491
--- /dev/null
+++ b/components/ApiOutline.vue
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
diff --git a/components/CodeMirrorEditor.vue b/components/CodeMirrorEditor.vue
index 907cfbe..0dd8743 100644
--- a/components/CodeMirrorEditor.vue
+++ b/components/CodeMirrorEditor.vue
@@ -15,15 +15,14 @@ import { EditorView, basicSetup } from 'codemirror';
import { useData } from 'vitepress';
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
-const { errorLines, language, modelValue, readOnly } = defineProps({
+const { errorLines, language, readOnly } = defineProps({
errorLines: { default: () => [], type: Array },
language: { default: 'javascript', type: String },
- modelValue: { default: '', type: String },
readOnly: { default: false, type: Boolean },
});
-const emit = defineEmits(['update:modelValue']);
+const data = defineModel({ default: '', type: String });
const { isDark } = useData();
@@ -81,7 +80,7 @@ onMounted(() => {
themeCompartment.of(getThemeExtension()),
EditorView.updateListener.of((update) => {
if (update.docChanged) {
- emit('update:modelValue', update.state.doc.toString());
+ data.value = update.state.doc.toString();
}
}),
];
@@ -97,7 +96,7 @@ onMounted(() => {
view = new EditorView({
parent: editorContainer.value,
- state: EditorState.create({ doc: modelValue, extensions }),
+ state: EditorState.create({ doc: data.value, extensions }),
});
if (readOnly && errorLines.length > 0) {
@@ -106,16 +105,13 @@ onMounted(() => {
});
-watch(
- () => modelValue,
- (newValue) => {
- if (view && newValue !== view.state.doc.toString()) {
- view.dispatch({
- changes: { from: 0, insert: newValue, to: view.state.doc.length },
- });
- }
- },
-);
+watch(data, (newValue) => {
+ if (view && newValue !== view.state.doc.toString()) {
+ view.dispatch({
+ changes: { from: 0, insert: newValue, to: view.state.doc.length },
+ });
+ }
+});
watch(
diff --git a/components/TesterContent.vue b/components/TesterContent.vue
index cc0d44a..0d99234 100644
--- a/components/TesterContent.vue
+++ b/components/TesterContent.vue
@@ -69,6 +69,7 @@
diff --git a/docs/api/[version].md b/docs/api/[version].md
index 9f04c28..6c2902a 100644
--- a/docs/api/[version].md
+++ b/docs/api/[version].md
@@ -2,6 +2,8 @@
title: API
---
+
+
# API v{{ $params.fullVersion }}
### Installation
diff --git a/docs/module/[name]/api/[version].md b/docs/module/[name]/api/[version].md
index 25e3d60..a8dab94 100644
--- a/docs/module/[name]/api/[version].md
+++ b/docs/module/[name]/api/[version].md
@@ -2,6 +2,8 @@
title: Module API
---
+
+
# {{ $params.package }} API v{{ $params.fullVersion }}
::: code-group
diff --git a/docs/module/[name]/changelog.md b/docs/module/[name]/changelog.md
index e391b2f..f1ed787 100644
--- a/docs/module/[name]/changelog.md
+++ b/docs/module/[name]/changelog.md
@@ -2,6 +2,8 @@
title: Module changelog
---
+
+
# Changelog
::: v-pre
diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md
index 6df6fff..ea3da10 100644
--- a/docs/resources/changelog.md
+++ b/docs/resources/changelog.md
@@ -2,6 +2,8 @@
title: Changelog
---
+
+
# Changelog
::: v-pre
diff --git a/package.json b/package.json
index 695bfd2..bc1677c 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
"@lezer/highlight": "^1.2.3",
"@uiw/codemirror-theme-darcula": "^4.25.8",
"@uiw/codemirror-theme-eclipse": "^4.25.8",
+ "@vueuse/core": "^14.2.1",
"codemirror": "^6.0.2",
"es-toolkit": "^1.45.1",
"joi-17": "npm:joi@17.13.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 59f62d1..bdf9037 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -35,6 +35,9 @@ importers:
'@uiw/codemirror-theme-eclipse':
specifier: ^4.25.8
version: 4.25.8(@codemirror/language@6.12.2)(@codemirror/state@6.6.0)(@codemirror/view@6.40.0)
+ '@vueuse/core':
+ specifier: ^14.2.1
+ version: 14.2.1(vue@3.5.30(typescript@5.9.3))
codemirror:
specifier: ^6.0.2
version: 6.0.2