rimelight-components 1.9.0 → 2.0.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 +4 -7
- package/dist/module.d.mts +6 -0
- package/dist/module.json +3 -2
- package/dist/module.mjs +63 -5
- package/dist/runtime/components/app/Footer.vue +3 -3
- package/dist/runtime/components/app/NewsletterSignup.vue +1 -5
- package/dist/runtime/components/app/ScrollToTop.vue +1 -1
- package/dist/runtime/components/blocks/ImageBlock.vue +1 -1
- package/dist/runtime/components/blocks/SectionBlock.vue +1 -1
- package/dist/runtime/components/cards/TeamCard.vue +17 -17
- package/dist/runtime/components/content/Section.vue +4 -1
- package/dist/runtime/components/page/PageSurround.vue +12 -12
- package/dist/runtime/components/renderers/BlockRenderer.vue +1 -1
- 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/swatches/ColorSwatch.vue +7 -5
- package/dist/runtime/components/swatches/FontSwatch.vue +3 -3
- package/dist/runtime/components/swatches/ImageSwatch.vue +2 -2
- package/dist/runtime/components/utilities/Placeholder.vue +30 -30
- package/dist/runtime/server/tsconfig.json +1 -1
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/blocks.d.ts +5 -1
- package/dist/runtime/utils/blockMapper.js +3 -9
- package/dist/runtime/utils/index.js +1 -1
- package/dist/types.d.mts +2 -6
- package/package.json +36 -13
- package/dist/runtime/utils/slugify.d.ts +0 -6
- package/dist/runtime/utils/slugify.js +0 -3
package/README.md
CHANGED
|
@@ -17,12 +17,13 @@ Find and replace all on all files (CMD+SHIFT+F):
|
|
|
17
17
|
My new Nuxt module for doing amazing things.
|
|
18
18
|
|
|
19
19
|
- [✨ Release Notes](/CHANGELOG.md)
|
|
20
|
-
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
|
|
21
|
-
<!-- - [📖 Documentation](https://example.com) -->
|
|
20
|
+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
|
|
21
|
+
<!-- - [📖 Documentation](https://example.com) -->
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
25
|
<!-- Highlight some of the features your module provide here -->
|
|
26
|
+
|
|
26
27
|
- ⛰ Foo
|
|
27
28
|
- 🚠 Bar
|
|
28
29
|
- 🌲 Baz
|
|
@@ -37,7 +38,6 @@ npx nuxi module add my-module
|
|
|
37
38
|
|
|
38
39
|
That's it! You can now use My Module in your Nuxt app ✨
|
|
39
40
|
|
|
40
|
-
|
|
41
41
|
## Contribution
|
|
42
42
|
|
|
43
43
|
<details>
|
|
@@ -69,16 +69,13 @@ That's it! You can now use My Module in your Nuxt app ✨
|
|
|
69
69
|
|
|
70
70
|
</details>
|
|
71
71
|
|
|
72
|
-
|
|
73
72
|
<!-- Badges -->
|
|
73
|
+
|
|
74
74
|
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
|
|
75
75
|
[npm-version-href]: https://npmjs.com/package/my-module
|
|
76
|
-
|
|
77
76
|
[npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
78
77
|
[npm-downloads-href]: https://npm.chart.dev/my-module
|
|
79
|
-
|
|
80
78
|
[license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
|
|
81
79
|
[license-href]: https://npmjs.com/package/my-module
|
|
82
|
-
|
|
83
80
|
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
|
|
84
81
|
[nuxt-href]: https://nuxt.com
|
package/dist/module.d.mts
CHANGED
|
@@ -6,6 +6,11 @@ interface CalloutOptions {
|
|
|
6
6
|
tooltip: string;
|
|
7
7
|
}
|
|
8
8
|
interface ModuleOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Prefix for components
|
|
11
|
+
* @defaultValue `RC`
|
|
12
|
+
*/
|
|
13
|
+
prefix?: string;
|
|
9
14
|
callouts: {
|
|
10
15
|
info: CalloutOptions;
|
|
11
16
|
success: CalloutOptions;
|
|
@@ -19,3 +24,4 @@ interface ModuleOptions {
|
|
|
19
24
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
20
25
|
|
|
21
26
|
export { _default as default };
|
|
27
|
+
export type { ModuleOptions };
|
package/dist/module.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rimelight-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"docs": "https://rimelight.com/tools/rimelight-components",
|
|
4
5
|
"configKey": "rimelightComponents",
|
|
5
6
|
"compatibility": {
|
|
6
7
|
"nuxt": ">=4.0.0"
|
|
7
8
|
},
|
|
8
9
|
"builder": {
|
|
9
10
|
"@nuxt/module-builder": "1.0.2",
|
|
10
|
-
"unbuild": "
|
|
11
|
+
"unbuild": "3.6.1"
|
|
11
12
|
}
|
|
12
13
|
}
|
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
1
|
+
import { addTemplate, defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
+
import { defu } from 'defu';
|
|
3
|
+
import { readdirSync } from 'node:fs';
|
|
4
|
+
import { basename } from 'node:path';
|
|
5
|
+
|
|
6
|
+
const name = "rimelight-components";
|
|
7
|
+
const version = "2.0.1";
|
|
8
|
+
const homepage = "https://rimelight.com/tools/rimelight-components";
|
|
2
9
|
|
|
3
10
|
const defaultOptions = {
|
|
11
|
+
prefix: "RC",
|
|
4
12
|
callouts: {
|
|
5
13
|
info: {
|
|
6
14
|
icon: "lucide:shield-alert",
|
|
@@ -39,10 +47,48 @@ const defaultOptions = {
|
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
49
|
};
|
|
50
|
+
|
|
51
|
+
function addBlockMapTemplates(blockNames, resolver) {
|
|
52
|
+
const template = addTemplate({
|
|
53
|
+
filename: "rimelight-blocks-map.mjs",
|
|
54
|
+
getContents: () => {
|
|
55
|
+
let content = "export const BLOCK_COMPONENT_MAP = {\n";
|
|
56
|
+
blockNames.forEach((name) => {
|
|
57
|
+
const componentPath = `rimelight-components/runtime/components/blocks/${name}.vue`;
|
|
58
|
+
content += ` '${name}': () => import('${componentPath}'),
|
|
59
|
+
`;
|
|
60
|
+
});
|
|
61
|
+
content += "}\n";
|
|
62
|
+
return content;
|
|
63
|
+
},
|
|
64
|
+
write: true
|
|
65
|
+
});
|
|
66
|
+
addTemplate({
|
|
67
|
+
filename: "rimelight-blocks-map.d.ts",
|
|
68
|
+
getContents: () => {
|
|
69
|
+
const componentImporterType = '() => Promise<{ default: import("vue").Component }>';
|
|
70
|
+
let content = `// Generated by rimelight-components Nuxt Module
|
|
71
|
+
`;
|
|
72
|
+
content += `import { Component } from 'vue'
|
|
73
|
+
`;
|
|
74
|
+
content += `export declare const BLOCK_COMPONENT_MAP: { [key: string]: ${componentImporterType} | undefined }
|
|
75
|
+
`;
|
|
76
|
+
blockNames.forEach((name) => {
|
|
77
|
+
content += `export declare const ${name}: ${componentImporterType}
|
|
78
|
+
`;
|
|
79
|
+
});
|
|
80
|
+
return content;
|
|
81
|
+
},
|
|
82
|
+
write: true
|
|
83
|
+
});
|
|
84
|
+
return template;
|
|
85
|
+
}
|
|
86
|
+
|
|
42
87
|
const module = defineNuxtModule({
|
|
43
88
|
meta: {
|
|
44
|
-
name
|
|
45
|
-
version
|
|
89
|
+
name,
|
|
90
|
+
version,
|
|
91
|
+
docs: homepage,
|
|
46
92
|
configKey: "rimelightComponents",
|
|
47
93
|
compatibility: {
|
|
48
94
|
nuxt: ">=4.0.0"
|
|
@@ -100,14 +146,26 @@ const module = defineNuxtModule({
|
|
|
100
146
|
},
|
|
101
147
|
setup(options, nuxt) {
|
|
102
148
|
const resolver = createResolver(import.meta.url);
|
|
103
|
-
nuxt.options.appConfig.rimelightComponents =
|
|
149
|
+
nuxt.options.appConfig.rimelightComponents = defu(
|
|
150
|
+
nuxt.options.appConfig.rimelightComponents || {},
|
|
151
|
+
options
|
|
152
|
+
);
|
|
104
153
|
addComponentsDir({
|
|
105
154
|
path: resolver.resolve("./runtime/components/"),
|
|
106
155
|
pathPrefix: false,
|
|
107
|
-
prefix:
|
|
156
|
+
prefix: options.prefix,
|
|
108
157
|
global: true
|
|
109
158
|
});
|
|
110
159
|
addImportsDir(resolver.resolve("./runtime/composables"));
|
|
160
|
+
addImportsDir(resolver.resolve("./runtime/types"));
|
|
161
|
+
addImportsDir(resolver.resolve("./runtime/utils"));
|
|
162
|
+
const blocksPath = resolver.resolve("./runtime/components/blocks");
|
|
163
|
+
const blockFiles = readdirSync(blocksPath).filter(
|
|
164
|
+
(name2) => name2.endsWith(".vue")
|
|
165
|
+
);
|
|
166
|
+
const blockNames = blockFiles.map((file) => basename(file, ".vue"));
|
|
167
|
+
const template = addBlockMapTemplates(blockNames);
|
|
168
|
+
nuxt.options.alias["#build/rimelight-blocks-map"] = template.dst;
|
|
111
169
|
},
|
|
112
170
|
onInstall() {
|
|
113
171
|
console.log("Setting up rimelight-components for the first time!");
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
<template>
|
|
4
4
|
<footer class="py-8 lg:py-12">
|
|
5
|
-
<UContainer class="
|
|
5
|
+
<UContainer class="flex flex-col justify-between gap-xl lg:flex-row">
|
|
6
6
|
<div
|
|
7
|
-
class="
|
|
7
|
+
class="order-last flex flex-col items-center justify-between gap-xl lg:order-1 lg:items-start"
|
|
8
8
|
>
|
|
9
9
|
<slot name="left" />
|
|
10
10
|
</div>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<slot name="center" />
|
|
13
13
|
</div>
|
|
14
14
|
<div
|
|
15
|
-
class="
|
|
15
|
+
class="order-first flex flex-col items-center justify-between gap-xl lg:order-3 lg:flex-1 lg:items-end"
|
|
16
16
|
>
|
|
17
17
|
<slot name="right" />
|
|
18
18
|
</div>
|
|
@@ -14,11 +14,7 @@ const {
|
|
|
14
14
|
|
|
15
15
|
<template>
|
|
16
16
|
<UForm>
|
|
17
|
-
<UFormField
|
|
18
|
-
name="email"
|
|
19
|
-
:label="fieldLabel"
|
|
20
|
-
:description="description"
|
|
21
|
-
>
|
|
17
|
+
<UFormField name="email" :label="fieldLabel" :description="description">
|
|
22
18
|
<UFieldGroup class="pt-2">
|
|
23
19
|
<UInput type="email" :placeholder="placeholder" />
|
|
24
20
|
<UButton type="submit" :label="buttonLabel" />
|
|
@@ -55,7 +55,7 @@ const durationInSeconds = computed(() => `${props.duration}s`);
|
|
|
55
55
|
<div v-if="isVisible">
|
|
56
56
|
<UButton
|
|
57
57
|
variant="ghost"
|
|
58
|
-
class="fixed
|
|
58
|
+
class="fixed right-4 bottom-4 z-50 size-20 lg:size-16"
|
|
59
59
|
@click="scrollToTop"
|
|
60
60
|
>
|
|
61
61
|
<div class="progress-circle-base size-full">
|
|
@@ -9,7 +9,7 @@ const { src, alt, caption } = defineProps({
|
|
|
9
9
|
<template>
|
|
10
10
|
<figure class="mx-auto">
|
|
11
11
|
<img :src="src" :alt="alt" class="h-auto w-full object-cover" />
|
|
12
|
-
<figcaption v-if="caption" class="
|
|
12
|
+
<figcaption v-if="caption" class="mt-4 text-center text-sm text-muted">
|
|
13
13
|
{{ caption }}
|
|
14
14
|
</figcaption>
|
|
15
15
|
</figure>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
-
import { slugify } from "../../utils
|
|
3
|
+
import { slugify } from "../../utils";
|
|
4
4
|
const { level, title, description, children } = defineProps({
|
|
5
5
|
level: { type: Number, required: true },
|
|
6
6
|
title: { type: String, required: true },
|
|
@@ -9,21 +9,21 @@ const {} = defineProps({
|
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<template>
|
|
12
|
-
<UCard>
|
|
13
|
-
<NuxtImg :src="src" :alt="alt" />
|
|
14
|
-
<div class="flex flex-col gap-xs">
|
|
15
|
-
<h3 class="text-xl font-bold">
|
|
16
|
-
{{ name }}
|
|
17
|
-
</h3>
|
|
18
|
-
<span class="text-sm">{{ role }}</span>
|
|
19
|
-
</div>
|
|
20
|
-
<p class="text-md">
|
|
21
|
-
{{ description }}
|
|
22
|
-
</p>
|
|
23
|
-
<template #footer>
|
|
24
|
-
<div class="flex flex-row gap-md">
|
|
25
|
-
<slot name="links" />
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
</UCard>
|
|
12
|
+
<UCard>
|
|
13
|
+
<NuxtImg :src="src" :alt="alt" />
|
|
14
|
+
<div class="flex flex-col gap-xs">
|
|
15
|
+
<h3 class="text-xl font-bold">
|
|
16
|
+
{{ name }}
|
|
17
|
+
</h3>
|
|
18
|
+
<span class="text-sm">{{ role }}</span>
|
|
19
|
+
</div>
|
|
20
|
+
<p class="text-md">
|
|
21
|
+
{{ description }}
|
|
22
|
+
</p>
|
|
23
|
+
<template #footer>
|
|
24
|
+
<div class="flex flex-row gap-md">
|
|
25
|
+
<slot name="links" />
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
</UCard>
|
|
29
29
|
</template>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useRoute } from "#imports";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useClipboard } from "@vueuse/core";
|
|
5
|
+
import { useToast } from "#imports";
|
|
3
6
|
import { tv } from "tailwind-variants";
|
|
4
7
|
import { slugify } from "../../utils";
|
|
5
8
|
const { copy } = useClipboard();
|
|
@@ -24,21 +24,21 @@ const {
|
|
|
24
24
|
<ULink v-if="previousTitle" :to="previousTo" class="h-full">
|
|
25
25
|
<UCard
|
|
26
26
|
variant="outline"
|
|
27
|
-
class="hover:bg-elevated/50 focus-visible:outline-primary
|
|
27
|
+
class="group block h-full bg-transparent hover:bg-elevated/50 focus-visible:outline-primary"
|
|
28
28
|
>
|
|
29
|
-
<div class="
|
|
30
|
-
<div class="
|
|
29
|
+
<div class="flex flex-col gap-md">
|
|
30
|
+
<div class="flex flex-col gap-xs">
|
|
31
31
|
<UButton
|
|
32
32
|
variant="outline"
|
|
33
33
|
icon="lucide:arrow-left"
|
|
34
|
-
class="group-hover text-primary group-hover:text-highlighted
|
|
34
|
+
class="group-hover w-fit rounded-full text-primary group-hover:text-highlighted"
|
|
35
35
|
/>
|
|
36
36
|
<span class="text-muted">
|
|
37
37
|
{{ $t("navigation_previous") }}
|
|
38
38
|
{{ $t(pageType) }}
|
|
39
39
|
</span>
|
|
40
40
|
</div>
|
|
41
|
-
<div class="
|
|
41
|
+
<div class="flex flex-col gap-xs">
|
|
42
42
|
<p class="text-primary group-hover:text-highlighted">
|
|
43
43
|
{{ previousTitle }}
|
|
44
44
|
</p>
|
|
@@ -54,25 +54,25 @@ const {
|
|
|
54
54
|
<ULink v-if="nextTitle" :to="nextTo" class="h-full">
|
|
55
55
|
<UCard
|
|
56
56
|
variant="outline"
|
|
57
|
-
class="hover:bg-elevated/50 focus-visible:outline-primary
|
|
57
|
+
class="group block h-full bg-transparent hover:bg-elevated/50 focus-visible:outline-primary"
|
|
58
58
|
>
|
|
59
|
-
<div class="
|
|
60
|
-
<div class="
|
|
59
|
+
<div class="flex flex-col items-end gap-md">
|
|
60
|
+
<div class="flex flex-col items-end gap-xs">
|
|
61
61
|
<UButton
|
|
62
62
|
variant="outline"
|
|
63
63
|
icon="lucide:arrow-right"
|
|
64
|
-
class="text-primary group-hover:text-highlighted
|
|
64
|
+
class="w-fit rounded-full text-primary group-hover:text-highlighted"
|
|
65
65
|
/>
|
|
66
66
|
<span class="text-muted">
|
|
67
67
|
{{ $t("navigation_next") }}
|
|
68
68
|
{{ $t(pageType) }}</span
|
|
69
69
|
>
|
|
70
70
|
</div>
|
|
71
|
-
<div class="
|
|
72
|
-
<p class="text-primary group-hover:text-highlighted
|
|
71
|
+
<div class="flex flex-col items-end gap-xs">
|
|
72
|
+
<p class="text-right text-primary group-hover:text-highlighted">
|
|
73
73
|
{{ nextTitle }}
|
|
74
74
|
</p>
|
|
75
|
-
<p class="text-
|
|
75
|
+
<p class="text-right text-toned">
|
|
76
76
|
{{ nextDescription }}
|
|
77
77
|
</p>
|
|
78
78
|
</div>
|
|
@@ -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";
|
|
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
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useClipboard } from "@vueuse/core";
|
|
4
|
+
import { useToast } from "#imports";
|
|
3
5
|
const { copy } = useClipboard();
|
|
4
6
|
const toast = useToast();
|
|
5
7
|
const { name, hex, rgb, hsl, oklch, cmyk } = defineProps({
|
|
@@ -44,12 +46,12 @@ const color = computed(() => {
|
|
|
44
46
|
<template #header v-if="name">
|
|
45
47
|
<h3 class="text-lg font-bold">{{ name }}</h3>
|
|
46
48
|
</template>
|
|
47
|
-
<div class="
|
|
49
|
+
<div class="flex flex-col items-center gap-sm xl:flex-row xl:items-start">
|
|
48
50
|
<div
|
|
49
|
-
class="
|
|
51
|
+
class="flex aspect-square size-48 p-sm"
|
|
50
52
|
:style="{ backgroundColor: color }"
|
|
51
53
|
>
|
|
52
|
-
<div class="
|
|
54
|
+
<div class="flex flex-col justify-end gap-xs text-xs">
|
|
53
55
|
<span v-if="name" class="text-sm">{{ formatColor(name) }}</span>
|
|
54
56
|
<span v-if="hex">HEX {{ formatColor(hex) }}</span>
|
|
55
57
|
<span v-if="rgb">{{ formatColor(rgb) }}</span>
|
|
@@ -58,7 +60,7 @@ const color = computed(() => {
|
|
|
58
60
|
<span v-if="cmyk">{{ formatColor(cmyk) }}</span>
|
|
59
61
|
</div>
|
|
60
62
|
</div>
|
|
61
|
-
<div class="
|
|
63
|
+
<div class="flex w-full flex-col justify-center gap-sm">
|
|
62
64
|
<UButton
|
|
63
65
|
v-if="hex"
|
|
64
66
|
variant="outline"
|
|
@@ -22,7 +22,7 @@ const image = computed(() => {
|
|
|
22
22
|
<h3 class="text-lg font-bold">{{ name }}</h3>
|
|
23
23
|
<span></span>
|
|
24
24
|
</template>
|
|
25
|
-
<div class="
|
|
25
|
+
<div class="flex flex-col gap-sm">
|
|
26
26
|
<h1>H1</h1>
|
|
27
27
|
<p>{{}}</p>
|
|
28
28
|
</div>
|
|
@@ -31,8 +31,8 @@ const image = computed(() => {
|
|
|
31
31
|
<p>a b c d e f g h i j k l m n o p q r s t u v w x y z</p>
|
|
32
32
|
<p>A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</p>
|
|
33
33
|
<p></p>
|
|
34
|
-
<div class="
|
|
35
|
-
<div class="
|
|
34
|
+
<div class="flex flex-col items-center gap-sm xl:flex-row xl:items-start">
|
|
35
|
+
<div class="flex w-full flex-col justify-center gap-sm">
|
|
36
36
|
<UButton
|
|
37
37
|
v-if="jpg"
|
|
38
38
|
variant="outline"
|
|
@@ -21,9 +21,9 @@ const image = computed(() => {
|
|
|
21
21
|
<template #header v-if="name">
|
|
22
22
|
<h3 class="text-lg font-bold">{{ name }}</h3>
|
|
23
23
|
</template>
|
|
24
|
-
<div class="
|
|
24
|
+
<div class="flex flex-col items-center gap-sm xl:flex-row xl:items-start">
|
|
25
25
|
<NuxtImg :src="image" class="size-48" />
|
|
26
|
-
<div class="
|
|
26
|
+
<div class="flex w-full flex-col justify-center gap-sm">
|
|
27
27
|
<UButton
|
|
28
28
|
v-if="jpg"
|
|
29
29
|
variant="outline"
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
<script setup lang="ts"></script>
|
|
2
|
-
|
|
3
|
-
<template>
|
|
4
|
-
<div
|
|
5
|
-
class="relative flex items-center justify-center overflow-hidden rounded-sm border border-dashed border-accented px-4 opacity-75"
|
|
6
|
-
>
|
|
7
|
-
<svg class="absolute inset-0 h-full w-full stroke-inverted/10">
|
|
8
|
-
<defs>
|
|
9
|
-
<pattern
|
|
10
|
-
id="pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e"
|
|
11
|
-
x="0"
|
|
12
|
-
y="0"
|
|
13
|
-
width="10"
|
|
14
|
-
height="10"
|
|
15
|
-
patternUnits="userSpaceOnUse"
|
|
16
|
-
>
|
|
17
|
-
<path d="M-3 13 15-5M-5 5l18-18M-1 21 17 3" />
|
|
18
|
-
</pattern>
|
|
19
|
-
</defs>
|
|
20
|
-
<rect
|
|
21
|
-
stroke="none"
|
|
22
|
-
fill="url(#pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e)"
|
|
23
|
-
width="100%"
|
|
24
|
-
height="100%"
|
|
25
|
-
/>
|
|
26
|
-
</svg>
|
|
27
|
-
|
|
28
|
-
<slot />
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
1
|
+
<script setup lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<template>
|
|
4
|
+
<div
|
|
5
|
+
class="relative flex items-center justify-center overflow-hidden rounded-sm border border-dashed border-accented px-4 opacity-75"
|
|
6
|
+
>
|
|
7
|
+
<svg class="absolute inset-0 h-full w-full stroke-inverted/10">
|
|
8
|
+
<defs>
|
|
9
|
+
<pattern
|
|
10
|
+
id="pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e"
|
|
11
|
+
x="0"
|
|
12
|
+
y="0"
|
|
13
|
+
width="10"
|
|
14
|
+
height="10"
|
|
15
|
+
patternUnits="userSpaceOnUse"
|
|
16
|
+
>
|
|
17
|
+
<path d="M-3 13 15-5M-5 5l18-18M-1 21 17 3" />
|
|
18
|
+
</pattern>
|
|
19
|
+
</defs>
|
|
20
|
+
<rect
|
|
21
|
+
stroke="none"
|
|
22
|
+
fill="url(#pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e)"
|
|
23
|
+
width="100%"
|
|
24
|
+
height="100%"
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
|
|
28
|
+
<slot />
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
@@ -1,3 +1,7 @@
|
|
|
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;
|
|
1
5
|
/**
|
|
2
6
|
* All valid block types the application can render.
|
|
3
7
|
* This union type is the single source of truth for component names.
|
|
@@ -13,7 +17,7 @@ export interface BaseContentBlock {
|
|
|
13
17
|
props: Record<string, any>;
|
|
14
18
|
}
|
|
15
19
|
export interface SectionBlockProps {
|
|
16
|
-
level:
|
|
20
|
+
level: HeadingLevel;
|
|
17
21
|
title: string;
|
|
18
22
|
description?: string;
|
|
19
23
|
children: Block[];
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { defineAsyncComponent } from "vue";
|
|
2
|
-
|
|
3
|
-
"../components/blocks/*.vue"
|
|
4
|
-
);
|
|
5
|
-
const typeToRelativePath = (type) => {
|
|
6
|
-
return `/components/blocks/${type}.vue`;
|
|
7
|
-
};
|
|
2
|
+
import { BLOCK_COMPONENT_MAP } from "#build/rimelight-blocks-map";
|
|
8
3
|
export const getBlockComponent = (type) => {
|
|
9
|
-
const
|
|
10
|
-
const componentImporter = BLOCK_COMPONENTS[componentPath];
|
|
4
|
+
const componentImporter = BLOCK_COMPONENT_MAP[type];
|
|
11
5
|
if (!componentImporter) {
|
|
12
6
|
console.warn(
|
|
13
|
-
`[BlockMapper] Block component not found for type: ${type}.
|
|
7
|
+
`[BlockMapper] Block component not found for type: ${type}. Please check block name.`
|
|
14
8
|
);
|
|
15
9
|
return void 0;
|
|
16
10
|
}
|
|
@@ -7,5 +7,5 @@ export function slugify(text) {
|
|
|
7
7
|
if (!text) {
|
|
8
8
|
return "";
|
|
9
9
|
}
|
|
10
|
-
return text.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/\s+/g, "-").replace(/[^\w
|
|
10
|
+
return text.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/\s+/g, "-").replace(/[^\w-]+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
|
11
11
|
}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { NuxtModule } from '@nuxt/schema'
|
|
2
|
-
|
|
3
|
-
import type { default as Module } from './module.mjs'
|
|
4
|
-
|
|
5
|
-
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
|
-
|
|
7
1
|
export { default } from './module.mjs'
|
|
2
|
+
|
|
3
|
+
export { type ModuleOptions } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"type": "module",
|
|
2
3
|
"name": "rimelight-components",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "
|
|
4
|
+
"description": "A component library by Rimelight Entertainment.",
|
|
5
|
+
"version": "2.0.1",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "git+https://github.com/Rimelight-Entertainment/rimelight-components.git"
|
|
8
9
|
},
|
|
9
10
|
"homepage": "https://rimelight.com/tools/rimelight-components",
|
|
10
|
-
"type": "module",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"rimelight",
|
|
@@ -33,11 +33,30 @@
|
|
|
33
33
|
"import": "./dist/runtime/utils/*.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
+
"style": "./dist/runtime/index.css",
|
|
36
37
|
"main": "./dist/module.mjs",
|
|
37
38
|
"typesVersions": {
|
|
38
39
|
"*": {
|
|
39
40
|
".": [
|
|
40
|
-
"./dist/
|
|
41
|
+
"./dist/module.d.mts"
|
|
42
|
+
],
|
|
43
|
+
"vite": [
|
|
44
|
+
"./dist/vite.d.mts"
|
|
45
|
+
],
|
|
46
|
+
"./runtime/*": [
|
|
47
|
+
"./dist/runtime/index.d.ts"
|
|
48
|
+
],
|
|
49
|
+
"components/*": [
|
|
50
|
+
"./dist/runtime/components/*"
|
|
51
|
+
],
|
|
52
|
+
"composables/*": [
|
|
53
|
+
"./dist/runtime/composables/*"
|
|
54
|
+
],
|
|
55
|
+
"utils": [
|
|
56
|
+
"./dist/runtime/utils/index.d.ts"
|
|
57
|
+
],
|
|
58
|
+
"utils/*": [
|
|
59
|
+
"./dist/runtime/utils/*.d.ts"
|
|
41
60
|
]
|
|
42
61
|
}
|
|
43
62
|
},
|
|
@@ -45,21 +64,21 @@
|
|
|
45
64
|
"dist"
|
|
46
65
|
],
|
|
47
66
|
"scripts": {
|
|
48
|
-
"
|
|
49
|
-
"dev": "bun run dev:prepare &&
|
|
50
|
-
"dev:build": "
|
|
67
|
+
"build": "nuxt-module-build build",
|
|
68
|
+
"dev": "bun run dev:prepare && nuxt dev playground",
|
|
69
|
+
"dev:build": "nuxt build playground",
|
|
51
70
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
52
|
-
"
|
|
71
|
+
"prepack": "bun run build",
|
|
53
72
|
"typecheck": "vue-tsc --noEmit && nuxt typecheck",
|
|
54
73
|
"lint": "oxlint .",
|
|
55
74
|
"lint:fix": "oxlint . --fix",
|
|
75
|
+
"format": "prettier . --check .",
|
|
76
|
+
"format:fix": "prettier . --write .",
|
|
56
77
|
"test": "vitest run",
|
|
57
78
|
"test:watch": "vitest watch",
|
|
58
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
79
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
80
|
+
"release": "bun run lint && bun run test && bun run prepack && changelogen --release && bun publish && git push --follow-tags"
|
|
59
81
|
},
|
|
60
|
-
"workspaces": [
|
|
61
|
-
"playground"
|
|
62
|
-
],
|
|
63
82
|
"dependencies": {
|
|
64
83
|
"@nuxt/image": "^1.11.0",
|
|
65
84
|
"@nuxt/kit": "^4.2.0",
|
|
@@ -68,6 +87,7 @@
|
|
|
68
87
|
"@vueuse/core": "^14.0.0",
|
|
69
88
|
"@vueuse/nuxt": "^14.0.0",
|
|
70
89
|
"date-fns": "^4.1.0",
|
|
90
|
+
"defu": "^6.1.4",
|
|
71
91
|
"nuxt": "^4.2.0",
|
|
72
92
|
"tailwind-variants": "^3.1.1",
|
|
73
93
|
"vue": "^3.5.22"
|
|
@@ -96,5 +116,8 @@
|
|
|
96
116
|
"trustedDependencies": [
|
|
97
117
|
"@parcel/watcher",
|
|
98
118
|
"@tailwindcss/oxide"
|
|
99
|
-
]
|
|
119
|
+
],
|
|
120
|
+
"resolutions": {
|
|
121
|
+
"rimelight-components": "workspace:*"
|
|
122
|
+
}
|
|
100
123
|
}
|