@mp-lb/mdkit 0.2.4 → 0.2.5-main.27.1

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 CHANGED
@@ -63,6 +63,7 @@ import {
63
63
 
64
64
  const document = useMdKitDocument({
65
65
  adapter,
66
+ debounceMs: 1000,
66
67
  documentId: "docs/brief.md",
67
68
  });
68
69
 
@@ -5,7 +5,7 @@ const emptyDocumentState = {
5
5
  version: null,
6
6
  };
7
7
  export const useMdKitDocument = (options) => {
8
- const { adapter, debounceMs = 350, documentId, pollMs = 2000 } = options;
8
+ const { adapter, debounceMs = 1000, documentId, pollMs = 2000 } = options;
9
9
  const [local, setLocal] = useState("");
10
10
  const [base, setBase] = useState("");
11
11
  const [version, setVersion] = useState(null);
@@ -213,6 +213,11 @@ export const TiptapMarkdownSurface = (props) => {
213
213
  if (!editor) {
214
214
  return;
215
215
  }
216
+ if (hasCollaboration) {
217
+ currentMarkdownRef.current = markdownValue;
218
+ pendingControlledEchoesRef.current.clear();
219
+ return;
220
+ }
216
221
  if (markdownValue === currentMarkdownRef.current) {
217
222
  pendingControlledEchoesRef.current.clear();
218
223
  return;
@@ -231,7 +236,7 @@ export const TiptapMarkdownSurface = (props) => {
231
236
  window.queueMicrotask(() => {
232
237
  isApplyingExternalValueRef.current = false;
233
238
  });
234
- }, [editor, markdownValue]);
239
+ }, [editor, hasCollaboration, markdownValue]);
235
240
  if (!editor) {
236
241
  return (_jsx("div", { className: "mp-lb-mdkit-editor-shell", children: _jsx("div", { className: "mp-lb-mdkit-editor-empty", children: collaboration
237
242
  ? "Connecting collaboration session..."
@@ -7,6 +7,7 @@ export default defineConfig({
7
7
  themeConfig: {
8
8
  nav: [
9
9
  { text: "Quick Start", link: "/" },
10
+ { text: "Plain Text", link: "/plain-text" },
10
11
  { text: "Styling", link: "/styling" },
11
12
  { text: "Shadcn", link: "/shadcn" },
12
13
  { text: "REST", link: "/rest" },
@@ -21,6 +22,7 @@ export default defineConfig({
21
22
  text: "Guide",
22
23
  items: [
23
24
  { text: "Quick Start", link: "/" },
25
+ { text: "Plain Text Editors", link: "/plain-text" },
24
26
  { text: "Styling", link: "/styling" },
25
27
  { text: "Shadcn Plugin", link: "/shadcn" },
26
28
  { text: "REST Backend", link: "/rest" },
package/docs/api.md CHANGED
@@ -23,6 +23,12 @@ Collaborative mode:
23
23
  <MdKitEditor collaboration={collaboration} />
24
24
  ```
25
25
 
26
+ In collaborative mode the Yjs document in `collaboration.document` is the editor
27
+ content source. `value` may be passed for API symmetry with connected examples,
28
+ but external `value` changes are not applied into the collaborative document.
29
+ Use your Hocuspocus/MDKit collaboration persistence bridge to seed or replace
30
+ collaborative content.
31
+
26
32
  ### `MdKitEditorProps`
27
33
 
28
34
  Props for `MdKitEditor`.
@@ -40,6 +46,8 @@ Local editing props:
40
46
  Collaborative editing props:
41
47
 
42
48
  - `collaboration: MdKitCollaborationSession`
49
+ - `value?: string`
50
+ - `onChange?: (markdown: string) => void`
43
51
  - `onFocusChange?: (focused: boolean) => void`
44
52
  - `fillHeight?: boolean`
45
53
  - `className?: string`
@@ -23,12 +23,20 @@ or the host application.
23
23
  For collaborative editing, the same component accepts:
24
24
 
25
25
  - `collaboration: MdKitCollaborationSession`
26
+ - `value?: string`
27
+ - `onChange?: (markdown: string) => void`
26
28
  - `onFocusChange?: (focused: boolean) => void`
27
29
 
28
30
  Collaboration needs a different editor engine internally because it is backed by
29
31
  Yjs state and remote cursors, but consumers should not need a separate editor
30
32
  component.
31
33
 
34
+ In collaborative mode, Yjs is the live content source. The editor must not apply
35
+ late React `value` updates into the collaborative document because a host app may
36
+ load the durable markdown snapshot after Hocuspocus has already hydrated the
37
+ same document. Applying that snapshot as editor content can duplicate blocks in
38
+ the shared CRDT state.
39
+
32
40
  `MdKitView` is the read-only companion surface. It accepts a markdown `value`
33
41
  and uses the same package styling and full-height layout contract as
34
42
  `MdKitEditor`, but it renders markdown without Tiptap or ProseMirror. Use it
package/docs/index.md CHANGED
@@ -113,7 +113,11 @@ export function ConnectedMarkdownEditor({
113
113
  () => createMdKitTrpcAdapter({ client: trpc.mdkit }),
114
114
  [trpc],
115
115
  );
116
- const document = useMdKitDocument({ adapter, documentId });
116
+ const document = useMdKitDocument({
117
+ adapter,
118
+ debounceMs: 1000,
119
+ documentId,
120
+ });
117
121
  const versions = useMdKitDocumentVersions({ adapter, documentId });
118
122
 
119
123
  const collaboration = useMdKitCollaboration({
@@ -177,8 +181,9 @@ and build your own workflow components.
177
181
 
178
182
  The backend starts with a store object. Replace `createYourDocumentStore()` with
179
183
  Postgres, MongoDB, Redis, files, or any other durable storage. Your store
180
- implements database primitives: read/write the current document, create/read
181
- checkpoints, restore a checkpoint, and optionally persist collaboration state.
184
+ implements the [`MdKitBackendStore`](./api.md#mdkitbackendstore) interface:
185
+ read/write the current document, create/read checkpoints, restore a checkpoint,
186
+ and optionally persist collaboration state.
182
187
  The mdkit backend helper applies checkpoint policy and turns those primitives
183
188
  into tRPC or REST procedures. Application-owned metadata, auth, permissions,
184
189
  tenancy, and durable Yjs storage stay in your code; see
@@ -0,0 +1,131 @@
1
+ # Plain Text Editors
2
+
3
+ MDKit's connected workflow is not limited to `MdKitEditor`. The document hooks
4
+ and backend adapters work with serialized text, so you can bring a plain text,
5
+ code, JSON, or custom text editor and still use the same storage, autosave,
6
+ checkpoint history, restore, and conflict handling.
7
+
8
+ The one major exception is collaboration. Collaboration is currently a
9
+ markdown/Tiptap capability because it depends on Yjs, ProseMirror, and the
10
+ Tiptap collaboration extensions.
11
+
12
+ ## What Works
13
+
14
+ Any editor can plug into the connected workflow if it behaves like a controlled
15
+ text input:
16
+
17
+ ```tsx
18
+ type TextEditorProps = {
19
+ value: string;
20
+ onChange(value: string): void;
21
+ onFocusChange?(focused: boolean): void;
22
+ readOnly?: boolean;
23
+ };
24
+ ```
25
+
26
+ That is enough for:
27
+
28
+ - loading the current document
29
+ - autosave
30
+ - dirty state
31
+ - conflict detection
32
+ - force save
33
+ - remote resync
34
+ - checkpoint history
35
+ - checkpoint restore
36
+
37
+ The editor does not need to know about MDKit internals. It only needs to receive
38
+ `document.value` and call `document.setContent`.
39
+
40
+ ## Example
41
+
42
+ ```tsx
43
+ import {
44
+ MdKitConflictPanel,
45
+ MdKitDocumentToolbar,
46
+ VersionHistoryPanel,
47
+ useMdKitDocument,
48
+ useMdKitDocumentVersions,
49
+ type MdKitDocumentAdapter,
50
+ } from "@mp-lb/mdkit";
51
+
52
+ function PlainTextDocument({
53
+ adapter,
54
+ documentId,
55
+ }: {
56
+ adapter: MdKitDocumentAdapter;
57
+ documentId: string;
58
+ }) {
59
+ const document = useMdKitDocument({
60
+ adapter,
61
+ debounceMs: 1000,
62
+ documentId,
63
+ });
64
+ const versions = useMdKitDocumentVersions({ adapter, documentId });
65
+
66
+ return (
67
+ <>
68
+ <MdKitDocumentToolbar document={document} versions={versions} />
69
+
70
+ <textarea
71
+ readOnly={document.conflict}
72
+ value={document.value}
73
+ onBlur={() => document.setFocused(false)}
74
+ onChange={(event) => document.setContent(event.currentTarget.value)}
75
+ onFocus={() => document.setFocused(true)}
76
+ />
77
+
78
+ <MdKitConflictPanel document={document} />
79
+ <VersionHistoryPanel controller={versions} />
80
+ </>
81
+ );
82
+ }
83
+ ```
84
+
85
+ Use the same backend adapter you would use for markdown. The document content is
86
+ still just `content: string`.
87
+
88
+ ## Backend Shape
89
+
90
+ You do not need a separate backend for plain text documents. A single MDKit
91
+ backend can expose:
92
+
93
+ - document read/write
94
+ - checkpoint list/read/restore
95
+ - optional collaboration websocket routes
96
+ - optional collaboration state persistence
97
+
98
+ Plain text editors use the document and checkpoint APIs. Markdown collaborative
99
+ editors additionally use the collaboration websocket and Yjs persistence.
100
+
101
+ The underlying database layout is application-owned. It is reasonable to store
102
+ markdown and plain text documents in the same documents table, or in separate
103
+ tables if your product needs that. MDKit only requires a stable `documentId`,
104
+ `content`, and an opaque revision token.
105
+
106
+ ## Collaboration Boundary
107
+
108
+ Do not pass `useMdKitCollaboration` to a plain text editor. The current
109
+ collaboration adapter is for `MdKitEditor` because that editor knows how to bind
110
+ Tiptap to a Yjs document and render remote cursors.
111
+
112
+ For plain text documents:
113
+
114
+ - keep using `useMdKitDocument`
115
+ - omit `useMdKitCollaboration`
116
+ - omit collaboration UI
117
+ - rely on optimistic conflicts and resync for multi-client safety
118
+
119
+ If MDKit later adds a collaboration-capable CodeMirror, Monaco, or textarea
120
+ adapter, that should be a new editor-specific capability. The generic text
121
+ workflow does not need to change.
122
+
123
+ ## Testbench
124
+
125
+ The testbench includes a connected stack named
126
+ `Storage + checkpoints (plain text)`. It reuses the same checkpoints backend as
127
+ the markdown stack, stores content under `docs/plain-text.txt`, and renders a
128
+ controlled textarea instead of `MdKitEditor`.
129
+
130
+ Use it to verify that plain text can autosave, create checkpoints, restore
131
+ history, and avoid collaboration UI.
package/docs/shadcn.md CHANGED
@@ -46,7 +46,11 @@ import { MdKitConnectedWorkflow } from "@/components/mdkit/mdkit-connected-workf
46
46
  export function EditorScreen() {
47
47
  const client = createMdKitTrpcClient({ url: "/trpc" });
48
48
  const adapter = createMdKitTrpcAdapter({ client });
49
- const document = useMdKitDocument({ adapter, documentId });
49
+ const document = useMdKitDocument({
50
+ adapter,
51
+ debounceMs: 1000,
52
+ documentId,
53
+ });
50
54
  const versions = useMdKitDocumentVersions({ adapter, documentId });
51
55
 
52
56
  const collaboration = useMdKitCollaboration({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mp-lb/mdkit",
3
- "version": "0.2.4",
3
+ "version": "0.2.5-main.27.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -11,6 +11,7 @@
11
11
  "!dist/**/*.test.d.ts",
12
12
  "!dist/**/*.test.js",
13
13
  "!dist/test",
14
+ "!docs/.vitepress/cache",
14
15
  "!docs/.vitepress/dist"
15
16
  ],
16
17
  "exports": {
@@ -1,275 +0,0 @@
1
- import {
2
- useMediaQuery
3
- } from "./chunk-PM3I3KHC.js";
4
- import {
5
- computed,
6
- ref,
7
- shallowRef,
8
- watch
9
- } from "./chunk-VSHFF4ZG.js";
10
-
11
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/index.js
12
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/fonts.css";
13
-
14
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/without-fonts.js
15
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/vars.css";
16
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/base.css";
17
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/icons.css";
18
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/utils.css";
19
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/components/custom-block.css";
20
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code.css";
21
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code-group.css";
22
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/components/vp-doc.css";
23
- import "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/styles/components/vp-sponsor.css";
24
- import VPBadge from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
25
- import Layout from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/Layout.vue";
26
- import { default as default2 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
27
- import { default as default3 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPButton.vue";
28
- import { default as default4 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPDocAsideSponsors.vue";
29
- import { default as default5 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPFeatures.vue";
30
- import { default as default6 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPHomeContent.vue";
31
- import { default as default7 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPHomeFeatures.vue";
32
- import { default as default8 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPHomeHero.vue";
33
- import { default as default9 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPHomeSponsors.vue";
34
- import { default as default10 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPImage.vue";
35
- import { default as default11 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPLink.vue";
36
- import { default as default12 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPNavBarSearch.vue";
37
- import { default as default13 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPSocialLink.vue";
38
- import { default as default14 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPSocialLinks.vue";
39
- import { default as default15 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPSponsors.vue";
40
- import { default as default16 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPTeamMembers.vue";
41
- import { default as default17 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPTeamPage.vue";
42
- import { default as default18 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageSection.vue";
43
- import { default as default19 } from "/Users/felixsebastian/Code/mdkit/node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageTitle.vue";
44
-
45
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/local-nav.js
46
- import { onContentUpdated } from "vitepress";
47
-
48
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/outline.js
49
- import { getScrollOffset } from "vitepress";
50
-
51
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/support/utils.js
52
- import { withBase } from "vitepress";
53
-
54
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/data.js
55
- import { useData as useData$ } from "vitepress";
56
- var useData = useData$;
57
-
58
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/support/utils.js
59
- function ensureStartingSlash(path) {
60
- return path.startsWith("/") ? path : `/${path}`;
61
- }
62
-
63
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/support/sidebar.js
64
- function getSidebar(_sidebar, path) {
65
- if (Array.isArray(_sidebar))
66
- return addBase(_sidebar);
67
- if (_sidebar == null)
68
- return [];
69
- path = ensureStartingSlash(path);
70
- const dir = Object.keys(_sidebar).sort((a, b) => {
71
- return b.split("/").length - a.split("/").length;
72
- }).find((dir2) => {
73
- return path.startsWith(ensureStartingSlash(dir2));
74
- });
75
- const sidebar = dir ? _sidebar[dir] : [];
76
- return Array.isArray(sidebar) ? addBase(sidebar) : addBase(sidebar.items, sidebar.base);
77
- }
78
- function getSidebarGroups(sidebar) {
79
- const groups = [];
80
- let lastGroupIndex = 0;
81
- for (const index in sidebar) {
82
- const item = sidebar[index];
83
- if (item.items) {
84
- lastGroupIndex = groups.push(item);
85
- continue;
86
- }
87
- if (!groups[lastGroupIndex]) {
88
- groups.push({ items: [] });
89
- }
90
- groups[lastGroupIndex].items.push(item);
91
- }
92
- return groups;
93
- }
94
- function addBase(items, _base) {
95
- return [...items].map((_item) => {
96
- const item = { ..._item };
97
- const base = item.base || _base;
98
- if (base && item.link)
99
- item.link = base + item.link;
100
- if (item.items)
101
- item.items = addBase(item.items, base);
102
- return item;
103
- });
104
- }
105
-
106
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/sidebar.js
107
- function useSidebar() {
108
- const { frontmatter, page, theme: theme2 } = useData();
109
- const is960 = useMediaQuery("(min-width: 960px)");
110
- const isOpen = ref(false);
111
- const _sidebar = computed(() => {
112
- const sidebarConfig = theme2.value.sidebar;
113
- const relativePath = page.value.relativePath;
114
- return sidebarConfig ? getSidebar(sidebarConfig, relativePath) : [];
115
- });
116
- const sidebar = ref(_sidebar.value);
117
- watch(_sidebar, (next, prev) => {
118
- if (JSON.stringify(next) !== JSON.stringify(prev))
119
- sidebar.value = _sidebar.value;
120
- });
121
- const hasSidebar = computed(() => {
122
- return frontmatter.value.sidebar !== false && sidebar.value.length > 0 && frontmatter.value.layout !== "home";
123
- });
124
- const leftAside = computed(() => {
125
- if (hasAside)
126
- return frontmatter.value.aside == null ? theme2.value.aside === "left" : frontmatter.value.aside === "left";
127
- return false;
128
- });
129
- const hasAside = computed(() => {
130
- if (frontmatter.value.layout === "home")
131
- return false;
132
- if (frontmatter.value.aside != null)
133
- return !!frontmatter.value.aside;
134
- return theme2.value.aside !== false;
135
- });
136
- const isSidebarEnabled = computed(() => hasSidebar.value && is960.value);
137
- const sidebarGroups = computed(() => {
138
- return hasSidebar.value ? getSidebarGroups(sidebar.value) : [];
139
- });
140
- function open() {
141
- isOpen.value = true;
142
- }
143
- function close() {
144
- isOpen.value = false;
145
- }
146
- function toggle() {
147
- isOpen.value ? close() : open();
148
- }
149
- return {
150
- isOpen,
151
- sidebar,
152
- sidebarGroups,
153
- hasSidebar,
154
- hasAside,
155
- leftAside,
156
- isSidebarEnabled,
157
- open,
158
- close,
159
- toggle
160
- };
161
- }
162
-
163
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/outline.js
164
- var ignoreRE = /\b(?:VPBadge|header-anchor|footnote-ref|ignore-header)\b/;
165
- var resolvedHeaders = [];
166
- function getHeaders(range) {
167
- const headers = [
168
- ...document.querySelectorAll(".VPDoc :where(h1,h2,h3,h4,h5,h6)")
169
- ].filter((el) => el.id && el.hasChildNodes()).map((el) => {
170
- const level = Number(el.tagName[1]);
171
- return {
172
- element: el,
173
- title: serializeHeader(el),
174
- link: "#" + el.id,
175
- level
176
- };
177
- });
178
- return resolveHeaders(headers, range);
179
- }
180
- function serializeHeader(h) {
181
- let ret = "";
182
- for (const node of h.childNodes) {
183
- if (node.nodeType === 1) {
184
- if (ignoreRE.test(node.className))
185
- continue;
186
- ret += node.textContent;
187
- } else if (node.nodeType === 3) {
188
- ret += node.textContent;
189
- }
190
- }
191
- return ret.trim();
192
- }
193
- function resolveHeaders(headers, range) {
194
- if (range === false) {
195
- return [];
196
- }
197
- const levelsRange = (typeof range === "object" && !Array.isArray(range) ? range.level : range) || 2;
198
- const [high, low] = typeof levelsRange === "number" ? [levelsRange, levelsRange] : levelsRange === "deep" ? [2, 6] : levelsRange;
199
- return buildTree(headers, high, low);
200
- }
201
- function buildTree(data, min, max) {
202
- resolvedHeaders.length = 0;
203
- const result = [];
204
- const stack = [];
205
- data.forEach((item) => {
206
- const node = { ...item, children: [] };
207
- let parent = stack[stack.length - 1];
208
- while (parent && parent.level >= node.level) {
209
- stack.pop();
210
- parent = stack[stack.length - 1];
211
- }
212
- if (node.element.classList.contains("ignore-header") || parent && "shouldIgnore" in parent) {
213
- stack.push({ level: node.level, shouldIgnore: true });
214
- return;
215
- }
216
- if (node.level > max || node.level < min)
217
- return;
218
- resolvedHeaders.push({ element: node.element, link: node.link });
219
- if (parent)
220
- parent.children.push(node);
221
- else
222
- result.push(node);
223
- stack.push(node);
224
- });
225
- return result;
226
- }
227
-
228
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/local-nav.js
229
- function useLocalNav() {
230
- const { theme: theme2, frontmatter } = useData();
231
- const headers = shallowRef([]);
232
- const hasLocalNav = computed(() => {
233
- return headers.value.length > 0;
234
- });
235
- onContentUpdated(() => {
236
- headers.value = getHeaders(frontmatter.value.outline ?? theme2.value.outline);
237
- });
238
- return {
239
- headers,
240
- hasLocalNav
241
- };
242
- }
243
-
244
- // ../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/without-fonts.js
245
- var theme = {
246
- Layout,
247
- enhanceApp: ({ app }) => {
248
- app.component("Badge", VPBadge);
249
- }
250
- };
251
- var without_fonts_default = theme;
252
- export {
253
- default2 as VPBadge,
254
- default3 as VPButton,
255
- default4 as VPDocAsideSponsors,
256
- default5 as VPFeatures,
257
- default6 as VPHomeContent,
258
- default7 as VPHomeFeatures,
259
- default8 as VPHomeHero,
260
- default9 as VPHomeSponsors,
261
- default10 as VPImage,
262
- default11 as VPLink,
263
- default12 as VPNavBarSearch,
264
- default13 as VPSocialLink,
265
- default14 as VPSocialLinks,
266
- default15 as VPSponsors,
267
- default16 as VPTeamMembers,
268
- default17 as VPTeamPage,
269
- default18 as VPTeamPageSection,
270
- default19 as VPTeamPageTitle,
271
- without_fonts_default as default,
272
- useLocalNav,
273
- useSidebar
274
- };
275
- //# sourceMappingURL=@theme_index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/index.js", "../../../../../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/without-fonts.js", "../../../../../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/local-nav.js", "../../../../../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/outline.js", "../../../../../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/support/utils.js", "../../../../../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/data.js", "../../../../../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/support/sidebar.js", "../../../../../../node_modules/.pnpm/vitepress@1.6.4_@algolia+client-search@5.52.0_@types+node@25.6.0_@types+react@19.2.5_li_a6155559e07cf809c14da17cb379ee3a/node_modules/vitepress/dist/client/theme-default/composables/sidebar.js"],
4
- "sourcesContent": ["import './styles/fonts.css';\nexport * from './without-fonts';\nexport { default as default } from './without-fonts';\n", "import './styles/vars.css';\nimport './styles/base.css';\nimport './styles/icons.css';\nimport './styles/utils.css';\nimport './styles/components/custom-block.css';\nimport './styles/components/vp-code.css';\nimport './styles/components/vp-code-group.css';\nimport './styles/components/vp-doc.css';\nimport './styles/components/vp-sponsor.css';\nimport VPBadge from './components/VPBadge.vue';\nimport Layout from './Layout.vue';\nexport { default as VPBadge } from './components/VPBadge.vue';\nexport { default as VPButton } from './components/VPButton.vue';\nexport { default as VPDocAsideSponsors } from './components/VPDocAsideSponsors.vue';\nexport { default as VPFeatures } from './components/VPFeatures.vue';\nexport { default as VPHomeContent } from './components/VPHomeContent.vue';\nexport { default as VPHomeFeatures } from './components/VPHomeFeatures.vue';\nexport { default as VPHomeHero } from './components/VPHomeHero.vue';\nexport { default as VPHomeSponsors } from './components/VPHomeSponsors.vue';\nexport { default as VPImage } from './components/VPImage.vue';\nexport { default as VPLink } from './components/VPLink.vue';\nexport { default as VPNavBarSearch } from './components/VPNavBarSearch.vue';\nexport { default as VPSocialLink } from './components/VPSocialLink.vue';\nexport { default as VPSocialLinks } from './components/VPSocialLinks.vue';\nexport { default as VPSponsors } from './components/VPSponsors.vue';\nexport { default as VPTeamMembers } from './components/VPTeamMembers.vue';\nexport { default as VPTeamPage } from './components/VPTeamPage.vue';\nexport { default as VPTeamPageSection } from './components/VPTeamPageSection.vue';\nexport { default as VPTeamPageTitle } from './components/VPTeamPageTitle.vue';\nexport { useLocalNav } from './composables/local-nav';\nexport { useSidebar } from './composables/sidebar';\nconst theme = {\n Layout,\n enhanceApp: ({ app }) => {\n app.component('Badge', VPBadge);\n }\n};\nexport default theme;\n", "import { onContentUpdated } from 'vitepress';\nimport { computed, shallowRef } from 'vue';\nimport { getHeaders } from '../composables/outline';\nimport { useData } from './data';\nexport function useLocalNav() {\n const { theme, frontmatter } = useData();\n const headers = shallowRef([]);\n const hasLocalNav = computed(() => {\n return headers.value.length > 0;\n });\n onContentUpdated(() => {\n headers.value = getHeaders(frontmatter.value.outline ?? theme.value.outline);\n });\n return {\n headers,\n hasLocalNav\n };\n}\n", "import { getScrollOffset } from 'vitepress';\nimport { onMounted, onUnmounted, onUpdated } from 'vue';\nimport { throttleAndDebounce } from '../support/utils';\nimport { useAside } from './aside';\nconst ignoreRE = /\\b(?:VPBadge|header-anchor|footnote-ref|ignore-header)\\b/;\n// cached list of anchor elements from resolveHeaders\nconst resolvedHeaders = [];\nexport function resolveTitle(theme) {\n return ((typeof theme.outline === 'object' &&\n !Array.isArray(theme.outline) &&\n theme.outline.label) ||\n theme.outlineTitle ||\n 'On this page');\n}\nexport function getHeaders(range) {\n const headers = [\n ...document.querySelectorAll('.VPDoc :where(h1,h2,h3,h4,h5,h6)')\n ]\n .filter((el) => el.id && el.hasChildNodes())\n .map((el) => {\n const level = Number(el.tagName[1]);\n return {\n element: el,\n title: serializeHeader(el),\n link: '#' + el.id,\n level\n };\n });\n return resolveHeaders(headers, range);\n}\nfunction serializeHeader(h) {\n let ret = '';\n for (const node of h.childNodes) {\n if (node.nodeType === 1) {\n if (ignoreRE.test(node.className))\n continue;\n ret += node.textContent;\n }\n else if (node.nodeType === 3) {\n ret += node.textContent;\n }\n }\n return ret.trim();\n}\nexport function resolveHeaders(headers, range) {\n if (range === false) {\n return [];\n }\n const levelsRange = (typeof range === 'object' && !Array.isArray(range)\n ? range.level\n : range) || 2;\n const [high, low] = typeof levelsRange === 'number'\n ? [levelsRange, levelsRange]\n : levelsRange === 'deep'\n ? [2, 6]\n : levelsRange;\n return buildTree(headers, high, low);\n}\nexport function useActiveAnchor(container, marker) {\n const { isAsideEnabled } = useAside();\n const onScroll = throttleAndDebounce(setActiveLink, 100);\n let prevActiveLink = null;\n onMounted(() => {\n requestAnimationFrame(setActiveLink);\n window.addEventListener('scroll', onScroll);\n });\n onUpdated(() => {\n // sidebar update means a route change\n activateLink(location.hash);\n });\n onUnmounted(() => {\n window.removeEventListener('scroll', onScroll);\n });\n function setActiveLink() {\n if (!isAsideEnabled.value) {\n return;\n }\n const scrollY = window.scrollY;\n const innerHeight = window.innerHeight;\n const offsetHeight = document.body.offsetHeight;\n const isBottom = Math.abs(scrollY + innerHeight - offsetHeight) < 1;\n // resolvedHeaders may be repositioned, hidden or fix positioned\n const headers = resolvedHeaders\n .map(({ element, link }) => ({\n link,\n top: getAbsoluteTop(element)\n }))\n .filter(({ top }) => !Number.isNaN(top))\n .sort((a, b) => a.top - b.top);\n // no headers available for active link\n if (!headers.length) {\n activateLink(null);\n return;\n }\n // page top\n if (scrollY < 1) {\n activateLink(null);\n return;\n }\n // page bottom - highlight last link\n if (isBottom) {\n activateLink(headers[headers.length - 1].link);\n return;\n }\n // find the last header above the top of viewport\n let activeLink = null;\n for (const { link, top } of headers) {\n if (top > scrollY + getScrollOffset() + 4) {\n break;\n }\n activeLink = link;\n }\n activateLink(activeLink);\n }\n function activateLink(hash) {\n if (prevActiveLink) {\n prevActiveLink.classList.remove('active');\n }\n if (hash == null) {\n prevActiveLink = null;\n }\n else {\n prevActiveLink = container.value.querySelector(`a[href=\"${decodeURIComponent(hash)}\"]`);\n }\n const activeLink = prevActiveLink;\n if (activeLink) {\n activeLink.classList.add('active');\n marker.value.style.top = activeLink.offsetTop + 39 + 'px';\n marker.value.style.opacity = '1';\n }\n else {\n marker.value.style.top = '33px';\n marker.value.style.opacity = '0';\n }\n }\n}\nfunction getAbsoluteTop(element) {\n let offsetTop = 0;\n while (element !== document.body) {\n if (element === null) {\n // child element is:\n // - not attached to the DOM (display: none)\n // - set to fixed position (not scrollable)\n // - body or html element (null offsetParent)\n return NaN;\n }\n offsetTop += element.offsetTop;\n element = element.offsetParent;\n }\n return offsetTop;\n}\nfunction buildTree(data, min, max) {\n resolvedHeaders.length = 0;\n const result = [];\n const stack = [];\n data.forEach((item) => {\n const node = { ...item, children: [] };\n let parent = stack[stack.length - 1];\n while (parent && parent.level >= node.level) {\n stack.pop();\n parent = stack[stack.length - 1];\n }\n if (node.element.classList.contains('ignore-header') ||\n (parent && 'shouldIgnore' in parent)) {\n stack.push({ level: node.level, shouldIgnore: true });\n return;\n }\n if (node.level > max || node.level < min)\n return;\n resolvedHeaders.push({ element: node.element, link: node.link });\n if (parent)\n parent.children.push(node);\n else\n result.push(node);\n stack.push(node);\n });\n return result;\n}\n", "import { withBase } from 'vitepress';\nimport { isExternal, treatAsHtml } from '../../shared';\nimport { useData } from '../composables/data';\nexport function throttleAndDebounce(fn, delay) {\n let timeoutId;\n let called = false;\n return () => {\n if (timeoutId)\n clearTimeout(timeoutId);\n if (!called) {\n fn();\n (called = true) && setTimeout(() => (called = false), delay);\n }\n else\n timeoutId = setTimeout(fn, delay);\n };\n}\nexport function ensureStartingSlash(path) {\n return path.startsWith('/') ? path : `/${path}`;\n}\nexport function normalizeLink(url) {\n const { pathname, search, hash, protocol } = new URL(url, 'http://a.com');\n if (isExternal(url) ||\n url.startsWith('#') ||\n !protocol.startsWith('http') ||\n !treatAsHtml(pathname))\n return url;\n const { site } = useData();\n const normalizedPath = pathname.endsWith('/') || pathname.endsWith('.html')\n ? url\n : url.replace(/(?:(^\\.+)\\/)?.*$/, `$1${pathname.replace(/(\\.md)?$/, site.value.cleanUrls ? '' : '.html')}${search}${hash}`);\n return withBase(normalizedPath);\n}\n", "import { useData as useData$ } from 'vitepress';\nexport const useData = useData$;\n", "import { isActive } from '../../shared';\nimport { ensureStartingSlash } from './utils';\n/**\n * Get the `Sidebar` from sidebar option. This method will ensure to get correct\n * sidebar config from `MultiSideBarConfig` with various path combinations such\n * as matching `guide/` and `/guide/`. If no matching config was found, it will\n * return empty array.\n */\nexport function getSidebar(_sidebar, path) {\n if (Array.isArray(_sidebar))\n return addBase(_sidebar);\n if (_sidebar == null)\n return [];\n path = ensureStartingSlash(path);\n const dir = Object.keys(_sidebar)\n .sort((a, b) => {\n return b.split('/').length - a.split('/').length;\n })\n .find((dir) => {\n // make sure the multi sidebar key starts with slash too\n return path.startsWith(ensureStartingSlash(dir));\n });\n const sidebar = dir ? _sidebar[dir] : [];\n return Array.isArray(sidebar)\n ? addBase(sidebar)\n : addBase(sidebar.items, sidebar.base);\n}\n/**\n * Get or generate sidebar group from the given sidebar items.\n */\nexport function getSidebarGroups(sidebar) {\n const groups = [];\n let lastGroupIndex = 0;\n for (const index in sidebar) {\n const item = sidebar[index];\n if (item.items) {\n lastGroupIndex = groups.push(item);\n continue;\n }\n if (!groups[lastGroupIndex]) {\n groups.push({ items: [] });\n }\n groups[lastGroupIndex].items.push(item);\n }\n return groups;\n}\nexport function getFlatSideBarLinks(sidebar) {\n const links = [];\n function recursivelyExtractLinks(items) {\n for (const item of items) {\n if (item.text && item.link) {\n links.push({\n text: item.text,\n link: item.link,\n docFooterText: item.docFooterText\n });\n }\n if (item.items) {\n recursivelyExtractLinks(item.items);\n }\n }\n }\n recursivelyExtractLinks(sidebar);\n return links;\n}\n/**\n * Check if the given sidebar item contains any active link.\n */\nexport function hasActiveLink(path, items) {\n if (Array.isArray(items)) {\n return items.some((item) => hasActiveLink(path, item));\n }\n return isActive(path, items.link)\n ? true\n : items.items\n ? hasActiveLink(path, items.items)\n : false;\n}\nfunction addBase(items, _base) {\n return [...items].map((_item) => {\n const item = { ..._item };\n const base = item.base || _base;\n if (base && item.link)\n item.link = base + item.link;\n if (item.items)\n item.items = addBase(item.items, base);\n return item;\n });\n}\n", "import { useMediaQuery } from '@vueuse/core';\nimport { computed, onMounted, onUnmounted, ref, watch, watchEffect, watchPostEffect } from 'vue';\nimport { isActive } from '../../shared';\nimport { hasActiveLink as containsActiveLink, getSidebar, getSidebarGroups } from '../support/sidebar';\nimport { useData } from './data';\nexport function useSidebar() {\n const { frontmatter, page, theme } = useData();\n const is960 = useMediaQuery('(min-width: 960px)');\n const isOpen = ref(false);\n const _sidebar = computed(() => {\n const sidebarConfig = theme.value.sidebar;\n const relativePath = page.value.relativePath;\n return sidebarConfig ? getSidebar(sidebarConfig, relativePath) : [];\n });\n const sidebar = ref(_sidebar.value);\n watch(_sidebar, (next, prev) => {\n if (JSON.stringify(next) !== JSON.stringify(prev))\n sidebar.value = _sidebar.value;\n });\n const hasSidebar = computed(() => {\n return (frontmatter.value.sidebar !== false &&\n sidebar.value.length > 0 &&\n frontmatter.value.layout !== 'home');\n });\n const leftAside = computed(() => {\n if (hasAside)\n return frontmatter.value.aside == null\n ? theme.value.aside === 'left'\n : frontmatter.value.aside === 'left';\n return false;\n });\n const hasAside = computed(() => {\n if (frontmatter.value.layout === 'home')\n return false;\n if (frontmatter.value.aside != null)\n return !!frontmatter.value.aside;\n return theme.value.aside !== false;\n });\n const isSidebarEnabled = computed(() => hasSidebar.value && is960.value);\n const sidebarGroups = computed(() => {\n return hasSidebar.value ? getSidebarGroups(sidebar.value) : [];\n });\n function open() {\n isOpen.value = true;\n }\n function close() {\n isOpen.value = false;\n }\n function toggle() {\n isOpen.value ? close() : open();\n }\n return {\n isOpen,\n sidebar,\n sidebarGroups,\n hasSidebar,\n hasAside,\n leftAside,\n isSidebarEnabled,\n open,\n close,\n toggle\n };\n}\n/**\n * a11y: cache the element that opened the Sidebar (the menu button) then\n * focus that button again when Menu is closed with Escape key.\n */\nexport function useCloseSidebarOnEscape(isOpen, close) {\n let triggerElement;\n watchEffect(() => {\n triggerElement = isOpen.value\n ? document.activeElement\n : undefined;\n });\n onMounted(() => {\n window.addEventListener('keyup', onEscape);\n });\n onUnmounted(() => {\n window.removeEventListener('keyup', onEscape);\n });\n function onEscape(e) {\n if (e.key === 'Escape' && isOpen.value) {\n close();\n triggerElement?.focus();\n }\n }\n}\nexport function useSidebarControl(item) {\n const { page, hash } = useData();\n const collapsed = ref(false);\n const collapsible = computed(() => {\n return item.value.collapsed != null;\n });\n const isLink = computed(() => {\n return !!item.value.link;\n });\n const isActiveLink = ref(false);\n const updateIsActiveLink = () => {\n isActiveLink.value = isActive(page.value.relativePath, item.value.link);\n };\n watch([page, item, hash], updateIsActiveLink);\n onMounted(updateIsActiveLink);\n const hasActiveLink = computed(() => {\n if (isActiveLink.value) {\n return true;\n }\n return item.value.items\n ? containsActiveLink(page.value.relativePath, item.value.items)\n : false;\n });\n const hasChildren = computed(() => {\n return !!(item.value.items && item.value.items.length);\n });\n watchEffect(() => {\n collapsed.value = !!(collapsible.value && item.value.collapsed);\n });\n watchPostEffect(() => {\n ;\n (isActiveLink.value || hasActiveLink.value) && (collapsed.value = false);\n });\n function toggle() {\n if (collapsible.value) {\n collapsed.value = !collapsed.value;\n }\n }\n return {\n collapsed,\n collapsible,\n isLink,\n isActiveLink,\n hasAct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