rimelight-components 2.1.79 → 2.1.80
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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/blocks/Block.vue +7 -7
- package/dist/runtime/components/blocks/BlockEditor.vue +5 -5
- package/dist/runtime/components/page/PageEditor.d.vue.ts +11 -1
- package/dist/runtime/components/page/PageEditor.vue +33 -1
- package/dist/runtime/components/page/PageEditor.vue.d.ts +11 -1
- package/dist/runtime/components/page/index.d.ts +1 -0
- package/dist/runtime/components/page/index.js +1 -0
- package/dist/runtime/components/page/index.mjs +1 -0
- package/dist/runtime/components/page/modals/PageTreeModal.vue +44 -42
- package/dist/runtime/types/pages.d.ts +11 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { readdirSync } from 'node:fs';
|
|
|
4
4
|
import { basename } from 'node:path';
|
|
5
5
|
|
|
6
6
|
const name = "rimelight-components";
|
|
7
|
-
const version = "2.1.
|
|
7
|
+
const version = "2.1.80";
|
|
8
8
|
const homepage = "https://rimelight.com/tools/rimelight-components";
|
|
9
9
|
|
|
10
10
|
const defaultOptions = {
|
|
@@ -30,37 +30,37 @@ const items = ref([
|
|
|
30
30
|
{
|
|
31
31
|
icon: "lucide:arrow-up",
|
|
32
32
|
label: "Move Block Up",
|
|
33
|
-
|
|
33
|
+
onSelect: onMoveUp
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
icon: "lucide:arrow-down",
|
|
37
37
|
label: "Move Block Down",
|
|
38
|
-
|
|
38
|
+
onSelect: onMoveDown
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
41
|
[
|
|
42
42
|
{
|
|
43
43
|
icon: "lucide:corner-right-up",
|
|
44
44
|
label: "Add Block Above"
|
|
45
|
-
//
|
|
45
|
+
//onSelect: handleAddBlockAbove
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
icon: "lucide:corner-right-down",
|
|
49
49
|
label: "Add Block Below"
|
|
50
|
-
//
|
|
50
|
+
//onSelect: handleAddBlockBelow
|
|
51
51
|
}
|
|
52
52
|
],
|
|
53
53
|
[
|
|
54
54
|
{
|
|
55
55
|
icon: "lucide:copy-plus",
|
|
56
56
|
label: "Duplicate Block",
|
|
57
|
-
|
|
57
|
+
onSelect: onDuplicate
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
color: "
|
|
60
|
+
color: "danger",
|
|
61
61
|
icon: "lucide:trash-2",
|
|
62
62
|
label: "Delete Block",
|
|
63
|
-
|
|
63
|
+
onSelect: onDelete
|
|
64
64
|
}
|
|
65
65
|
]
|
|
66
66
|
]);
|
|
@@ -36,7 +36,7 @@ const dropdownItems = computed(() => [
|
|
|
36
36
|
blockTypes.map((type) => ({
|
|
37
37
|
label: type.label,
|
|
38
38
|
icon: type.icon,
|
|
39
|
-
|
|
39
|
+
onSelect: () => insertBlock(type.value)
|
|
40
40
|
}))
|
|
41
41
|
]);
|
|
42
42
|
provide("block-editor-api", {
|
|
@@ -59,17 +59,17 @@ defineExpose({ undo, redo, canUndo, canRedo });
|
|
|
59
59
|
|
|
60
60
|
<div class="flex flex-col items-center justify-center p-4 border-t border-neutral-200 dark:border-neutral-800 border-dashed rounded-lg">
|
|
61
61
|
<span class="text-sm text-dimmed mb-2">Append new block to page</span>
|
|
62
|
-
<
|
|
62
|
+
<UDropdownMenu
|
|
63
63
|
:items="dropdownItems"
|
|
64
64
|
>
|
|
65
65
|
<UButton
|
|
66
|
-
color="
|
|
66
|
+
color="neutral"
|
|
67
67
|
label="Add Block"
|
|
68
68
|
trailing-icon="i-heroicons-chevron-down-20-solid"
|
|
69
|
-
variant="
|
|
69
|
+
variant="outline"
|
|
70
70
|
icon="i-lucide-plus"
|
|
71
71
|
/>
|
|
72
|
-
</
|
|
72
|
+
</UDropdownMenu>
|
|
73
73
|
</div>
|
|
74
74
|
</div>
|
|
75
75
|
</template>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Page, type PageSurround, type PageDefinition } from "../../types/index.js";
|
|
1
|
+
import { type Page, type PageSurround, type PageDefinition, type PageVersion } from "../../types/index.js";
|
|
2
2
|
export interface PageEditorProps {
|
|
3
3
|
isSaving: boolean;
|
|
4
4
|
useSurround?: boolean;
|
|
@@ -10,6 +10,9 @@ export interface PageEditorProps {
|
|
|
10
10
|
onDeletePage?: (id: string) => Promise<void>;
|
|
11
11
|
onFetchPages?: () => Promise<Pick<Page, 'title' | 'slug'>[]>;
|
|
12
12
|
onNavigateToPage?: (slug: string) => void;
|
|
13
|
+
currentVersionId?: string | null;
|
|
14
|
+
isViewingVersion?: boolean;
|
|
15
|
+
isAdmin?: boolean;
|
|
13
16
|
rc?: {
|
|
14
17
|
header?: string;
|
|
15
18
|
headerGroup?: string;
|
|
@@ -33,12 +36,15 @@ export interface PageEditorProps {
|
|
|
33
36
|
type __VLS_Props = PageEditorProps;
|
|
34
37
|
export interface PageEditorEmits {
|
|
35
38
|
save: [value: Page];
|
|
39
|
+
'version-navigate': [version: PageVersion];
|
|
36
40
|
}
|
|
37
41
|
export interface PageEditorSlots {
|
|
42
|
+
'header-actions'?: (props: {}) => any;
|
|
38
43
|
}
|
|
39
44
|
type __VLS_Slots = PageEditorSlots;
|
|
40
45
|
type __VLS_ModelProps = {
|
|
41
46
|
modelValue: Page;
|
|
47
|
+
"currentVersionId"?: string | null;
|
|
42
48
|
};
|
|
43
49
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
44
50
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
@@ -55,6 +61,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
55
61
|
type: "Default";
|
|
56
62
|
properties: import("../../types/index.js").BasePageProperties;
|
|
57
63
|
} & import("../../types/index.js").BasePage) => any;
|
|
64
|
+
"version-navigate": (version: PageVersion) => any;
|
|
65
|
+
"update:currentVersionId": (value: string | null) => any;
|
|
58
66
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
59
67
|
onSave?: ((value: {
|
|
60
68
|
type: "Default";
|
|
@@ -64,6 +72,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
64
72
|
type: "Default";
|
|
65
73
|
properties: import("../../types/index.js").BasePageProperties;
|
|
66
74
|
} & import("../../types/index.js").BasePage) => any) | undefined;
|
|
75
|
+
"onVersion-navigate"?: ((version: PageVersion) => any) | undefined;
|
|
76
|
+
"onUpdate:currentVersionId"?: ((value: string | null) => any) | undefined;
|
|
67
77
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
68
78
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
69
79
|
declare const _default: typeof __VLS_export;
|
|
@@ -15,6 +15,9 @@ const {
|
|
|
15
15
|
onDeletePage,
|
|
16
16
|
onFetchPages,
|
|
17
17
|
onNavigateToPage,
|
|
18
|
+
currentVersionId = null,
|
|
19
|
+
isViewingVersion = false,
|
|
20
|
+
isAdmin = false,
|
|
18
21
|
rc: rcProp
|
|
19
22
|
} = defineProps({
|
|
20
23
|
isSaving: { type: Boolean, required: true },
|
|
@@ -27,10 +30,14 @@ const {
|
|
|
27
30
|
onDeletePage: { type: Function, required: false },
|
|
28
31
|
onFetchPages: { type: Function, required: false },
|
|
29
32
|
onNavigateToPage: { type: Function, required: false },
|
|
33
|
+
currentVersionId: { type: [String, null], required: false },
|
|
34
|
+
isViewingVersion: { type: Boolean, required: false },
|
|
35
|
+
isAdmin: { type: Boolean, required: false },
|
|
30
36
|
rc: { type: Object, required: false }
|
|
31
37
|
});
|
|
32
38
|
const page = defineModel({ type: null, ...{ required: true } });
|
|
33
|
-
const
|
|
39
|
+
const versionId = defineModel("currentVersionId", { type: [String, null], ...{ default: null } });
|
|
40
|
+
const emit = defineEmits(["save", "version-navigate"]);
|
|
34
41
|
const slots = defineSlots();
|
|
35
42
|
const { rc } = useRC("PageEditor", rcProp);
|
|
36
43
|
const pageEditorStyles = tv({
|
|
@@ -174,6 +181,23 @@ const handleTreeNavigate = (slug) => {
|
|
|
174
181
|
</script>
|
|
175
182
|
|
|
176
183
|
<template>
|
|
184
|
+
<div
|
|
185
|
+
v-if="isViewingVersion"
|
|
186
|
+
class="fixed top-12 left-0 right-0 z-40 bg-warning-500 text-white px-4 py-2 text-sm text-center"
|
|
187
|
+
>
|
|
188
|
+
<div class="flex items-center justify-center gap-2">
|
|
189
|
+
<UIcon name="lucide:eye" />
|
|
190
|
+
<span>Viewing a previous version. Changes made here will create a new version.</span>
|
|
191
|
+
<UButton
|
|
192
|
+
icon="lucide:x"
|
|
193
|
+
color="neutral"
|
|
194
|
+
variant="ghost"
|
|
195
|
+
size="xs"
|
|
196
|
+
@click="versionId = null"
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
177
201
|
<RCHeaderLayer id="editor-header" :order="3">
|
|
178
202
|
<UHeader :class="header({ class: rc.header })">
|
|
179
203
|
<template #left>
|
|
@@ -230,6 +254,14 @@ const handleTreeNavigate = (slug) => {
|
|
|
230
254
|
:loading="isFetchingTree"
|
|
231
255
|
@navigate="handleTreeNavigate"
|
|
232
256
|
/>
|
|
257
|
+
<RCPageVersionSelector
|
|
258
|
+
v-if="page.id"
|
|
259
|
+
v-model:current-version-id="versionId"
|
|
260
|
+
:page-id="page.id"
|
|
261
|
+
:is-admin="isAdmin"
|
|
262
|
+
@version-selected="(v) => emit('version-navigate', v)"
|
|
263
|
+
/>
|
|
264
|
+
<slot name="header-actions" />
|
|
233
265
|
<RCCreatePageModal
|
|
234
266
|
:is-open="isCreateModalOpen"
|
|
235
267
|
:definitions="pageDefinitions"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Page, type PageSurround, type PageDefinition } from "../../types/index.js";
|
|
1
|
+
import { type Page, type PageSurround, type PageDefinition, type PageVersion } from "../../types/index.js";
|
|
2
2
|
export interface PageEditorProps {
|
|
3
3
|
isSaving: boolean;
|
|
4
4
|
useSurround?: boolean;
|
|
@@ -10,6 +10,9 @@ export interface PageEditorProps {
|
|
|
10
10
|
onDeletePage?: (id: string) => Promise<void>;
|
|
11
11
|
onFetchPages?: () => Promise<Pick<Page, 'title' | 'slug'>[]>;
|
|
12
12
|
onNavigateToPage?: (slug: string) => void;
|
|
13
|
+
currentVersionId?: string | null;
|
|
14
|
+
isViewingVersion?: boolean;
|
|
15
|
+
isAdmin?: boolean;
|
|
13
16
|
rc?: {
|
|
14
17
|
header?: string;
|
|
15
18
|
headerGroup?: string;
|
|
@@ -33,12 +36,15 @@ export interface PageEditorProps {
|
|
|
33
36
|
type __VLS_Props = PageEditorProps;
|
|
34
37
|
export interface PageEditorEmits {
|
|
35
38
|
save: [value: Page];
|
|
39
|
+
'version-navigate': [version: PageVersion];
|
|
36
40
|
}
|
|
37
41
|
export interface PageEditorSlots {
|
|
42
|
+
'header-actions'?: (props: {}) => any;
|
|
38
43
|
}
|
|
39
44
|
type __VLS_Slots = PageEditorSlots;
|
|
40
45
|
type __VLS_ModelProps = {
|
|
41
46
|
modelValue: Page;
|
|
47
|
+
"currentVersionId"?: string | null;
|
|
42
48
|
};
|
|
43
49
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
44
50
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
@@ -55,6 +61,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
55
61
|
type: "Default";
|
|
56
62
|
properties: import("../../types/index.js").BasePageProperties;
|
|
57
63
|
} & import("../../types/index.js").BasePage) => any;
|
|
64
|
+
"version-navigate": (version: PageVersion) => any;
|
|
65
|
+
"update:currentVersionId": (value: string | null) => any;
|
|
58
66
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
59
67
|
onSave?: ((value: {
|
|
60
68
|
type: "Default";
|
|
@@ -64,6 +72,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
64
72
|
type: "Default";
|
|
65
73
|
properties: import("../../types/index.js").BasePageProperties;
|
|
66
74
|
} & import("../../types/index.js").BasePage) => any) | undefined;
|
|
75
|
+
"onVersion-navigate"?: ((version: PageVersion) => any) | undefined;
|
|
76
|
+
"onUpdate:currentVersionId"?: ((value: string | null) => any) | undefined;
|
|
67
77
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
68
78
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
69
79
|
declare const _default: typeof __VLS_export;
|
|
@@ -5,4 +5,5 @@ export { default as PagePropertiesRenderer } from './PagePropertiesRenderer.vue.
|
|
|
5
5
|
export { default as PageRenderer } from './PageRenderer.vue.js';
|
|
6
6
|
export { default as PageSurround } from './PageSurround.vue.js';
|
|
7
7
|
export { default as PageTOC } from './PageTOC.vue.js';
|
|
8
|
+
export { default as PageVersionSelector } from './PageVersionSelector.vue.js';
|
|
8
9
|
export * from './modals/index.js';
|
|
@@ -5,4 +5,5 @@ export { default as PagePropertiesRenderer } from "./PagePropertiesRenderer.vue"
|
|
|
5
5
|
export { default as PageRenderer } from "./PageRenderer.vue";
|
|
6
6
|
export { default as PageSurround } from "./PageSurround.vue";
|
|
7
7
|
export { default as PageTOC } from "./PageTOC.vue";
|
|
8
|
+
export { default as PageVersionSelector } from "./PageVersionSelector.vue";
|
|
8
9
|
export * from "./modals/index.js";
|
|
@@ -5,4 +5,5 @@ export { default as PagePropertiesRenderer } from "./PagePropertiesRenderer.vue"
|
|
|
5
5
|
export { default as PageRenderer } from "./PageRenderer.vue";
|
|
6
6
|
export { default as PageSurround } from "./PageSurround.vue";
|
|
7
7
|
export { default as PageTOC } from "./PageTOC.vue";
|
|
8
|
+
export { default as PageVersionSelector } from "./PageVersionSelector.vue";
|
|
8
9
|
export * from "./modals/index.mjs";
|
|
@@ -88,50 +88,52 @@ const getKey = (item) => item.slug || item.label;
|
|
|
88
88
|
</script>
|
|
89
89
|
|
|
90
90
|
<template>
|
|
91
|
-
<UModal v-model:open="open">
|
|
92
|
-
<
|
|
93
|
-
<
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
<UModal v-model:open="open" title="Page Hierarchy" description="Navigate through your pages">
|
|
92
|
+
<template #content>
|
|
93
|
+
<UCard :ui="{ body: 'p-0 sm:p-0' }">
|
|
94
|
+
<template #header>
|
|
95
|
+
<div :class="headerClass({ class: rc.header })">
|
|
96
|
+
<h3 :class="headerTitle({ class: rc.headerTitle })">Page Hierarchy</h3>
|
|
97
|
+
<UButton
|
|
98
|
+
color="neutral"
|
|
99
|
+
variant="ghost"
|
|
100
|
+
icon="i-heroicons-x-mark-20-solid"
|
|
101
|
+
:class="closeButton({ class: rc.closeButton })"
|
|
102
|
+
@click="open = false"
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
<div :class="body({ class: rc.body })">
|
|
108
|
+
<div v-if="loading" class="p-4 flex justify-center">
|
|
109
|
+
<UIcon name="i-heroicons-arrow-path" class="w-5 h-5 animate-spin" />
|
|
110
|
+
</div>
|
|
111
|
+
<div v-else-if="treeItems.length === 0" class="p-4 text-center text-gray-500">
|
|
112
|
+
No pages found directly.
|
|
113
|
+
</div>
|
|
114
|
+
<UTree
|
|
115
|
+
v-else
|
|
116
|
+
:items="treeItems"
|
|
117
|
+
:ui="{ item: 'cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800' }"
|
|
118
|
+
>
|
|
119
|
+
<template #item="{ item }">
|
|
120
|
+
<div class="flex items-center gap-2 py-1 w-full" @click="handleSelect(item)">
|
|
121
|
+
<UIcon :name="item.icon || (item.children?.length ? 'i-lucide-folder' : 'i-lucide-file')" class="w-4 h-4 text-gray-400" />
|
|
122
|
+
<span :class="{ 'text-gray-900 dark:text-gray-100': item.slug, 'text-gray-500 font-medium': !item.slug }">
|
|
123
|
+
{{ item.label }}
|
|
124
|
+
</span>
|
|
125
|
+
<UIcon v-if="item.slug" name="i-heroicons-arrow-right-20-solid" class="w-3 h-3 ml-auto text-gray-300 opacity-0 group-hover:opacity-100" />
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
128
|
+
</UTree>
|
|
112
129
|
</div>
|
|
113
|
-
<UTree
|
|
114
|
-
v-else
|
|
115
|
-
:items="treeItems"
|
|
116
|
-
:ui="{ item: 'cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800' }"
|
|
117
|
-
>
|
|
118
|
-
<template #item="{ item }">
|
|
119
|
-
<div class="flex items-center gap-2 py-1 w-full" @click="handleSelect(item)">
|
|
120
|
-
<UIcon :name="item.icon || (item.children?.length ? 'i-lucide-folder' : 'i-lucide-file')" class="w-4 h-4 text-gray-400" />
|
|
121
|
-
<span :class="{ 'text-gray-900 dark:text-gray-100': item.slug, 'text-gray-500 font-medium': !item.slug }">
|
|
122
|
-
{{ item.label }}
|
|
123
|
-
</span>
|
|
124
|
-
<UIcon v-if="item.slug" name="i-heroicons-arrow-right-20-solid" class="w-3 h-3 ml-auto text-gray-300 opacity-0 group-hover:opacity-100" />
|
|
125
|
-
</div>
|
|
126
|
-
</template>
|
|
127
|
-
</UTree>
|
|
128
|
-
</div>
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
<template #footer>
|
|
132
|
+
<div :class="footer({ class: rc.footer })">
|
|
133
|
+
<UButton color="neutral" variant="ghost" label="Close" @click="open = false" />
|
|
134
|
+
</div>
|
|
135
|
+
</template>
|
|
136
|
+
</UCard>
|
|
137
|
+
</template>
|
|
136
138
|
</UModal>
|
|
137
139
|
</template>
|
|
@@ -67,3 +67,14 @@ export interface PageSurround {
|
|
|
67
67
|
previous: SurroundItem | null;
|
|
68
68
|
next: SurroundItem | null;
|
|
69
69
|
}
|
|
70
|
+
export interface PageVersion extends BasePage {
|
|
71
|
+
status: "pending" | "approved" | "rejected";
|
|
72
|
+
type: PageType;
|
|
73
|
+
content: {
|
|
74
|
+
blocks: Block[];
|
|
75
|
+
properties: RegisterPageTypes[PageType];
|
|
76
|
+
};
|
|
77
|
+
createdBy: string;
|
|
78
|
+
approvedBy?: string | null;
|
|
79
|
+
approvedAt?: Date | null;
|
|
80
|
+
}
|