rimelight-components 1.8.0 → 1.10.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/dist/runtime/components/app/ScrollToTop.d.vue.ts +1 -1
- package/dist/runtime/components/app/ScrollToTop.vue.d.ts +1 -1
- package/dist/runtime/components/backgrounds/FlickeringGrid.d.vue.ts +1 -1
- package/dist/runtime/components/backgrounds/FlickeringGrid.vue.d.ts +1 -1
- package/dist/runtime/components/blocks/CalloutBlock.d.vue.ts +4 -0
- package/dist/runtime/components/blocks/CalloutBlock.vue +14 -0
- package/dist/runtime/components/blocks/CalloutBlock.vue.d.ts +4 -0
- package/dist/runtime/components/blocks/CardBlock.d.vue.ts +4 -0
- package/dist/runtime/components/blocks/CardBlock.vue +18 -0
- package/dist/runtime/components/blocks/CardBlock.vue.d.ts +4 -0
- package/dist/runtime/components/blocks/ImageBlock.d.vue.ts +4 -0
- package/dist/runtime/components/blocks/ImageBlock.vue +16 -0
- package/dist/runtime/components/blocks/ImageBlock.vue.d.ts +4 -0
- package/dist/runtime/components/blocks/ParagraphBlock.d.vue.ts +4 -0
- package/dist/runtime/components/blocks/ParagraphBlock.vue +11 -0
- package/dist/runtime/components/blocks/ParagraphBlock.vue.d.ts +4 -0
- package/dist/runtime/components/blocks/SectionBlock.d.vue.ts +4 -0
- package/dist/runtime/components/blocks/SectionBlock.vue +22 -0
- package/dist/runtime/components/blocks/SectionBlock.vue.d.ts +4 -0
- package/dist/runtime/components/blocks/UnorderedListBlock.d.vue.ts +4 -0
- package/dist/runtime/components/blocks/UnorderedListBlock.vue +13 -0
- package/dist/runtime/components/blocks/UnorderedListBlock.vue.d.ts +4 -0
- package/dist/runtime/components/nodes/LinkNode.d.vue.ts +8 -0
- package/dist/runtime/components/nodes/LinkNode.vue +15 -0
- package/dist/runtime/components/nodes/LinkNode.vue.d.ts +8 -0
- package/dist/runtime/components/nodes/MentionNode.d.vue.ts +8 -0
- package/dist/runtime/components/nodes/MentionNode.vue +22 -0
- package/dist/runtime/components/nodes/MentionNode.vue.d.ts +8 -0
- package/dist/runtime/components/nodes/TextNode.d.vue.ts +6 -0
- package/dist/runtime/components/nodes/TextNode.vue +9 -0
- package/dist/runtime/components/nodes/TextNode.vue.d.ts +6 -0
- package/dist/runtime/components/renderers/BlockRenderer.d.vue.ts +7 -0
- package/dist/runtime/components/renderers/BlockRenderer.vue +51 -0
- package/dist/runtime/components/renderers/BlockRenderer.vue.d.ts +7 -0
- package/dist/runtime/components/renderers/TOC.d.vue.ts +26 -0
- package/dist/runtime/components/renderers/TOC.vue +94 -0
- package/dist/runtime/components/renderers/TOC.vue.d.ts +26 -0
- package/dist/runtime/components/renderers/TextRenderer.d.vue.ts +7 -0
- package/dist/runtime/components/renderers/TextRenderer.vue +59 -0
- package/dist/runtime/components/renderers/TextRenderer.vue.d.ts +7 -0
- package/dist/runtime/types/blocks.d.ts +146 -0
- package/dist/runtime/types/blocks.js +0 -0
- package/dist/runtime/utils/blockMapper.d.ts +9 -0
- package/dist/runtime/utils/blockMapper.js +21 -0
- package/dist/runtime/utils/slugify.d.ts +6 -0
- package/dist/runtime/utils/slugify.js +3 -0
- package/package.json +7 -10
|
@@ -3,8 +3,8 @@ interface Props {
|
|
|
3
3
|
duration?: number;
|
|
4
4
|
}
|
|
5
5
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
6
|
-
circleStrokeWidth: number;
|
|
7
6
|
duration: number;
|
|
7
|
+
circleStrokeWidth: number;
|
|
8
8
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
9
|
declare const _default: typeof __VLS_export;
|
|
10
10
|
export default _default;
|
|
@@ -3,8 +3,8 @@ interface Props {
|
|
|
3
3
|
duration?: number;
|
|
4
4
|
}
|
|
5
5
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
6
|
-
circleStrokeWidth: number;
|
|
7
6
|
duration: number;
|
|
7
|
+
circleStrokeWidth: number;
|
|
8
8
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
9
|
declare const _default: typeof __VLS_export;
|
|
10
10
|
export default _default;
|
|
@@ -9,10 +9,10 @@ interface FlickeringGridProps {
|
|
|
9
9
|
maxOpacity?: number;
|
|
10
10
|
}
|
|
11
11
|
declare const __VLS_export: import("vue").DefineComponent<FlickeringGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FlickeringGridProps> & Readonly<{}>, {
|
|
12
|
+
color: string;
|
|
12
13
|
squareSize: number;
|
|
13
14
|
gridGap: number;
|
|
14
15
|
flickerChance: number;
|
|
15
|
-
color: string;
|
|
16
16
|
maxOpacity: number;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
@@ -9,10 +9,10 @@ interface FlickeringGridProps {
|
|
|
9
9
|
maxOpacity?: number;
|
|
10
10
|
}
|
|
11
11
|
declare const __VLS_export: import("vue").DefineComponent<FlickeringGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FlickeringGridProps> & Readonly<{}>, {
|
|
12
|
+
color: string;
|
|
12
13
|
squareSize: number;
|
|
13
14
|
gridGap: number;
|
|
14
15
|
flickerChance: number;
|
|
15
|
-
color: string;
|
|
16
16
|
maxOpacity: number;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CalloutBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CalloutBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CalloutBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const { variant, children, to, target } = defineProps({
|
|
3
|
+
variant: { type: String, required: true },
|
|
4
|
+
children: { type: Array, required: true },
|
|
5
|
+
to: { type: String, required: false },
|
|
6
|
+
target: { type: String, required: false }
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<RCCallout :variant="variant" :to="to" :target="target">
|
|
12
|
+
<RCBlockRenderer :blocks="children" />
|
|
13
|
+
</RCCallout>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CalloutBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CalloutBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CalloutBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CardBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CardBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CardBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const { title, to, target, children } = defineProps({
|
|
3
|
+
title: { type: String, required: true },
|
|
4
|
+
to: { type: String, required: false },
|
|
5
|
+
target: { type: String, required: false },
|
|
6
|
+
description: { type: String, required: false },
|
|
7
|
+
children: { type: Array, required: true }
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<NuxtLink :to="to" :target="target">
|
|
13
|
+
<UCard class="flex h-full flex-col">
|
|
14
|
+
<h3>{{ title }}</h3>
|
|
15
|
+
<RCBlockRenderer :blocks="children" />
|
|
16
|
+
</UCard>
|
|
17
|
+
</NuxtLink>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CardBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CardBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CardBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ImageBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<ImageBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const { src, alt, caption } = defineProps({
|
|
3
|
+
src: { type: String, required: true },
|
|
4
|
+
alt: { type: String, required: true },
|
|
5
|
+
caption: { type: String, required: false }
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<figure class="mx-auto">
|
|
11
|
+
<img :src="src" :alt="alt" class="h-auto w-full object-cover" />
|
|
12
|
+
<figcaption v-if="caption" class="text-muted mt-4 text-center text-sm">
|
|
13
|
+
{{ caption }}
|
|
14
|
+
</figcaption>
|
|
15
|
+
</figure>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ImageBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<ImageBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ParagraphBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<ParagraphBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ParagraphBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ParagraphBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<ParagraphBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ParagraphBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SectionBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<SectionBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SectionBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { slugify } from "../../utils/slugify";
|
|
4
|
+
const { level, title, description, children } = defineProps({
|
|
5
|
+
level: { type: Number, required: true },
|
|
6
|
+
title: { type: String, required: true },
|
|
7
|
+
description: { type: String, required: false },
|
|
8
|
+
children: { type: Array, required: true }
|
|
9
|
+
});
|
|
10
|
+
const headingId = computed(() => title ? slugify(title) : void 0);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<RCSection
|
|
15
|
+
:level="level"
|
|
16
|
+
:title="title"
|
|
17
|
+
:description="description"
|
|
18
|
+
:id="headingId"
|
|
19
|
+
>
|
|
20
|
+
<RCBlockRenderer :blocks="children" />
|
|
21
|
+
</RCSection>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SectionBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<SectionBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SectionBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UnorderedListBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<UnorderedListBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<UnorderedListBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const { items } = defineProps({
|
|
3
|
+
items: { type: Array, required: true }
|
|
4
|
+
});
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<ul class="ml-6 list-outside list-disc space-y-2">
|
|
9
|
+
<li v-for="item in items" :key="item.id" class="list-item">
|
|
10
|
+
<RCBlockRenderer :blocks="[item]" />
|
|
11
|
+
</li>
|
|
12
|
+
</ul>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UnorderedListBlockProps } from "../../types/blocks.js";
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<UnorderedListBlockProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<UnorderedListBlockProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
href: string;
|
|
3
|
+
target?: string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const { href, target, content } = defineProps({
|
|
4
|
+
href: { type: String, required: true },
|
|
5
|
+
target: { type: String, required: false },
|
|
6
|
+
content: { type: String, required: true }
|
|
7
|
+
});
|
|
8
|
+
const rel = computed(
|
|
9
|
+
() => target === "_blank" ? "noopener noreferrer" : void 0
|
|
10
|
+
);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<ULink :to="href" :target="target" :rel="rel">{{ content }}</ULink>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
href: string;
|
|
3
|
+
target?: string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
href: string;
|
|
3
|
+
target?: string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const { href, target, content } = defineProps({
|
|
4
|
+
href: { type: String, required: true },
|
|
5
|
+
target: { type: String, required: false },
|
|
6
|
+
content: { type: String, required: true }
|
|
7
|
+
});
|
|
8
|
+
const rel = computed(
|
|
9
|
+
() => target === "_blank" ? "noopener noreferrer" : void 0
|
|
10
|
+
);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<ULink
|
|
15
|
+
:to="href"
|
|
16
|
+
:target="target"
|
|
17
|
+
:rel="rel"
|
|
18
|
+
class="rounded-md bg-secondary-700 px-1.5 py-0.5 text-secondary-300"
|
|
19
|
+
>
|
|
20
|
+
{{ content }}
|
|
21
|
+
</ULink>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
href: string;
|
|
3
|
+
target?: string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
content: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
content: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Block } from "../../types/blocks.js";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blocks: Block[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import {} from "vue";
|
|
3
|
+
import { getBlockComponent } from "../../utils/blockMapper";
|
|
4
|
+
const { blocks } = defineProps({
|
|
5
|
+
blocks: { type: Array, required: true }
|
|
6
|
+
});
|
|
7
|
+
const getComponent = (block) => {
|
|
8
|
+
if (!block || !block.type || block.type.length === 0) {
|
|
9
|
+
console.error("Block object is missing the critical 'type' field.");
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const resolvedComponent = getBlockComponent(block.type);
|
|
13
|
+
if (!resolvedComponent) {
|
|
14
|
+
console.error(`Component resolution failed for block type: ${block.type}`);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return resolvedComponent;
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div class="gap-lg flex flex-col">
|
|
23
|
+
<UEmpty
|
|
24
|
+
v-if="!blocks || blocks.length === 0"
|
|
25
|
+
variant="naked"
|
|
26
|
+
icon="lucide:blocks"
|
|
27
|
+
title="No blocks found for this page."
|
|
28
|
+
description="It looks like there isn't any content added to this page yet."
|
|
29
|
+
/>
|
|
30
|
+
<template v-else v-for="block in blocks" :key="block.id">
|
|
31
|
+
<template v-if="getComponent(block)">
|
|
32
|
+
<component
|
|
33
|
+
:is="getComponent(block)"
|
|
34
|
+
v-bind="block.props"
|
|
35
|
+
:key="block.id"
|
|
36
|
+
:type="block.type"
|
|
37
|
+
class="block-container"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
40
|
+
<template v-else>
|
|
41
|
+
<UAlert
|
|
42
|
+
color="error"
|
|
43
|
+
variant="subtle"
|
|
44
|
+
icon="lucide:octagon-alert"
|
|
45
|
+
title="Rendering Error"
|
|
46
|
+
:description="`Block component for type \'${block.type || 'UNKNOWN_OR_MISSING'}\' was not found. This block will be skipped or the type is invalid/empty.`"
|
|
47
|
+
/>
|
|
48
|
+
</template>
|
|
49
|
+
</template>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Block } from "../../types/blocks.js";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blocks: Block[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Block } from "../../types/blocks.js";
|
|
2
|
+
import type { HeadingLevel } from "../../types/blocks.js";
|
|
3
|
+
export interface TOCItem {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
level: HeadingLevel;
|
|
7
|
+
children?: TOCItem[];
|
|
8
|
+
}
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
pageBlocks: Block[];
|
|
11
|
+
title?: string;
|
|
12
|
+
levels?: HeadingLevel[];
|
|
13
|
+
};
|
|
14
|
+
declare var __VLS_6: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
bottom?: (props: typeof __VLS_6) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { slugify } from "../../utils/slugify";
|
|
4
|
+
const {
|
|
5
|
+
pageBlocks,
|
|
6
|
+
title = "table_of_contents",
|
|
7
|
+
levels = [2, 3, 4]
|
|
8
|
+
} = defineProps({
|
|
9
|
+
pageBlocks: { type: Array, required: true },
|
|
10
|
+
title: { type: String, required: false },
|
|
11
|
+
levels: { type: Array, required: false }
|
|
12
|
+
});
|
|
13
|
+
const extractHeadings = (blocks) => {
|
|
14
|
+
const headings = [];
|
|
15
|
+
if (!blocks || blocks.length === 0) {
|
|
16
|
+
return headings;
|
|
17
|
+
}
|
|
18
|
+
for (const block of blocks) {
|
|
19
|
+
if (block.type === "SectionBlock") {
|
|
20
|
+
const props = block.props;
|
|
21
|
+
const title2 = props.title;
|
|
22
|
+
const level = props.level;
|
|
23
|
+
if (title2 && level) {
|
|
24
|
+
headings.push({
|
|
25
|
+
id: slugify(title2),
|
|
26
|
+
title: title2,
|
|
27
|
+
level
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (props.children && props.children.length > 0) {
|
|
31
|
+
headings.push(...extractHeadings(props.children));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return headings;
|
|
36
|
+
};
|
|
37
|
+
const tocItems = computed(() => {
|
|
38
|
+
if (!pageBlocks || pageBlocks.length === 0) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
if (levels.length === 0) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const allHeadings = extractHeadings(pageBlocks);
|
|
45
|
+
const filteredHeadings = allHeadings.filter(
|
|
46
|
+
(item) => levels.includes(item.level)
|
|
47
|
+
);
|
|
48
|
+
return Array.from(new Set(filteredHeadings.map((h) => h.id))).map(
|
|
49
|
+
(id) => filteredHeadings.find((h) => h.id === id)
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<div class="z-10 flex flex-col gap-md">
|
|
56
|
+
<nav
|
|
57
|
+
class="sticky top-(--ui-header-height) z-50 flex flex-col gap-md pt-lg"
|
|
58
|
+
aria-label="Table of Contents"
|
|
59
|
+
>
|
|
60
|
+
<h5 class="text-highlighted">
|
|
61
|
+
{{ $t(title) }}
|
|
62
|
+
</h5>
|
|
63
|
+
|
|
64
|
+
<ul
|
|
65
|
+
v-if="tocItems.length > 0"
|
|
66
|
+
class="flex flex-col gap-0 border-s border-default"
|
|
67
|
+
>
|
|
68
|
+
<li
|
|
69
|
+
v-for="item in tocItems"
|
|
70
|
+
:key="item.id"
|
|
71
|
+
class="relative flex min-w-0"
|
|
72
|
+
:class="{
|
|
73
|
+
'ms-2': item.level === 2,
|
|
74
|
+
'ms-4': item.level === 3,
|
|
75
|
+
'ms-6': item.level === 4,
|
|
76
|
+
'ms-8': item.level === 5,
|
|
77
|
+
'ms-10': item.level === 6
|
|
78
|
+
}"
|
|
79
|
+
>
|
|
80
|
+
<NuxtLink
|
|
81
|
+
:href="`#${item.id}`"
|
|
82
|
+
class="group relative flex size-full items-center px-1.5 py-1.5 text-start text-sm font-medium before:absolute before:inset-x-0 before:inset-y-px before:z-[-1] before:rounded-md focus:outline-none focus-visible:outline-none focus-visible:before:ring-2 focus-visible:before:ring-inset dark:focus-visible:outline-none"
|
|
83
|
+
>
|
|
84
|
+
<span class="truncate">
|
|
85
|
+
{{ item.title }}
|
|
86
|
+
</span>
|
|
87
|
+
</NuxtLink>
|
|
88
|
+
</li>
|
|
89
|
+
</ul>
|
|
90
|
+
|
|
91
|
+
<slot name="bottom" />
|
|
92
|
+
</nav>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Block } from "../../types/blocks.js";
|
|
2
|
+
import type { HeadingLevel } from "../../types/blocks.js";
|
|
3
|
+
export interface TOCItem {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
level: HeadingLevel;
|
|
7
|
+
children?: TOCItem[];
|
|
8
|
+
}
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
pageBlocks: Block[];
|
|
11
|
+
title?: string;
|
|
12
|
+
levels?: HeadingLevel[];
|
|
13
|
+
};
|
|
14
|
+
declare var __VLS_6: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
bottom?: (props: typeof __VLS_6) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type RichTextContent } from "../../types/blocks.js";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
content: RichTextContent;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import {
|
|
3
|
+
} from "../../types/blocks";
|
|
4
|
+
import TextNode from "../nodes/TextNode.vue";
|
|
5
|
+
import LinkNode from "../nodes/LinkNode.vue";
|
|
6
|
+
import MentionNode from "../nodes/MentionNode.vue";
|
|
7
|
+
defineOptions({
|
|
8
|
+
name: "TextRenderer"
|
|
9
|
+
});
|
|
10
|
+
const { content } = defineProps({
|
|
11
|
+
content: { type: Array, required: true }
|
|
12
|
+
});
|
|
13
|
+
const getTag = (item) => {
|
|
14
|
+
switch (item.type) {
|
|
15
|
+
case "text":
|
|
16
|
+
return TextNode;
|
|
17
|
+
case "link":
|
|
18
|
+
return LinkNode;
|
|
19
|
+
case "mention":
|
|
20
|
+
return MentionNode;
|
|
21
|
+
default:
|
|
22
|
+
return TextNode;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const getProps = (item) => {
|
|
26
|
+
switch (item.type) {
|
|
27
|
+
case "text": {
|
|
28
|
+
const textProps = item.props;
|
|
29
|
+
return {
|
|
30
|
+
content: textProps.content
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
case "link": {
|
|
34
|
+
const linkProps = item.props;
|
|
35
|
+
return {
|
|
36
|
+
href: linkProps.href,
|
|
37
|
+
target: linkProps.target || void 0,
|
|
38
|
+
content: linkProps.content
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
case "mention": {
|
|
42
|
+
const mentionProps = item.props;
|
|
43
|
+
return {
|
|
44
|
+
href: mentionProps.href,
|
|
45
|
+
target: mentionProps.target,
|
|
46
|
+
content: mentionProps.content
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
default:
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<template v-for="item in content" :key="item.id">
|
|
57
|
+
<component :is="getTag(item)" v-bind="getProps(item)" />
|
|
58
|
+
</template>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type RichTextContent } from "../../types/blocks.js";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
content: RichTextContent;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the allowed heading levels (h2 through h6) for the Table of Contents.
|
|
3
|
+
*/
|
|
4
|
+
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
+
/**
|
|
6
|
+
* All valid block types the application can render.
|
|
7
|
+
* This union type is the single source of truth for component names.
|
|
8
|
+
*/
|
|
9
|
+
export type BlockType = "SectionBlock" | "ParagraphBlock" | "CalloutBlock" | "ImageBlock" | "QuoteBlock" | "UnorderedListBlock" | "CardBlock" | "CollapsibleCardBlock";
|
|
10
|
+
/**
|
|
11
|
+
* Defines the common structure for any content block object.
|
|
12
|
+
* The 'type' must be one of the registered BlockType values.
|
|
13
|
+
*/
|
|
14
|
+
export interface BaseContentBlock {
|
|
15
|
+
id: string;
|
|
16
|
+
type: BlockType;
|
|
17
|
+
props: Record<string, any>;
|
|
18
|
+
}
|
|
19
|
+
export interface SectionBlockProps {
|
|
20
|
+
level: HeadingLevel;
|
|
21
|
+
title: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
children: Block[];
|
|
24
|
+
}
|
|
25
|
+
export interface ParagraphBlockProps {
|
|
26
|
+
text: RichTextContent;
|
|
27
|
+
}
|
|
28
|
+
export interface CalloutBlockProps {
|
|
29
|
+
variant: "info" | "success" | "warning" | "error" | "commentary" | "ideation" | "source";
|
|
30
|
+
children: Block[];
|
|
31
|
+
to?: string;
|
|
32
|
+
target?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ImageBlockProps {
|
|
35
|
+
src: string;
|
|
36
|
+
alt: string;
|
|
37
|
+
caption?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface QuoteBlockProps {
|
|
40
|
+
quote: string;
|
|
41
|
+
source?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface UnorderedListBlockProps {
|
|
44
|
+
items: Block[];
|
|
45
|
+
}
|
|
46
|
+
export interface CardBlockProps {
|
|
47
|
+
title: string;
|
|
48
|
+
to?: string;
|
|
49
|
+
target?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
children: Block[];
|
|
52
|
+
}
|
|
53
|
+
export interface CollapsibleCardBlockProps {
|
|
54
|
+
openText: string;
|
|
55
|
+
closeText: string;
|
|
56
|
+
name?: string;
|
|
57
|
+
children: Block[];
|
|
58
|
+
}
|
|
59
|
+
export interface SectionContentBlock extends BaseContentBlock {
|
|
60
|
+
type: "SectionBlock";
|
|
61
|
+
props: SectionBlockProps;
|
|
62
|
+
}
|
|
63
|
+
export interface ParagraphContentBlock extends BaseContentBlock {
|
|
64
|
+
type: "ParagraphBlock";
|
|
65
|
+
props: ParagraphBlockProps;
|
|
66
|
+
}
|
|
67
|
+
export interface CalloutContentBlock extends BaseContentBlock {
|
|
68
|
+
type: "CalloutBlock";
|
|
69
|
+
props: CalloutBlockProps;
|
|
70
|
+
}
|
|
71
|
+
export interface ImageContentBlock extends BaseContentBlock {
|
|
72
|
+
type: "ImageBlock";
|
|
73
|
+
props: ImageBlockProps;
|
|
74
|
+
}
|
|
75
|
+
export interface UnorderedListContentBlock extends BaseContentBlock {
|
|
76
|
+
type: "UnorderedListBlock";
|
|
77
|
+
props: UnorderedListBlockProps;
|
|
78
|
+
}
|
|
79
|
+
export interface CardBlockContent extends BaseContentBlock {
|
|
80
|
+
type: "CardBlock";
|
|
81
|
+
props: CardBlockProps;
|
|
82
|
+
}
|
|
83
|
+
export interface CollapsibleCardContentBlock extends BaseContentBlock {
|
|
84
|
+
type: "CollapsibleCardBlock";
|
|
85
|
+
props: CollapsibleCardBlockProps;
|
|
86
|
+
}
|
|
87
|
+
export interface QuoteContentBlock extends BaseContentBlock {
|
|
88
|
+
type: "QuoteBlock";
|
|
89
|
+
props: QuoteBlockProps;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The full union type for a single block. This allows for type-checking the
|
|
93
|
+
* payload based on the block 'type'.
|
|
94
|
+
*/
|
|
95
|
+
export type Block = SectionContentBlock | ParagraphContentBlock | CalloutContentBlock | ImageContentBlock | QuoteContentBlock | UnorderedListContentBlock | CardBlockContent | CollapsibleCardContentBlock;
|
|
96
|
+
/**
|
|
97
|
+
* Text Rendering Components
|
|
98
|
+
*/
|
|
99
|
+
export type InlineContentType = "text" | "link" | "mention";
|
|
100
|
+
/**
|
|
101
|
+
* Defines the common structure for any inline content object.
|
|
102
|
+
*/
|
|
103
|
+
export interface BaseInlineContent {
|
|
104
|
+
type: InlineContentType;
|
|
105
|
+
id: string;
|
|
106
|
+
props: Record<string, any>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Represents a segment of plain text.
|
|
110
|
+
*/
|
|
111
|
+
export interface InlineText extends BaseInlineContent {
|
|
112
|
+
type: "text";
|
|
113
|
+
props: {
|
|
114
|
+
content: string;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Represents a hyperlink.
|
|
119
|
+
*/
|
|
120
|
+
export interface InlineLink extends BaseInlineContent {
|
|
121
|
+
type: "link";
|
|
122
|
+
props: {
|
|
123
|
+
href: string;
|
|
124
|
+
target?: "_blank" | "_self";
|
|
125
|
+
content: string;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Represents a mention of an internal page or user.
|
|
130
|
+
*/
|
|
131
|
+
export interface InlineMention extends BaseInlineContent {
|
|
132
|
+
type: "mention";
|
|
133
|
+
props: {
|
|
134
|
+
href: string;
|
|
135
|
+
target?: "_blank" | "_self";
|
|
136
|
+
content: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The full union type for a single inline content element.
|
|
141
|
+
*/
|
|
142
|
+
export type InlineContent = InlineText | InlineLink | InlineMention;
|
|
143
|
+
/**
|
|
144
|
+
* The top-level type for a block's rich text field.
|
|
145
|
+
*/
|
|
146
|
+
export type RichTextContent = InlineContent[];
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Component } from "vue";
|
|
2
|
+
import { type BlockType } from "../types/blocks.js";
|
|
3
|
+
/**
|
|
4
|
+
* Maps the block type string from the database to a dynamically imported Vue component.
|
|
5
|
+
*
|
|
6
|
+
* @param type The BlockType string from the content JSON (e.g., 'ParagraphBlock').
|
|
7
|
+
* @returns A lazily loaded Vue component reference, or undefined if not found.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getBlockComponent: (type: BlockType | string) => Component | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineAsyncComponent } from "vue";
|
|
2
|
+
const BLOCK_COMPONENTS = import.meta.glob(
|
|
3
|
+
"../components/blocks/*.vue"
|
|
4
|
+
);
|
|
5
|
+
const typeToRelativePath = (type) => {
|
|
6
|
+
return `/components/blocks/${type}.vue`;
|
|
7
|
+
};
|
|
8
|
+
export const getBlockComponent = (type) => {
|
|
9
|
+
const componentPath = typeToRelativePath(type);
|
|
10
|
+
const componentImporter = BLOCK_COMPONENTS[componentPath];
|
|
11
|
+
if (!componentImporter) {
|
|
12
|
+
console.warn(
|
|
13
|
+
`[BlockMapper] Block component not found for type: ${type}. Expected path: ${componentPath}`
|
|
14
|
+
);
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
return defineAsyncComponent(async () => {
|
|
18
|
+
const module = await componentImporter();
|
|
19
|
+
return module.default;
|
|
20
|
+
});
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rimelight-components",
|
|
3
3
|
"description": "My new Nuxt module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/Rimelight-Entertainment/rimelight-components.git"
|
|
@@ -65,15 +65,15 @@
|
|
|
65
65
|
"@nuxt/kit": "^4.2.0",
|
|
66
66
|
"@nuxt/ui": "^4.1.0",
|
|
67
67
|
"@nuxtjs/i18n": "^10.1.2",
|
|
68
|
-
"@vueuse/core": "^
|
|
69
|
-
"@vueuse/nuxt": "^
|
|
68
|
+
"@vueuse/core": "^14.0.0",
|
|
69
|
+
"@vueuse/nuxt": "^14.0.0",
|
|
70
70
|
"date-fns": "^4.1.0",
|
|
71
71
|
"nuxt": "^4.2.0",
|
|
72
72
|
"tailwind-variants": "^3.1.1",
|
|
73
73
|
"vue": "^3.5.22"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@nuxt/devtools": "^
|
|
76
|
+
"@nuxt/devtools": "^3.0.1",
|
|
77
77
|
"@nuxt/module-builder": "^1.0.2",
|
|
78
78
|
"@nuxt/schema": "^4.2.0",
|
|
79
79
|
"@nuxt/test-utils": "^3.20.1",
|
|
@@ -85,19 +85,16 @@
|
|
|
85
85
|
"motion-v": "^1.7.4",
|
|
86
86
|
"oxlint": "^1.25.0",
|
|
87
87
|
"prettier": "^3.6.2",
|
|
88
|
-
"prettier-plugin-tailwindcss": "^0.
|
|
88
|
+
"prettier-plugin-tailwindcss": "^0.7.1",
|
|
89
89
|
"release-it": "^19.0.5",
|
|
90
90
|
"tailwind-merge": "^3.3.1",
|
|
91
91
|
"tw-animate-css": "^1.4.0",
|
|
92
92
|
"typescript": "~5.9.3",
|
|
93
|
-
"vitest": "^
|
|
93
|
+
"vitest": "^4.0.6",
|
|
94
94
|
"vue-tsc": "^3.1.2"
|
|
95
95
|
},
|
|
96
96
|
"trustedDependencies": [
|
|
97
97
|
"@parcel/watcher",
|
|
98
98
|
"@tailwindcss/oxide"
|
|
99
|
-
]
|
|
100
|
-
"npm": {
|
|
101
|
-
"skipChecks": true
|
|
102
|
-
}
|
|
99
|
+
]
|
|
103
100
|
}
|