vue3-sphinx-xml 0.1.0-beta.0
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/LICENSE +14 -0
- package/README.md +171 -0
- package/dist/BlockQuote.js +43 -0
- package/dist/BlockQuote.js.map +1 -0
- package/dist/CaptionNumber.js +71 -0
- package/dist/CaptionNumber.js.map +1 -0
- package/dist/ColumnGroup.js +44 -0
- package/dist/ColumnGroup.js.map +1 -0
- package/dist/Comment.js +34 -0
- package/dist/Comment.js.map +1 -0
- package/dist/Compound.js +39 -0
- package/dist/Compound.js.map +1 -0
- package/dist/Container.js +80 -0
- package/dist/Container.js.map +1 -0
- package/dist/DirectElementMap.js +22 -0
- package/dist/DirectElementMap.js.map +1 -0
- package/dist/DownloadReference.js +51 -0
- package/dist/DownloadReference.js.map +1 -0
- package/dist/Figure.js +55 -0
- package/dist/Figure.js.map +1 -0
- package/dist/FigureCaption.js +77 -0
- package/dist/FigureCaption.js.map +1 -0
- package/dist/Footnote.js +45 -0
- package/dist/Footnote.js.map +1 -0
- package/dist/FootnoteReference.js +49 -0
- package/dist/FootnoteReference.js.map +1 -0
- package/dist/Image.js +53 -0
- package/dist/Image.js.map +1 -0
- package/dist/Legend.js +45 -0
- package/dist/Legend.js.map +1 -0
- package/dist/LineBlock.js +45 -0
- package/dist/LineBlock.js.map +1 -0
- package/dist/LineSingle.js +46 -0
- package/dist/LineSingle.js.map +1 -0
- package/dist/Literal.js +56 -0
- package/dist/Literal.js.map +1 -0
- package/dist/LiteralBlock.js +50 -0
- package/dist/LiteralBlock.js.map +1 -0
- package/dist/Math.js +25 -0
- package/dist/Math.js.map +1 -0
- package/dist/MathBlock.js +77 -0
- package/dist/MathBlock.js.map +1 -0
- package/dist/Note.js +48 -0
- package/dist/Note.js.map +1 -0
- package/dist/NumberReference.js +60 -0
- package/dist/NumberReference.js.map +1 -0
- package/dist/Problematic.js +45 -0
- package/dist/Problematic.js.map +1 -0
- package/dist/Raw.js +10 -0
- package/dist/Raw.js.map +1 -0
- package/dist/Reference.js +49 -0
- package/dist/Reference.js.map +1 -0
- package/dist/Section.js +53 -0
- package/dist/Section.js.map +1 -0
- package/dist/StandardElement.js +99 -0
- package/dist/StandardElement.js.map +1 -0
- package/dist/Text.js +23 -0
- package/dist/Text.js.map +1 -0
- package/dist/Title.js +66 -0
- package/dist/Title.js.map +1 -0
- package/dist/TodoNode.js +54 -0
- package/dist/TodoNode.js.map +1 -0
- package/dist/Topic.js +49 -0
- package/dist/Topic.js.map +1 -0
- package/dist/Transition.js +9 -0
- package/dist/Transition.js.map +1 -0
- package/dist/basereference.js +42 -0
- package/dist/basereference.js.map +1 -0
- package/dist/entry.js +707 -0
- package/dist/entry.js.map +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.html +21 -0
- package/dist/methods.js +138 -0
- package/dist/methods.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/vue3-sphinx-xml.es.js +9 -0
- package/dist/vue3-sphinx-xml.es.js.map +1 -0
- package/package.json +48 -0
package/dist/entry.js
ADDED
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
import Vue3Katex from "@hsorby/vue3-katex";
|
|
2
|
+
import "katex/dist/katex.min.css";
|
|
3
|
+
import { openBlock, createElementBlock, createElementVNode, toDisplayString, pushScopeId, popScopeId, computed, defineAsyncComponent, toRefs, unref, Fragment, renderList, createBlock, resolveDynamicComponent, ref, watch } from "vue";
|
|
4
|
+
import { useRouter, useRoute } from "vue-router";
|
|
5
|
+
import { useStore } from "vuex";
|
|
6
|
+
import { pathToRegexp } from "path-to-regexp";
|
|
7
|
+
import axios from "axios";
|
|
8
|
+
const decodeHTML = (encoded) => {
|
|
9
|
+
let elem = document.createElement("textarea");
|
|
10
|
+
elem.innerHTML = encoded;
|
|
11
|
+
return elem.value;
|
|
12
|
+
};
|
|
13
|
+
const determineRouteUrl = (route) => {
|
|
14
|
+
const regex = pathToRegexp(route.matched[0].path);
|
|
15
|
+
let fullPath = route.fullPath;
|
|
16
|
+
if (route.hash) {
|
|
17
|
+
fullPath = fullPath.replace(route.hash, "");
|
|
18
|
+
}
|
|
19
|
+
const matched = fullPath.match(regex);
|
|
20
|
+
let base = matched[0];
|
|
21
|
+
if (matched[matched.length - 1]) {
|
|
22
|
+
base = matched[0].replace(`/${matched[matched.length - 1]}`, "");
|
|
23
|
+
}
|
|
24
|
+
return base;
|
|
25
|
+
};
|
|
26
|
+
const constructPageNameFromRoute = (route) => {
|
|
27
|
+
let pageName = void 0;
|
|
28
|
+
try {
|
|
29
|
+
pageName = route.params.pageName.join("/");
|
|
30
|
+
} catch (_) {
|
|
31
|
+
pageName = route.params.pageName;
|
|
32
|
+
}
|
|
33
|
+
return pageName;
|
|
34
|
+
};
|
|
35
|
+
const _hoisted_1$2 = /* @__PURE__ */ createElementVNode("span", null, "It seems the component was not found.", -1);
|
|
36
|
+
const _sfc_main$3 = {
|
|
37
|
+
props: {
|
|
38
|
+
node: {
|
|
39
|
+
type: void 0
|
|
40
|
+
},
|
|
41
|
+
componentName: {
|
|
42
|
+
type: String
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
setup(__props) {
|
|
46
|
+
return (_ctx, _cache) => {
|
|
47
|
+
return openBlock(), createElementBlock("div", null, [
|
|
48
|
+
createElementVNode("h3", null, "Missing: '" + toDisplayString(__props.componentName) + "' from Sphinx XML output", 1),
|
|
49
|
+
_hoisted_1$2
|
|
50
|
+
]);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var Loading_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
55
|
+
var _export_sfc = (sfc, props) => {
|
|
56
|
+
const target = sfc.__vccOpts || sfc;
|
|
57
|
+
for (const [key, val] of props) {
|
|
58
|
+
target[key] = val;
|
|
59
|
+
}
|
|
60
|
+
return target;
|
|
61
|
+
};
|
|
62
|
+
const _withScopeId = (n) => (pushScopeId("data-v-97cc632a"), n = n(), popScopeId(), n);
|
|
63
|
+
const _hoisted_1$1 = { class: "loading-container" };
|
|
64
|
+
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, "Loading page component", -1));
|
|
65
|
+
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "lds-roller" }, [
|
|
66
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
67
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
68
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
69
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
70
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
71
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
72
|
+
/* @__PURE__ */ createElementVNode("div"),
|
|
73
|
+
/* @__PURE__ */ createElementVNode("div")
|
|
74
|
+
], -1));
|
|
75
|
+
const _hoisted_4 = [
|
|
76
|
+
_hoisted_2,
|
|
77
|
+
_hoisted_3
|
|
78
|
+
];
|
|
79
|
+
const _sfc_main$2 = {
|
|
80
|
+
props: {
|
|
81
|
+
node: {
|
|
82
|
+
type: void 0
|
|
83
|
+
},
|
|
84
|
+
componentName: {
|
|
85
|
+
type: String
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
setup(__props) {
|
|
89
|
+
return (_ctx, _cache) => {
|
|
90
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, _hoisted_4);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var LoadingComponent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-97cc632a"]]);
|
|
95
|
+
const nodeNameTagNameMap = /* @__PURE__ */ new Map([
|
|
96
|
+
["bullet_list", "ul"],
|
|
97
|
+
["button", "button"],
|
|
98
|
+
["definition", "dd"],
|
|
99
|
+
["definition_list", "dl"],
|
|
100
|
+
["definition_list_item", "dt"],
|
|
101
|
+
["div", "div"],
|
|
102
|
+
["emphasis", "em"],
|
|
103
|
+
["enumerated_list", "ol"],
|
|
104
|
+
["glossary", "div"],
|
|
105
|
+
["inline", "span"],
|
|
106
|
+
["label", "span"],
|
|
107
|
+
["list_item", "li"],
|
|
108
|
+
["line", "p"],
|
|
109
|
+
["paragraph", "p"],
|
|
110
|
+
["rubric", "h3"],
|
|
111
|
+
["strong", "strong"],
|
|
112
|
+
["subscript", "sub"],
|
|
113
|
+
["superscript", "sup"],
|
|
114
|
+
["table", "table"],
|
|
115
|
+
["tbody", "tbody"],
|
|
116
|
+
["entry", "td"],
|
|
117
|
+
["row", "tr"],
|
|
118
|
+
["thead", "thead"],
|
|
119
|
+
["term", "dt"],
|
|
120
|
+
["title_reference", "cite"]
|
|
121
|
+
]);
|
|
122
|
+
const nodeNameTemplateNameMap = /* @__PURE__ */ new Map([
|
|
123
|
+
["#text", "Text"],
|
|
124
|
+
["block_quote", "BlockQuote"],
|
|
125
|
+
["caption", "FigureCaption"],
|
|
126
|
+
["caption_number", "CaptionNumber"],
|
|
127
|
+
["download_reference", "DownloadReference"],
|
|
128
|
+
["footnote_reference", "FootnoteReference"],
|
|
129
|
+
["line_block", "LineBlock"],
|
|
130
|
+
["literal_block", "LiteralBlock"],
|
|
131
|
+
["math_block", "MathBlock"],
|
|
132
|
+
["number_reference", "NumberReference"]
|
|
133
|
+
]);
|
|
134
|
+
function __variableDynamicImportRuntime1__(path) {
|
|
135
|
+
switch (path) {
|
|
136
|
+
case "../components/templates/BlockQuote.vue":
|
|
137
|
+
return import("./BlockQuote.js");
|
|
138
|
+
case "../components/templates/CaptionNumber.vue":
|
|
139
|
+
return import("./CaptionNumber.js");
|
|
140
|
+
case "../components/templates/ColumnGroup.vue":
|
|
141
|
+
return import("./ColumnGroup.js");
|
|
142
|
+
case "../components/templates/Comment.vue":
|
|
143
|
+
return import("./Comment.js");
|
|
144
|
+
case "../components/templates/Compound.vue":
|
|
145
|
+
return import("./Compound.js");
|
|
146
|
+
case "../components/templates/Container.vue":
|
|
147
|
+
return import("./Container.js");
|
|
148
|
+
case "../components/templates/DirectElementMap.vue":
|
|
149
|
+
return import("./DirectElementMap.js");
|
|
150
|
+
case "../components/templates/Document.vue":
|
|
151
|
+
return Promise.resolve().then(function() {
|
|
152
|
+
return Document;
|
|
153
|
+
});
|
|
154
|
+
case "../components/templates/DownloadReference.vue":
|
|
155
|
+
return import("./DownloadReference.js");
|
|
156
|
+
case "../components/templates/Figure.vue":
|
|
157
|
+
return import("./Figure.js");
|
|
158
|
+
case "../components/templates/FigureCaption.vue":
|
|
159
|
+
return import("./FigureCaption.js");
|
|
160
|
+
case "../components/templates/Footnote.vue":
|
|
161
|
+
return import("./Footnote.js");
|
|
162
|
+
case "../components/templates/FootnoteReference.vue":
|
|
163
|
+
return import("./FootnoteReference.js");
|
|
164
|
+
case "../components/templates/Image.vue":
|
|
165
|
+
return import("./Image.js");
|
|
166
|
+
case "../components/templates/Legend.vue":
|
|
167
|
+
return import("./Legend.js");
|
|
168
|
+
case "../components/templates/LineBlock.vue":
|
|
169
|
+
return import("./LineBlock.js");
|
|
170
|
+
case "../components/templates/LineSingle.vue":
|
|
171
|
+
return import("./LineSingle.js");
|
|
172
|
+
case "../components/templates/Literal.vue":
|
|
173
|
+
return import("./Literal.js");
|
|
174
|
+
case "../components/templates/LiteralBlock.vue":
|
|
175
|
+
return import("./LiteralBlock.js");
|
|
176
|
+
case "../components/templates/Math.vue":
|
|
177
|
+
return import("./Math.js");
|
|
178
|
+
case "../components/templates/MathBlock.vue":
|
|
179
|
+
return import("./MathBlock.js");
|
|
180
|
+
case "../components/templates/Note.vue":
|
|
181
|
+
return import("./Note.js");
|
|
182
|
+
case "../components/templates/NumberReference.vue":
|
|
183
|
+
return import("./NumberReference.js");
|
|
184
|
+
case "../components/templates/Problematic.vue":
|
|
185
|
+
return import("./Problematic.js");
|
|
186
|
+
case "../components/templates/Raw.vue":
|
|
187
|
+
return import("./Raw.js");
|
|
188
|
+
case "../components/templates/Reference.vue":
|
|
189
|
+
return import("./Reference.js");
|
|
190
|
+
case "../components/templates/Section.vue":
|
|
191
|
+
return import("./Section.js");
|
|
192
|
+
case "../components/templates/StandardElement.vue":
|
|
193
|
+
return import("./StandardElement.js");
|
|
194
|
+
case "../components/templates/Text.vue":
|
|
195
|
+
return import("./Text.js");
|
|
196
|
+
case "../components/templates/Title.vue":
|
|
197
|
+
return import("./Title.js");
|
|
198
|
+
case "../components/templates/TodoNode.vue":
|
|
199
|
+
return import("./TodoNode.js");
|
|
200
|
+
case "../components/templates/Topic.vue":
|
|
201
|
+
return import("./Topic.js");
|
|
202
|
+
case "../components/templates/Transition.vue":
|
|
203
|
+
return import("./Transition.js");
|
|
204
|
+
default:
|
|
205
|
+
return new Promise(function(resolve, reject) {
|
|
206
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function __variableDynamicImportRuntime0__(path) {
|
|
211
|
+
switch (path) {
|
|
212
|
+
case "../components/templates/BlockQuote.vue":
|
|
213
|
+
return import("./BlockQuote.js");
|
|
214
|
+
case "../components/templates/CaptionNumber.vue":
|
|
215
|
+
return import("./CaptionNumber.js");
|
|
216
|
+
case "../components/templates/ColumnGroup.vue":
|
|
217
|
+
return import("./ColumnGroup.js");
|
|
218
|
+
case "../components/templates/Comment.vue":
|
|
219
|
+
return import("./Comment.js");
|
|
220
|
+
case "../components/templates/Compound.vue":
|
|
221
|
+
return import("./Compound.js");
|
|
222
|
+
case "../components/templates/Container.vue":
|
|
223
|
+
return import("./Container.js");
|
|
224
|
+
case "../components/templates/DirectElementMap.vue":
|
|
225
|
+
return import("./DirectElementMap.js");
|
|
226
|
+
case "../components/templates/Document.vue":
|
|
227
|
+
return Promise.resolve().then(function() {
|
|
228
|
+
return Document;
|
|
229
|
+
});
|
|
230
|
+
case "../components/templates/DownloadReference.vue":
|
|
231
|
+
return import("./DownloadReference.js");
|
|
232
|
+
case "../components/templates/Figure.vue":
|
|
233
|
+
return import("./Figure.js");
|
|
234
|
+
case "../components/templates/FigureCaption.vue":
|
|
235
|
+
return import("./FigureCaption.js");
|
|
236
|
+
case "../components/templates/Footnote.vue":
|
|
237
|
+
return import("./Footnote.js");
|
|
238
|
+
case "../components/templates/FootnoteReference.vue":
|
|
239
|
+
return import("./FootnoteReference.js");
|
|
240
|
+
case "../components/templates/Image.vue":
|
|
241
|
+
return import("./Image.js");
|
|
242
|
+
case "../components/templates/Legend.vue":
|
|
243
|
+
return import("./Legend.js");
|
|
244
|
+
case "../components/templates/LineBlock.vue":
|
|
245
|
+
return import("./LineBlock.js");
|
|
246
|
+
case "../components/templates/LineSingle.vue":
|
|
247
|
+
return import("./LineSingle.js");
|
|
248
|
+
case "../components/templates/Literal.vue":
|
|
249
|
+
return import("./Literal.js");
|
|
250
|
+
case "../components/templates/LiteralBlock.vue":
|
|
251
|
+
return import("./LiteralBlock.js");
|
|
252
|
+
case "../components/templates/Math.vue":
|
|
253
|
+
return import("./Math.js");
|
|
254
|
+
case "../components/templates/MathBlock.vue":
|
|
255
|
+
return import("./MathBlock.js");
|
|
256
|
+
case "../components/templates/Note.vue":
|
|
257
|
+
return import("./Note.js");
|
|
258
|
+
case "../components/templates/NumberReference.vue":
|
|
259
|
+
return import("./NumberReference.js");
|
|
260
|
+
case "../components/templates/Problematic.vue":
|
|
261
|
+
return import("./Problematic.js");
|
|
262
|
+
case "../components/templates/Raw.vue":
|
|
263
|
+
return import("./Raw.js");
|
|
264
|
+
case "../components/templates/Reference.vue":
|
|
265
|
+
return import("./Reference.js");
|
|
266
|
+
case "../components/templates/Section.vue":
|
|
267
|
+
return import("./Section.js");
|
|
268
|
+
case "../components/templates/StandardElement.vue":
|
|
269
|
+
return import("./StandardElement.js");
|
|
270
|
+
case "../components/templates/Text.vue":
|
|
271
|
+
return import("./Text.js");
|
|
272
|
+
case "../components/templates/Title.vue":
|
|
273
|
+
return import("./Title.js");
|
|
274
|
+
case "../components/templates/TodoNode.vue":
|
|
275
|
+
return import("./TodoNode.js");
|
|
276
|
+
case "../components/templates/Topic.vue":
|
|
277
|
+
return import("./Topic.js");
|
|
278
|
+
case "../components/templates/Transition.vue":
|
|
279
|
+
return import("./Transition.js");
|
|
280
|
+
default:
|
|
281
|
+
return new Promise(function(resolve, reject) {
|
|
282
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function defineChildComponent(name, node) {
|
|
287
|
+
let properties = void 0;
|
|
288
|
+
if (node.nodeName === "#text") {
|
|
289
|
+
if (!node.nodeValue.trim()) {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
properties = {
|
|
293
|
+
text: node.nodeValue
|
|
294
|
+
};
|
|
295
|
+
} else if (node.nodeName === "title") {
|
|
296
|
+
let parentNode = node.parentNode;
|
|
297
|
+
let depth = 0;
|
|
298
|
+
let isTopic = false;
|
|
299
|
+
if (parentNode.nodeName === "topic") {
|
|
300
|
+
isTopic = true;
|
|
301
|
+
} else {
|
|
302
|
+
while (parentNode) {
|
|
303
|
+
if (parentNode.nodeName === "section") {
|
|
304
|
+
depth += 1;
|
|
305
|
+
}
|
|
306
|
+
parentNode = parentNode.parentNode;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
properties = {
|
|
310
|
+
depth,
|
|
311
|
+
isTopic
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
const component = defineAsyncComponent({
|
|
315
|
+
loader: () => {
|
|
316
|
+
return __variableDynamicImportRuntime0__(`../components/templates/${name}.vue`);
|
|
317
|
+
},
|
|
318
|
+
loadingComponent: LoadingComponent,
|
|
319
|
+
errorComponent: _sfc_main$3
|
|
320
|
+
});
|
|
321
|
+
return {
|
|
322
|
+
component,
|
|
323
|
+
name,
|
|
324
|
+
node,
|
|
325
|
+
properties
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function defineColgroupComponent(node, colspecs) {
|
|
329
|
+
const name = "ColumnGroup";
|
|
330
|
+
const component = defineAsyncComponent({
|
|
331
|
+
loader: () => {
|
|
332
|
+
return __variableDynamicImportRuntime1__(`../components/templates/${name}.vue`);
|
|
333
|
+
},
|
|
334
|
+
loadingComponent: LoadingComponent,
|
|
335
|
+
errorComponent: _sfc_main$3
|
|
336
|
+
});
|
|
337
|
+
const properties = {
|
|
338
|
+
colspecs
|
|
339
|
+
};
|
|
340
|
+
return {
|
|
341
|
+
component,
|
|
342
|
+
name,
|
|
343
|
+
node,
|
|
344
|
+
properties
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function mapToComponentName(name) {
|
|
348
|
+
let componentName = name.charAt(0).toUpperCase() + name.slice(1);
|
|
349
|
+
if (nodeNameTemplateNameMap.has(name)) {
|
|
350
|
+
componentName = nodeNameTemplateNameMap.get(name);
|
|
351
|
+
} else if (nodeNameTagNameMap.has(name)) {
|
|
352
|
+
componentName = "StandardElement";
|
|
353
|
+
}
|
|
354
|
+
return componentName;
|
|
355
|
+
}
|
|
356
|
+
function addTGroup(components, node, columns) {
|
|
357
|
+
if (node === null) {
|
|
358
|
+
return components;
|
|
359
|
+
}
|
|
360
|
+
let colspecs = [];
|
|
361
|
+
for (const colspec of node.querySelectorAll("colspec")) {
|
|
362
|
+
colspecs.push(colspec.getAttribute("colwidth"));
|
|
363
|
+
}
|
|
364
|
+
if (colspecs.length !== columns) {
|
|
365
|
+
console.log("Something is not right.");
|
|
366
|
+
}
|
|
367
|
+
components.push(defineColgroupComponent(node, colspecs));
|
|
368
|
+
return components;
|
|
369
|
+
}
|
|
370
|
+
function addComponents(components, node) {
|
|
371
|
+
if (node === null) {
|
|
372
|
+
return components;
|
|
373
|
+
}
|
|
374
|
+
let childTarget = null;
|
|
375
|
+
for (const child of node.childNodes) {
|
|
376
|
+
const childName = child.nodeName;
|
|
377
|
+
if (childName === "compact_paragraph") {
|
|
378
|
+
components = addComponents(components, child);
|
|
379
|
+
} else if (childName === "tgroup") {
|
|
380
|
+
const columnCount = Number(child.getAttribute("cols"));
|
|
381
|
+
components = addTGroup(components, child, columnCount);
|
|
382
|
+
components = addComponents(components, child);
|
|
383
|
+
} else if (childName === "colspec")
|
|
384
|
+
;
|
|
385
|
+
else {
|
|
386
|
+
if (childName === "target") {
|
|
387
|
+
childTarget = child.getAttribute("refid");
|
|
388
|
+
} else {
|
|
389
|
+
if (childName !== "#text" && childTarget) {
|
|
390
|
+
child.setAttribute("id", childTarget);
|
|
391
|
+
childTarget = "";
|
|
392
|
+
}
|
|
393
|
+
const componentName = mapToComponentName(childName);
|
|
394
|
+
const item = defineChildComponent(componentName, child);
|
|
395
|
+
if (item) {
|
|
396
|
+
components.push(item);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return components;
|
|
402
|
+
}
|
|
403
|
+
function useChildren(element) {
|
|
404
|
+
const children = computed(() => {
|
|
405
|
+
return addComponents([], element.value);
|
|
406
|
+
});
|
|
407
|
+
return {
|
|
408
|
+
children
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function useClasses(element) {
|
|
412
|
+
const classes = computed(() => {
|
|
413
|
+
let classesString = element.value.getAttribute("classes");
|
|
414
|
+
let classes2 = [];
|
|
415
|
+
if (classesString) {
|
|
416
|
+
classes2 = classesString.split(" ");
|
|
417
|
+
}
|
|
418
|
+
return [element.value.nodeName.toLowerCase(), ...classes2];
|
|
419
|
+
});
|
|
420
|
+
return {
|
|
421
|
+
classes
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
const _hoisted_1 = ["id"];
|
|
425
|
+
const _sfc_main$1 = {
|
|
426
|
+
props: {
|
|
427
|
+
element: {
|
|
428
|
+
type: void 0,
|
|
429
|
+
default: { empty: true }
|
|
430
|
+
},
|
|
431
|
+
id: {
|
|
432
|
+
type: String,
|
|
433
|
+
default: ""
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
setup(__props) {
|
|
437
|
+
const props = __props;
|
|
438
|
+
const { element, id } = toRefs(props);
|
|
439
|
+
const { children } = useChildren(element);
|
|
440
|
+
return (_ctx, _cache) => {
|
|
441
|
+
return openBlock(), createElementBlock("div", { id: unref(id) }, [
|
|
442
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(children), (c, index) => {
|
|
443
|
+
return openBlock(), createBlock(resolveDynamicComponent(c.component), {
|
|
444
|
+
key: "document_component_" + index,
|
|
445
|
+
node: c.node,
|
|
446
|
+
componentName: c.name,
|
|
447
|
+
properties: c.properties
|
|
448
|
+
}, null, 8, ["node", "componentName", "properties"]);
|
|
449
|
+
}), 128))
|
|
450
|
+
], 8, _hoisted_1);
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
var Document = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
455
|
+
__proto__: null,
|
|
456
|
+
"default": _sfc_main$1
|
|
457
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
458
|
+
const _sfc_main = {
|
|
459
|
+
props: {
|
|
460
|
+
baseURL: {
|
|
461
|
+
type: String,
|
|
462
|
+
default: "/"
|
|
463
|
+
},
|
|
464
|
+
downloadBaseURL: {
|
|
465
|
+
type: String,
|
|
466
|
+
default: ""
|
|
467
|
+
},
|
|
468
|
+
imagesBaseURL: {
|
|
469
|
+
type: String,
|
|
470
|
+
default: ""
|
|
471
|
+
},
|
|
472
|
+
indexFileName: {
|
|
473
|
+
type: String,
|
|
474
|
+
default: "index"
|
|
475
|
+
},
|
|
476
|
+
pageNotFoundName: {
|
|
477
|
+
type: String,
|
|
478
|
+
default: "404"
|
|
479
|
+
},
|
|
480
|
+
scrollDelay: {
|
|
481
|
+
type: Number,
|
|
482
|
+
default: 200
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
setup(__props) {
|
|
486
|
+
const props = __props;
|
|
487
|
+
const {
|
|
488
|
+
baseURL,
|
|
489
|
+
downloadBaseURL,
|
|
490
|
+
imagesBaseURL,
|
|
491
|
+
indexFileName,
|
|
492
|
+
pageNotFoundName,
|
|
493
|
+
scrollDelay
|
|
494
|
+
} = toRefs(props);
|
|
495
|
+
const router = useRouter();
|
|
496
|
+
const route = useRoute();
|
|
497
|
+
const store = useStore();
|
|
498
|
+
let element = ref(null);
|
|
499
|
+
let scrollToTarget = ref(void 0);
|
|
500
|
+
let id = ref("");
|
|
501
|
+
let previousRoute = {
|
|
502
|
+
path: void 0,
|
|
503
|
+
hash: void 0
|
|
504
|
+
};
|
|
505
|
+
function followScrollTarget(elem) {
|
|
506
|
+
setTimeout(() => {
|
|
507
|
+
scrollToTarget.value = elem.offsetTop;
|
|
508
|
+
window.scrollTo({
|
|
509
|
+
top: elem.offsetTop,
|
|
510
|
+
behavior: "smooth"
|
|
511
|
+
});
|
|
512
|
+
setTimeout(() => {
|
|
513
|
+
if (scrollToTarget.value !== elem.offsetTop) {
|
|
514
|
+
followScrollTarget(elem);
|
|
515
|
+
}
|
|
516
|
+
}, 10);
|
|
517
|
+
}, scrollDelay.value);
|
|
518
|
+
}
|
|
519
|
+
watch(route, (to) => {
|
|
520
|
+
if (previousRoute.path === void 0 || to.path !== previousRoute.path) {
|
|
521
|
+
fetchPageData(to);
|
|
522
|
+
if (to.hash) {
|
|
523
|
+
setTimeout(() => {
|
|
524
|
+
let hash = to.hash;
|
|
525
|
+
if (hash.startsWith("#")) {
|
|
526
|
+
hash = hash.slice(1);
|
|
527
|
+
}
|
|
528
|
+
const elem = document.getElementById(hash);
|
|
529
|
+
if (elem) {
|
|
530
|
+
followScrollTarget(elem);
|
|
531
|
+
}
|
|
532
|
+
}, scrollDelay.value);
|
|
533
|
+
}
|
|
534
|
+
} else if (to.path === previousRoute.path && to.hash) {
|
|
535
|
+
let hash = to.hash;
|
|
536
|
+
if (hash.startsWith("#")) {
|
|
537
|
+
hash = hash.slice(1);
|
|
538
|
+
}
|
|
539
|
+
const elem = document.getElementById(hash);
|
|
540
|
+
if (elem) {
|
|
541
|
+
window.scrollTo({
|
|
542
|
+
top: elem.offsetTop,
|
|
543
|
+
behavior: "smooth"
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
previousRoute.path = to.path;
|
|
548
|
+
previousRoute.hash = to.hash;
|
|
549
|
+
}, { flush: "pre", immediate: true, deep: true });
|
|
550
|
+
function fetchPageData(routeTo) {
|
|
551
|
+
let pageName = constructPageNameFromRoute(routeTo);
|
|
552
|
+
if (!pageName) {
|
|
553
|
+
pageName = indexFileName.value;
|
|
554
|
+
}
|
|
555
|
+
const resolvedImagesBaseURL = imagesBaseURL.value === "" ? `${baseURL.value}/_images` : imagesBaseURL.value;
|
|
556
|
+
const resolvedDownloadBaseURL = downloadBaseURL.value === "" ? `${baseURL.value}/_downloads` : downloadBaseURL.value;
|
|
557
|
+
const routeURL = determineRouteUrl(routeTo);
|
|
558
|
+
store.dispatch("sphinx/fetchPage", {
|
|
559
|
+
page_name: pageName,
|
|
560
|
+
page_route: routeURL,
|
|
561
|
+
page_url: baseURL.value,
|
|
562
|
+
page_downloads: resolvedDownloadBaseURL,
|
|
563
|
+
page_images: resolvedImagesBaseURL
|
|
564
|
+
}).then((response) => {
|
|
565
|
+
if (response) {
|
|
566
|
+
element.value = response;
|
|
567
|
+
id.value = "page_" + pageName.replace("/", "_");
|
|
568
|
+
} else {
|
|
569
|
+
router.push({
|
|
570
|
+
name: pageNotFoundName.value,
|
|
571
|
+
params: {
|
|
572
|
+
type: "page",
|
|
573
|
+
message: `Could not find Sphinx page '${pageName}.xml'.`
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
return (_ctx, _cache) => {
|
|
580
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
581
|
+
element: unref(element),
|
|
582
|
+
id: unref(id)
|
|
583
|
+
}, null, 8, ["element", "id"]);
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
const apiClient = axios.create({
|
|
588
|
+
withCredentials: false,
|
|
589
|
+
headers: {
|
|
590
|
+
Accept: "text/xml",
|
|
591
|
+
"Content-Type": "text/xml"
|
|
592
|
+
},
|
|
593
|
+
timeout: 1e4
|
|
594
|
+
});
|
|
595
|
+
var SphinxService = {
|
|
596
|
+
getPage(baseURL, page) {
|
|
597
|
+
return apiClient.get(`${baseURL}/${page}.xml`);
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
const namespaced = true;
|
|
601
|
+
const state = {
|
|
602
|
+
pages: /* @__PURE__ */ new Map(),
|
|
603
|
+
urlMap: /* @__PURE__ */ new Map(),
|
|
604
|
+
inflight: /* @__PURE__ */ new Map(),
|
|
605
|
+
downloadURLs: /* @__PURE__ */ new Map(),
|
|
606
|
+
imagesURLs: /* @__PURE__ */ new Map()
|
|
607
|
+
};
|
|
608
|
+
const mutations = {
|
|
609
|
+
APPEND_PAGE(state2, { routeURL, page }) {
|
|
610
|
+
let pages = state2.pages.get(routeURL);
|
|
611
|
+
if (!pages) {
|
|
612
|
+
pages = [];
|
|
613
|
+
}
|
|
614
|
+
pages.push(page);
|
|
615
|
+
state2.pages.set(routeURL, pages);
|
|
616
|
+
},
|
|
617
|
+
ADD_INFLIGHT(state2, { routeURL, page_name, pending }) {
|
|
618
|
+
let inflightMap = state2.inflight.get(routeURL);
|
|
619
|
+
if (!inflightMap) {
|
|
620
|
+
inflightMap = /* @__PURE__ */ new Map();
|
|
621
|
+
}
|
|
622
|
+
inflightMap.set(page_name, pending);
|
|
623
|
+
state2.inflight.set(routeURL, inflightMap);
|
|
624
|
+
},
|
|
625
|
+
REMOVE_INFLIGHT(state2, { routeURL, id }) {
|
|
626
|
+
state2.inflight.get(routeURL).delete(id);
|
|
627
|
+
},
|
|
628
|
+
REGISTER_ROUTE_URL(state2, { baseURL, routeURL, downloadsURL, imagesURL }) {
|
|
629
|
+
const registeredURL = state2.pages.get(routeURL);
|
|
630
|
+
if (!registeredURL) {
|
|
631
|
+
state2.pages.set(routeURL, []);
|
|
632
|
+
state2.urlMap.set(routeURL, baseURL);
|
|
633
|
+
state2.downloadURLs.set(routeURL, downloadsURL);
|
|
634
|
+
state2.imagesURLs.set(routeURL, imagesURL);
|
|
635
|
+
state2.inflight.set(routeURL, /* @__PURE__ */ new Map());
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
const actions = {
|
|
640
|
+
fetchPage({ commit, getters: getters2 }, payload) {
|
|
641
|
+
const page_name = payload.page_name;
|
|
642
|
+
const page_route = payload.page_route;
|
|
643
|
+
const base_url = payload.page_url;
|
|
644
|
+
commit("REGISTER_ROUTE_URL", {
|
|
645
|
+
baseURL: base_url,
|
|
646
|
+
routeURL: page_route,
|
|
647
|
+
downloadsURL: payload.page_downloads,
|
|
648
|
+
imagesURL: payload.page_images
|
|
649
|
+
});
|
|
650
|
+
const existingPage = getters2.getPageById(page_route, page_name);
|
|
651
|
+
if (existingPage) {
|
|
652
|
+
return Promise.resolve(existingPage);
|
|
653
|
+
}
|
|
654
|
+
if (getters2.isInflight(page_route, page_name)) {
|
|
655
|
+
return getters2.getInflight(page_route, page_name);
|
|
656
|
+
}
|
|
657
|
+
const pending = SphinxService.getPage(base_url, page_name).then((response) => {
|
|
658
|
+
let parser = new DOMParser();
|
|
659
|
+
let xmlDoc = parser.parseFromString(response.data, "text/xml");
|
|
660
|
+
const documentElement = xmlDoc.querySelector("document");
|
|
661
|
+
commit("APPEND_PAGE", { routeURL: page_route, page: documentElement });
|
|
662
|
+
commit("REMOVE_INFLIGHT", { routeURL: page_route, id: page_name });
|
|
663
|
+
return documentElement;
|
|
664
|
+
}).catch(() => {
|
|
665
|
+
commit("REMOVE_INFLIGHT", { routeURL: page_route, id: page_name });
|
|
666
|
+
});
|
|
667
|
+
commit("ADD_INFLIGHT", { routeURL: page_route, page_name, pending });
|
|
668
|
+
return pending;
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
const getters = {
|
|
672
|
+
getPageById: (state2) => (routeURL, id) => {
|
|
673
|
+
return state2.pages.get(routeURL).find((page) => page.id === id);
|
|
674
|
+
},
|
|
675
|
+
getInflight: (state2) => (routeURL, id) => {
|
|
676
|
+
return state2.inflight.get(routeURL).get(id);
|
|
677
|
+
},
|
|
678
|
+
isInflight: (state2) => (routeURL, id) => {
|
|
679
|
+
return !!state2.inflight.get(routeURL).get(id);
|
|
680
|
+
},
|
|
681
|
+
getBaseUrl: (state2) => (routeURL) => {
|
|
682
|
+
return state2.urlMap.get(routeURL);
|
|
683
|
+
},
|
|
684
|
+
getDownloadURL: (state2) => (routeURL) => {
|
|
685
|
+
return state2.downloadURLs.get(routeURL);
|
|
686
|
+
},
|
|
687
|
+
getImagesURL: (state2) => (routeURL) => {
|
|
688
|
+
return state2.imagesURLs.get(routeURL);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
var SphinxStore = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
692
|
+
__proto__: null,
|
|
693
|
+
namespaced,
|
|
694
|
+
state,
|
|
695
|
+
mutations,
|
|
696
|
+
actions,
|
|
697
|
+
getters
|
|
698
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
699
|
+
function installVue3SphinxXml(app, options = {}) {
|
|
700
|
+
if (!options.store) {
|
|
701
|
+
throw "Please provide a store!!";
|
|
702
|
+
}
|
|
703
|
+
options.store.registerModule("sphinx", SphinxStore);
|
|
704
|
+
app.use(Vue3Katex, options.katex);
|
|
705
|
+
}
|
|
706
|
+
export { _export_sfc as _, useClasses as a, decodeHTML as b, constructPageNameFromRoute as c, determineRouteUrl as d, _sfc_main as e, installVue3SphinxXml as i, nodeNameTagNameMap as n, useChildren as u };
|
|
707
|
+
//# sourceMappingURL=entry.js.map
|