@abraca/nuxt 1.8.2 → 1.9.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 +27 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +42 -4
- package/dist/runtime/components/docs/ADocsNavigation.d.vue.ts +155 -0
- package/dist/runtime/components/docs/ADocsNavigation.vue +154 -0
- package/dist/runtime/components/docs/ADocsNavigation.vue.d.ts +155 -0
- package/dist/runtime/components/docs/ADocsSearch.d.vue.ts +249 -0
- package/dist/runtime/components/docs/ADocsSearch.vue +187 -0
- package/dist/runtime/components/docs/ADocsSearch.vue.d.ts +249 -0
- package/dist/runtime/components/docs/ADocsSearchButton.d.vue.ts +253 -0
- package/dist/runtime/components/docs/ADocsSearchButton.vue +99 -0
- package/dist/runtime/components/docs/ADocsSearchButton.vue.d.ts +253 -0
- package/dist/runtime/components/docs/ADocsSurround.d.vue.ts +56 -0
- package/dist/runtime/components/docs/ADocsSurround.vue +68 -0
- package/dist/runtime/components/docs/ADocsSurround.vue.d.ts +56 -0
- package/dist/runtime/components/docs/ADocsToc.d.vue.ts +117 -0
- package/dist/runtime/components/docs/ADocsToc.vue +194 -0
- package/dist/runtime/components/docs/ADocsToc.vue.d.ts +117 -0
- package/dist/runtime/components/editor/ADocLinkPopover.vue +1 -5
- package/dist/runtime/components/renderers/AMediaRenderer.vue +1 -1
- package/dist/runtime/components/shell/ADocPanelSettings.d.vue.ts +32 -2
- package/dist/runtime/components/shell/ADocPanelSettings.vue +289 -2
- package/dist/runtime/components/shell/ADocPanelSettings.vue.d.ts +32 -2
- package/dist/runtime/composables/useDocsSearch.d.ts +24 -0
- package/dist/runtime/composables/useDocsSearch.js +34 -0
- package/dist/runtime/extensions/doc-embed.js +2 -1
- package/dist/runtime/extensions/doc-link-drop.js +4 -4
- package/dist/runtime/extensions/doc-link.d.ts +12 -0
- package/dist/runtime/extensions/doc-link.js +60 -0
- package/dist/runtime/extensions/views/DocEmbedView.vue +18 -3
- package/dist/runtime/extensions/views/DocLinkView.d.vue.ts +4 -0
- package/dist/runtime/extensions/views/DocLinkView.vue +71 -0
- package/dist/runtime/extensions/views/DocLinkView.vue.d.ts +4 -0
- package/dist/runtime/plugin-abracadabra.client.js +18 -2
- package/dist/runtime/plugins/core.plugin.js +3 -0
- package/dist/runtime/server/plugins/abracadabra-service.js +3 -1
- package/dist/runtime/theme/content/_shared.d.ts +6 -0
- package/dist/runtime/theme/content/_shared.js +6 -0
- package/dist/runtime/theme/content/content-navigation.d.ts +120 -0
- package/dist/runtime/theme/content/content-navigation.js +155 -0
- package/dist/runtime/theme/content/content-search-button.d.ts +16 -0
- package/dist/runtime/theme/content/content-search-button.js +15 -0
- package/dist/runtime/theme/content/content-search.d.ts +24 -0
- package/dist/runtime/theme/content/content-search.js +23 -0
- package/dist/runtime/theme/content/content-surround.d.ts +22 -0
- package/dist/runtime/theme/content/content-surround.js +23 -0
- package/dist/runtime/theme/content/content-toc.d.ts +84 -0
- package/dist/runtime/theme/content/content-toc.js +94 -0
- package/dist/runtime/theme/content/index.d.ts +5 -0
- package/dist/runtime/theme/content/index.js +5 -0
- package/dist/runtime/utils/content.d.ts +19 -0
- package/dist/runtime/utils/content.js +23 -0
- package/dist/runtime/utils/docReferenceEdges.js +1 -1
- package/package.json +14 -7
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "../../theme/content/content-surround";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { Primitive } from "reka-ui";
|
|
8
|
+
import { createReusableTemplate } from "@vueuse/core";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
10
|
+
import { useComponentUI } from "@nuxt/ui/composables/useComponentUI";
|
|
11
|
+
import { useLocale } from "@nuxt/ui/composables/useLocale";
|
|
12
|
+
import { tv } from "@nuxt/ui/utils/tv";
|
|
13
|
+
defineOptions({ inheritAttrs: false });
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
as: { type: null, required: false },
|
|
16
|
+
prevIcon: { type: null, required: false },
|
|
17
|
+
nextIcon: { type: null, required: false },
|
|
18
|
+
surround: { type: Array, required: false },
|
|
19
|
+
class: { type: null, required: false },
|
|
20
|
+
ui: { type: Object, required: false }
|
|
21
|
+
});
|
|
22
|
+
defineSlots();
|
|
23
|
+
const { dir } = useLocale();
|
|
24
|
+
const appConfig = useAppConfig();
|
|
25
|
+
const uiProp = useComponentUI("contentSurround", props);
|
|
26
|
+
const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate({
|
|
27
|
+
props: {
|
|
28
|
+
link: Object,
|
|
29
|
+
icon: String,
|
|
30
|
+
direction: String
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.contentSurround || {} })());
|
|
34
|
+
const prevIcon = computed(() => props.prevIcon || (dir.value === "rtl" ? appConfig.ui.icons.arrowRight : appConfig.ui.icons.arrowLeft));
|
|
35
|
+
const nextIcon = computed(() => props.nextIcon || (dir.value === "rtl" ? appConfig.ui.icons.arrowLeft : appConfig.ui.icons.arrowRight));
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<DefineLinkTemplate v-slot="{ link, icon, direction }">
|
|
40
|
+
<ULink v-if="link" :to="link.path" raw data-slot="link" :class="ui.link({ class: [uiProp?.link, link.ui?.link, link.class], direction })">
|
|
41
|
+
<slot name="link" :link="link" :ui="ui">
|
|
42
|
+
<div data-slot="linkLeading" :class="ui.linkLeading({ class: [uiProp?.linkLeading, link.ui?.linkLeading] })">
|
|
43
|
+
<slot name="link-leading" :link="link" :ui="ui">
|
|
44
|
+
<UIcon :name="link.icon || icon" data-slot="linkLeadingIcon" :class="ui.linkLeadingIcon({ class: [uiProp?.linkLeadingIcon, link.ui?.linkLeadingIcon], direction })" />
|
|
45
|
+
</slot>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<p data-slot="linkTitle" :class="ui.linkTitle({ class: [uiProp?.linkTitle, link.ui?.linkTitle] })">
|
|
49
|
+
<slot name="link-title" :link="link" :ui="ui">
|
|
50
|
+
{{ link.title }}
|
|
51
|
+
</slot>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
<p data-slot="linkDescription" :class="ui.linkDescription({ class: [uiProp?.linkDescription, link.ui?.linkDescription] })">
|
|
55
|
+
<slot name="link-description" :link="link" :ui="ui">
|
|
56
|
+
{{ link.description }}
|
|
57
|
+
</slot>
|
|
58
|
+
</p>
|
|
59
|
+
</slot>
|
|
60
|
+
</ULink>
|
|
61
|
+
<span v-else class="hidden sm:block"> </span>
|
|
62
|
+
</DefineLinkTemplate>
|
|
63
|
+
|
|
64
|
+
<Primitive v-if="surround" :as="as" v-bind="$attrs" data-slot="root" :class="ui.root({ class: [uiProp?.root, props.class] })">
|
|
65
|
+
<ReuseLinkTemplate :link="surround[0]" :icon="prevIcon" direction="left" />
|
|
66
|
+
<ReuseLinkTemplate :link="surround[1]" :icon="nextIcon" direction="right" />
|
|
67
|
+
</Primitive>
|
|
68
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
as: {
|
|
5
|
+
type: null;
|
|
6
|
+
required: false;
|
|
7
|
+
};
|
|
8
|
+
prevIcon: {
|
|
9
|
+
type: null;
|
|
10
|
+
required: false;
|
|
11
|
+
};
|
|
12
|
+
nextIcon: {
|
|
13
|
+
type: null;
|
|
14
|
+
required: false;
|
|
15
|
+
};
|
|
16
|
+
surround: {
|
|
17
|
+
type: ArrayConstructor;
|
|
18
|
+
required: false;
|
|
19
|
+
};
|
|
20
|
+
class: {
|
|
21
|
+
type: null;
|
|
22
|
+
required: false;
|
|
23
|
+
};
|
|
24
|
+
ui: {
|
|
25
|
+
type: ObjectConstructor;
|
|
26
|
+
required: false;
|
|
27
|
+
};
|
|
28
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
|
+
as: {
|
|
30
|
+
type: null;
|
|
31
|
+
required: false;
|
|
32
|
+
};
|
|
33
|
+
prevIcon: {
|
|
34
|
+
type: null;
|
|
35
|
+
required: false;
|
|
36
|
+
};
|
|
37
|
+
nextIcon: {
|
|
38
|
+
type: null;
|
|
39
|
+
required: false;
|
|
40
|
+
};
|
|
41
|
+
surround: {
|
|
42
|
+
type: ArrayConstructor;
|
|
43
|
+
required: false;
|
|
44
|
+
};
|
|
45
|
+
class: {
|
|
46
|
+
type: null;
|
|
47
|
+
required: false;
|
|
48
|
+
};
|
|
49
|
+
ui: {
|
|
50
|
+
type: ObjectConstructor;
|
|
51
|
+
required: false;
|
|
52
|
+
};
|
|
53
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, __VLS_Slots>;
|
|
54
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
55
|
+
$slots: S;
|
|
56
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
as: {
|
|
5
|
+
type: null;
|
|
6
|
+
required: false;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
trailingIcon: {
|
|
10
|
+
type: null;
|
|
11
|
+
required: false;
|
|
12
|
+
};
|
|
13
|
+
title: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
required: false;
|
|
16
|
+
};
|
|
17
|
+
color: {
|
|
18
|
+
type: null;
|
|
19
|
+
required: false;
|
|
20
|
+
};
|
|
21
|
+
highlight: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
required: false;
|
|
24
|
+
};
|
|
25
|
+
highlightColor: {
|
|
26
|
+
type: null;
|
|
27
|
+
required: false;
|
|
28
|
+
};
|
|
29
|
+
highlightVariant: {
|
|
30
|
+
type: null;
|
|
31
|
+
required: false;
|
|
32
|
+
};
|
|
33
|
+
links: {
|
|
34
|
+
type: ArrayConstructor;
|
|
35
|
+
required: false;
|
|
36
|
+
};
|
|
37
|
+
class: {
|
|
38
|
+
type: null;
|
|
39
|
+
required: false;
|
|
40
|
+
};
|
|
41
|
+
ui: {
|
|
42
|
+
type: ObjectConstructor;
|
|
43
|
+
required: false;
|
|
44
|
+
};
|
|
45
|
+
defaultOpen: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
required: false;
|
|
48
|
+
};
|
|
49
|
+
open: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
required: false;
|
|
52
|
+
};
|
|
53
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
54
|
+
move: (...args: any[]) => void;
|
|
55
|
+
"update:open": (...args: any[]) => void;
|
|
56
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
57
|
+
as: {
|
|
58
|
+
type: null;
|
|
59
|
+
required: false;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
trailingIcon: {
|
|
63
|
+
type: null;
|
|
64
|
+
required: false;
|
|
65
|
+
};
|
|
66
|
+
title: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
required: false;
|
|
69
|
+
};
|
|
70
|
+
color: {
|
|
71
|
+
type: null;
|
|
72
|
+
required: false;
|
|
73
|
+
};
|
|
74
|
+
highlight: {
|
|
75
|
+
type: BooleanConstructor;
|
|
76
|
+
required: false;
|
|
77
|
+
};
|
|
78
|
+
highlightColor: {
|
|
79
|
+
type: null;
|
|
80
|
+
required: false;
|
|
81
|
+
};
|
|
82
|
+
highlightVariant: {
|
|
83
|
+
type: null;
|
|
84
|
+
required: false;
|
|
85
|
+
};
|
|
86
|
+
links: {
|
|
87
|
+
type: ArrayConstructor;
|
|
88
|
+
required: false;
|
|
89
|
+
};
|
|
90
|
+
class: {
|
|
91
|
+
type: null;
|
|
92
|
+
required: false;
|
|
93
|
+
};
|
|
94
|
+
ui: {
|
|
95
|
+
type: ObjectConstructor;
|
|
96
|
+
required: false;
|
|
97
|
+
};
|
|
98
|
+
defaultOpen: {
|
|
99
|
+
type: BooleanConstructor;
|
|
100
|
+
required: false;
|
|
101
|
+
};
|
|
102
|
+
open: {
|
|
103
|
+
type: BooleanConstructor;
|
|
104
|
+
required: false;
|
|
105
|
+
};
|
|
106
|
+
}>> & Readonly<{
|
|
107
|
+
onMove?: ((...args: any[]) => any) | undefined;
|
|
108
|
+
"onUpdate:open"?: ((...args: any[]) => any) | undefined;
|
|
109
|
+
}>, {
|
|
110
|
+
as: any;
|
|
111
|
+
open: boolean;
|
|
112
|
+
highlight: boolean;
|
|
113
|
+
defaultOpen: boolean;
|
|
114
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, __VLS_Slots>;
|
|
115
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
116
|
+
$slots: S;
|
|
117
|
+
});
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "../../theme/content/content-toc";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
9
|
+
import { useRouter, useAppConfig, useNuxtApp } from "#imports";
|
|
10
|
+
import { useComponentUI } from "@nuxt/ui/composables/useComponentUI";
|
|
11
|
+
import { useScrollspy } from "@nuxt/ui/composables/useScrollspy";
|
|
12
|
+
import { useLocale } from "@nuxt/ui/composables/useLocale";
|
|
13
|
+
import { tv } from "@nuxt/ui/utils/tv";
|
|
14
|
+
defineOptions({ inheritAttrs: false });
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
as: { type: null, required: false, default: "nav" },
|
|
17
|
+
trailingIcon: { type: null, required: false },
|
|
18
|
+
title: { type: String, required: false },
|
|
19
|
+
color: { type: null, required: false },
|
|
20
|
+
highlight: { type: Boolean, required: false },
|
|
21
|
+
highlightColor: { type: null, required: false },
|
|
22
|
+
highlightVariant: { type: null, required: false },
|
|
23
|
+
links: { type: Array, required: false },
|
|
24
|
+
class: { type: null, required: false },
|
|
25
|
+
ui: { type: Object, required: false },
|
|
26
|
+
defaultOpen: { type: Boolean, required: false },
|
|
27
|
+
open: { type: Boolean, required: false }
|
|
28
|
+
});
|
|
29
|
+
const emits = defineEmits(["update:open", "move"]);
|
|
30
|
+
const slots = defineSlots();
|
|
31
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "open", "defaultOpen"), emits);
|
|
32
|
+
const { t } = useLocale();
|
|
33
|
+
const router = useRouter();
|
|
34
|
+
const appConfig = useAppConfig();
|
|
35
|
+
const uiProp = useComponentUI("contentToc", props);
|
|
36
|
+
const { activeHeadings, updateHeadings } = useScrollspy();
|
|
37
|
+
const [DefineListTemplate, ReuseListTemplate] = createReusableTemplate({
|
|
38
|
+
props: {
|
|
39
|
+
links: Array,
|
|
40
|
+
level: Number
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const [DefineTriggerTemplate, ReuseTriggerTemplate] = createReusableTemplate();
|
|
44
|
+
const [DefineContentTemplate, ReuseContentTemplate] = createReusableTemplate();
|
|
45
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.contentToc || {} })({
|
|
46
|
+
color: props.color,
|
|
47
|
+
highlight: props.highlight,
|
|
48
|
+
highlightVariant: props.highlightVariant,
|
|
49
|
+
highlightColor: props.highlightColor || props.color
|
|
50
|
+
}));
|
|
51
|
+
function scrollToHeading(id) {
|
|
52
|
+
const encodedId = encodeURIComponent(id);
|
|
53
|
+
router.push(`#${encodedId}`);
|
|
54
|
+
emits("move", id);
|
|
55
|
+
}
|
|
56
|
+
function flattenLinks(links) {
|
|
57
|
+
return links.flatMap((link) => [link, ...link.children ? flattenLinks(link.children) : []]);
|
|
58
|
+
}
|
|
59
|
+
function flattenLinksWithLevel(links, level = 0) {
|
|
60
|
+
return links.flatMap((link) => [
|
|
61
|
+
{ link, level },
|
|
62
|
+
...link.children ? flattenLinksWithLevel(link.children, level + 1) : []
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
const linkHeight = 1.75;
|
|
66
|
+
const indicatorStyle = computed(() => {
|
|
67
|
+
if (!activeHeadings.value?.length) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const flatLinks = flattenLinks(props.links || []);
|
|
71
|
+
const activeIndex = flatLinks.findIndex((link) => activeHeadings.value.includes(link.id));
|
|
72
|
+
return {
|
|
73
|
+
"--indicator-size": `${linkHeight * activeHeadings.value.length}rem`,
|
|
74
|
+
"--indicator-position": activeIndex >= 0 ? `${activeIndex * linkHeight}rem` : "0rem"
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
const circuitMaskStyle = computed(() => {
|
|
78
|
+
if (!props.highlight || props.highlightVariant !== "circuit" || !props.links?.length) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const flatLinks = flattenLinksWithLevel(props.links);
|
|
82
|
+
const svgUnit = 16;
|
|
83
|
+
const svgLinkHeight = linkHeight * svgUnit;
|
|
84
|
+
const svgHeight = flatLinks.length * svgLinkHeight;
|
|
85
|
+
const x0 = 0.5;
|
|
86
|
+
const x1 = 10.5;
|
|
87
|
+
let path = "";
|
|
88
|
+
let currentX = x0;
|
|
89
|
+
let y = 0;
|
|
90
|
+
flatLinks.forEach((item, index) => {
|
|
91
|
+
const targetX = item.level > 0 ? x1 : x0;
|
|
92
|
+
const nextY = y + svgLinkHeight;
|
|
93
|
+
if (index === 0) {
|
|
94
|
+
path += `M${targetX} ${y}`;
|
|
95
|
+
currentX = targetX;
|
|
96
|
+
}
|
|
97
|
+
if (targetX !== currentX) {
|
|
98
|
+
path += ` L${targetX} ${y + 6}`;
|
|
99
|
+
currentX = targetX;
|
|
100
|
+
}
|
|
101
|
+
path += ` L${currentX} ${nextY - (index < flatLinks.length - 1 && flatLinks[index + 1]?.level !== item.level ? 6 : 0)}`;
|
|
102
|
+
y = nextY;
|
|
103
|
+
});
|
|
104
|
+
const svgPath = encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 ${svgHeight}'><path d='${path}' stroke='black' stroke-width='1' fill='none'/></svg>`);
|
|
105
|
+
return {
|
|
106
|
+
width: "0.75rem",
|
|
107
|
+
height: `${flatLinks.length * linkHeight}rem`,
|
|
108
|
+
maskImage: `url("data:image/svg+xml,${svgPath}")`
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
const nuxtApp = useNuxtApp();
|
|
112
|
+
nuxtApp.hooks.hook("page:loading:end", () => {
|
|
113
|
+
const headings = Array.from(document.querySelectorAll("h2, h3"));
|
|
114
|
+
updateHeadings(headings);
|
|
115
|
+
});
|
|
116
|
+
nuxtApp.hooks.hook("page:transition:finish", () => {
|
|
117
|
+
const headings = Array.from(document.querySelectorAll("h2, h3"));
|
|
118
|
+
updateHeadings(headings);
|
|
119
|
+
});
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<template>
|
|
123
|
+
<!-- eslint-disable-next-line vue/no-template-shadow -->
|
|
124
|
+
<DefineListTemplate v-slot="{ links, level }">
|
|
125
|
+
<ul :class="level > 0 ? ui.listWithChildren({ class: uiProp?.listWithChildren }) : ui.list({ class: uiProp?.list })">
|
|
126
|
+
<li v-for="(link, index) in links" :key="index" :class="link.children && link.children.length > 0 ? ui.itemWithChildren({ class: [uiProp?.itemWithChildren, link.ui?.itemWithChildren] }) : ui.item({ class: [uiProp?.item, link.ui?.item] })">
|
|
127
|
+
<a :href="`#${link.id}`" data-slot="link" :class="ui.link({ class: [uiProp?.link, link.ui?.link, link.class], active: activeHeadings.includes(link.id) })" @click.prevent="scrollToHeading(link.id)">
|
|
128
|
+
<slot name="link" :link="link">
|
|
129
|
+
<span data-slot="linkText" :class="ui.linkText({ class: [uiProp?.linkText, link.ui?.linkText] })">
|
|
130
|
+
{{ link.text }}
|
|
131
|
+
</span>
|
|
132
|
+
</slot>
|
|
133
|
+
</a>
|
|
134
|
+
|
|
135
|
+
<ReuseListTemplate v-if="link.children?.length" :links="link.children" :level="level + 1" />
|
|
136
|
+
</li>
|
|
137
|
+
</ul>
|
|
138
|
+
</DefineListTemplate>
|
|
139
|
+
|
|
140
|
+
<DefineTriggerTemplate v-slot="{ open }">
|
|
141
|
+
<slot name="leading" :open="open" :ui="ui" />
|
|
142
|
+
|
|
143
|
+
<span data-slot="title" :class="ui.title({ class: uiProp?.title })">
|
|
144
|
+
<slot :open="open">{{ title || t('contentToc.title') }}</slot>
|
|
145
|
+
</span>
|
|
146
|
+
|
|
147
|
+
<span data-slot="trailing" :class="ui.trailing({ class: uiProp?.trailing })">
|
|
148
|
+
<slot name="trailing" :open="open" :ui="ui">
|
|
149
|
+
<UIcon :name="trailingIcon || appConfig.ui.icons.chevronDown" data-slot="trailingIcon" :class="ui.trailingIcon({ class: uiProp?.trailingIcon })" />
|
|
150
|
+
</slot>
|
|
151
|
+
</span>
|
|
152
|
+
</DefineTriggerTemplate>
|
|
153
|
+
|
|
154
|
+
<DefineContentTemplate>
|
|
155
|
+
<div v-if="highlight" data-slot="indicator" :class="ui.indicator({ class: uiProp?.indicator })" :style="{ ...indicatorStyle, ...circuitMaskStyle || {} }">
|
|
156
|
+
<div data-slot="indicatorLine" :class="ui.indicatorLine({ class: uiProp?.indicatorLine })" />
|
|
157
|
+
<div v-if="indicatorStyle" data-slot="indicatorActive" :class="ui.indicatorActive({ class: uiProp?.indicatorActive })" />
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<slot name="content" :links="links">
|
|
161
|
+
<ReuseListTemplate :links="links" :level="0" />
|
|
162
|
+
</slot>
|
|
163
|
+
</DefineContentTemplate>
|
|
164
|
+
|
|
165
|
+
<CollapsibleRoot v-slot="{ open }" v-bind="{ ...rootProps, ...$attrs }" :default-open="defaultOpen" data-slot="root" :class="ui.root({ class: [uiProp?.root, props.class] })">
|
|
166
|
+
<div data-slot="container" :class="ui.container({ class: uiProp?.container })">
|
|
167
|
+
<div v-if="!!slots.top" data-slot="top" :class="ui.top({ class: uiProp?.top })">
|
|
168
|
+
<slot name="top" :links="links" />
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<template v-if="links?.length">
|
|
172
|
+
<CollapsibleTrigger data-slot="trigger" :class="ui.trigger({ class: 'lg:hidden' })">
|
|
173
|
+
<ReuseTriggerTemplate :open="open" />
|
|
174
|
+
</CollapsibleTrigger>
|
|
175
|
+
|
|
176
|
+
<CollapsibleContent data-slot="content" :class="ui.content({ class: [uiProp?.content, 'lg:hidden'] })">
|
|
177
|
+
<ReuseContentTemplate />
|
|
178
|
+
</CollapsibleContent>
|
|
179
|
+
|
|
180
|
+
<p data-slot="trigger" :class="ui.trigger({ class: 'hidden lg:flex' })">
|
|
181
|
+
<ReuseTriggerTemplate :open="open" />
|
|
182
|
+
</p>
|
|
183
|
+
|
|
184
|
+
<div data-slot="content" :class="ui.content({ class: [uiProp?.content, 'hidden lg:flex'] })">
|
|
185
|
+
<ReuseContentTemplate />
|
|
186
|
+
</div>
|
|
187
|
+
</template>
|
|
188
|
+
|
|
189
|
+
<div v-if="!!slots.bottom" data-slot="bottom" :class="ui.bottom({ class: uiProp?.bottom, body: !!slots.top || !!links?.length })">
|
|
190
|
+
<slot name="bottom" :links="links" />
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</CollapsibleRoot>
|
|
194
|
+
</template>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
as: {
|
|
5
|
+
type: null;
|
|
6
|
+
required: false;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
trailingIcon: {
|
|
10
|
+
type: null;
|
|
11
|
+
required: false;
|
|
12
|
+
};
|
|
13
|
+
title: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
required: false;
|
|
16
|
+
};
|
|
17
|
+
color: {
|
|
18
|
+
type: null;
|
|
19
|
+
required: false;
|
|
20
|
+
};
|
|
21
|
+
highlight: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
required: false;
|
|
24
|
+
};
|
|
25
|
+
highlightColor: {
|
|
26
|
+
type: null;
|
|
27
|
+
required: false;
|
|
28
|
+
};
|
|
29
|
+
highlightVariant: {
|
|
30
|
+
type: null;
|
|
31
|
+
required: false;
|
|
32
|
+
};
|
|
33
|
+
links: {
|
|
34
|
+
type: ArrayConstructor;
|
|
35
|
+
required: false;
|
|
36
|
+
};
|
|
37
|
+
class: {
|
|
38
|
+
type: null;
|
|
39
|
+
required: false;
|
|
40
|
+
};
|
|
41
|
+
ui: {
|
|
42
|
+
type: ObjectConstructor;
|
|
43
|
+
required: false;
|
|
44
|
+
};
|
|
45
|
+
defaultOpen: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
required: false;
|
|
48
|
+
};
|
|
49
|
+
open: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
required: false;
|
|
52
|
+
};
|
|
53
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
54
|
+
move: (...args: any[]) => void;
|
|
55
|
+
"update:open": (...args: any[]) => void;
|
|
56
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
57
|
+
as: {
|
|
58
|
+
type: null;
|
|
59
|
+
required: false;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
trailingIcon: {
|
|
63
|
+
type: null;
|
|
64
|
+
required: false;
|
|
65
|
+
};
|
|
66
|
+
title: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
required: false;
|
|
69
|
+
};
|
|
70
|
+
color: {
|
|
71
|
+
type: null;
|
|
72
|
+
required: false;
|
|
73
|
+
};
|
|
74
|
+
highlight: {
|
|
75
|
+
type: BooleanConstructor;
|
|
76
|
+
required: false;
|
|
77
|
+
};
|
|
78
|
+
highlightColor: {
|
|
79
|
+
type: null;
|
|
80
|
+
required: false;
|
|
81
|
+
};
|
|
82
|
+
highlightVariant: {
|
|
83
|
+
type: null;
|
|
84
|
+
required: false;
|
|
85
|
+
};
|
|
86
|
+
links: {
|
|
87
|
+
type: ArrayConstructor;
|
|
88
|
+
required: false;
|
|
89
|
+
};
|
|
90
|
+
class: {
|
|
91
|
+
type: null;
|
|
92
|
+
required: false;
|
|
93
|
+
};
|
|
94
|
+
ui: {
|
|
95
|
+
type: ObjectConstructor;
|
|
96
|
+
required: false;
|
|
97
|
+
};
|
|
98
|
+
defaultOpen: {
|
|
99
|
+
type: BooleanConstructor;
|
|
100
|
+
required: false;
|
|
101
|
+
};
|
|
102
|
+
open: {
|
|
103
|
+
type: BooleanConstructor;
|
|
104
|
+
required: false;
|
|
105
|
+
};
|
|
106
|
+
}>> & Readonly<{
|
|
107
|
+
onMove?: ((...args: any[]) => any) | undefined;
|
|
108
|
+
"onUpdate:open"?: ((...args: any[]) => any) | undefined;
|
|
109
|
+
}>, {
|
|
110
|
+
as: any;
|
|
111
|
+
open: boolean;
|
|
112
|
+
highlight: boolean;
|
|
113
|
+
defaultOpen: boolean;
|
|
114
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, __VLS_Slots>;
|
|
115
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
116
|
+
$slots: S;
|
|
117
|
+
});
|
|
@@ -29,11 +29,7 @@ const dropdownItems = computed(() => [[
|
|
|
29
29
|
function pick() {
|
|
30
30
|
pickDoc().then((result) => {
|
|
31
31
|
if (!result) return;
|
|
32
|
-
|
|
33
|
-
const isEmpty = props.editor.state.selection.empty;
|
|
34
|
-
let chain = props.editor.chain().focus().extendMarkRange("link").setLink({ href: `/doc/${id}` });
|
|
35
|
-
if (isEmpty) chain = chain.insertContent({ type: "text", text: label });
|
|
36
|
-
chain.run();
|
|
32
|
+
props.editor.chain().focus().insertDocLink({ docId: result.id }).run();
|
|
37
33
|
});
|
|
38
34
|
}
|
|
39
35
|
</script>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { DropdownMenuItem } from '@nuxt/ui';
|
|
2
|
+
import type { SnapshotMeta } from '@abraca/dabra';
|
|
2
3
|
import type { DocPageMeta } from '../../types.js';
|
|
4
|
+
export type { SnapshotMeta } from '@abraca/dabra';
|
|
3
5
|
export interface PermissionEntry {
|
|
4
6
|
userId: string;
|
|
5
7
|
username: string;
|
|
@@ -49,12 +51,24 @@ type __VLS_Props = {
|
|
|
49
51
|
docTypeKey?: string;
|
|
50
52
|
/** Current document meta (CRDT state) */
|
|
51
53
|
docMeta?: DocPageMeta | null;
|
|
54
|
+
/** Snapshots list for the snapshot history section */
|
|
55
|
+
snapshots?: SnapshotMeta[];
|
|
56
|
+
/** Whether the snapshot list is currently loading */
|
|
57
|
+
loadingSnapshots?: boolean;
|
|
58
|
+
/** Snapshot load error (shown inline in the section) */
|
|
59
|
+
snapshotsError?: string | null;
|
|
60
|
+
/** Whether more snapshots are available beyond the current page */
|
|
61
|
+
hasMoreSnapshots?: boolean;
|
|
62
|
+
/** Version number of the row whose mutation is currently in flight */
|
|
63
|
+
pendingSnapshotVersion?: number | null;
|
|
64
|
+
/** Whether a snapshot is currently being created */
|
|
65
|
+
creatingSnapshot?: boolean;
|
|
52
66
|
};
|
|
53
|
-
declare var __VLS_223: {},
|
|
67
|
+
declare var __VLS_223: {}, __VLS_387: {};
|
|
54
68
|
type __VLS_Slots = {} & {
|
|
55
69
|
encryption?: (props: typeof __VLS_223) => any;
|
|
56
70
|
} & {
|
|
57
|
-
extra?: (props: typeof
|
|
71
|
+
extra?: (props: typeof __VLS_387) => any;
|
|
58
72
|
};
|
|
59
73
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
60
74
|
"update-meta": (patch: Partial<DocPageMeta>) => any;
|
|
@@ -69,6 +83,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
69
83
|
"sync-doc": () => any;
|
|
70
84
|
"open-encryption": () => any;
|
|
71
85
|
"user-context-menu": (perm: PermissionEntry, items: DropdownMenuItem[][]) => any;
|
|
86
|
+
"create-snapshot": (label: string | undefined) => any;
|
|
87
|
+
"delete-snapshot": (version: number) => any;
|
|
88
|
+
"restore-snapshot": (version: number) => any;
|
|
89
|
+
"fork-snapshot": (version: number) => any;
|
|
90
|
+
"load-more-snapshots": () => any;
|
|
72
91
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
73
92
|
"onUpdate-meta"?: ((patch: Partial<DocPageMeta>) => any) | undefined;
|
|
74
93
|
"onGrant-permission"?: ((userId: string, role: string) => any) | undefined;
|
|
@@ -82,6 +101,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
82
101
|
"onSync-doc"?: (() => any) | undefined;
|
|
83
102
|
"onOpen-encryption"?: (() => any) | undefined;
|
|
84
103
|
"onUser-context-menu"?: ((perm: PermissionEntry, items: DropdownMenuItem[][]) => any) | undefined;
|
|
104
|
+
"onCreate-snapshot"?: ((label: string | undefined) => any) | undefined;
|
|
105
|
+
"onDelete-snapshot"?: ((version: number) => any) | undefined;
|
|
106
|
+
"onRestore-snapshot"?: ((version: number) => any) | undefined;
|
|
107
|
+
"onFork-snapshot"?: ((version: number) => any) | undefined;
|
|
108
|
+
"onLoad-more-snapshots"?: (() => any) | undefined;
|
|
85
109
|
}>, {
|
|
86
110
|
userName: string;
|
|
87
111
|
docMeta: DocPageMeta | null;
|
|
@@ -100,6 +124,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
100
124
|
lastSyncedLabel: string | null;
|
|
101
125
|
syncError: string | null;
|
|
102
126
|
docTypeKey: string;
|
|
127
|
+
snapshots: SnapshotMeta[];
|
|
128
|
+
loadingSnapshots: boolean;
|
|
129
|
+
snapshotsError: string | null;
|
|
130
|
+
hasMoreSnapshots: boolean;
|
|
131
|
+
pendingSnapshotVersion: number | null;
|
|
132
|
+
creatingSnapshot: boolean;
|
|
103
133
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
104
134
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
105
135
|
declare const _default: typeof __VLS_export;
|