rimelight-components 2.1.81 → 2.1.83
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/page/PageEditor.vue +8 -3
- package/dist/runtime/components/page/PagePropertiesEditor.vue +153 -15
- package/dist/runtime/components/swatches/index.d.ts +1 -0
- package/dist/runtime/components/swatches/index.js +1 -0
- package/dist/runtime/components/swatches/index.mjs +1 -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.83";
|
|
8
8
|
const homepage = "https://rimelight.com/tools/rimelight-components";
|
|
9
9
|
|
|
10
10
|
const defaultOptions = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, computed, useTemplateRef, provide } from "vue";
|
|
3
3
|
import {} from "../../types";
|
|
4
|
-
import { usePageEditor, usePageRegistry, useRC } from "../../composables";
|
|
4
|
+
import { usePageEditor, usePageRegistry, useRC, useHeaderStack } from "../../composables";
|
|
5
5
|
import { getLocalizedContent } from "../../utils";
|
|
6
6
|
import { useI18n } from "vue-i18n";
|
|
7
7
|
import { tv } from "../../internal/tv";
|
|
@@ -44,7 +44,7 @@ const pageEditorStyles = tv({
|
|
|
44
44
|
slots: {
|
|
45
45
|
header: "h-12 w-full bg-muted",
|
|
46
46
|
headerGroup: "flex items-center gap-xs",
|
|
47
|
-
splitContainer: "flex w-full overflow-hidden",
|
|
47
|
+
splitContainer: "flex w-full overflow-hidden min-h-0",
|
|
48
48
|
editorColumn: "h-full overflow-y-auto",
|
|
49
49
|
container: "flex flex-col py-16",
|
|
50
50
|
grid: "grid grid-cols-1 lg:grid-cols-24 gap-xl items-start",
|
|
@@ -99,6 +99,7 @@ provide("page-resolver", resolvePage);
|
|
|
99
99
|
const previousPage = computed(() => surround?.previous);
|
|
100
100
|
const nextPage = computed(() => surround?.next);
|
|
101
101
|
const hasSurround = computed(() => !!(surround?.previous || surround?.next));
|
|
102
|
+
const { totalHeight } = useHeaderStack();
|
|
102
103
|
const containerRef = useTemplateRef("split-container");
|
|
103
104
|
const editorWidth = ref(50);
|
|
104
105
|
const isResizing = ref(false);
|
|
@@ -285,7 +286,11 @@ const handleTreeNavigate = (slug) => {
|
|
|
285
286
|
</UHeader>
|
|
286
287
|
</RCHeaderLayer>
|
|
287
288
|
|
|
288
|
-
<div
|
|
289
|
+
<div
|
|
290
|
+
ref="split-container"
|
|
291
|
+
:class="splitContainer({ class: rc.splitContainer })"
|
|
292
|
+
:style="{ height: `calc(100vh - ${totalHeight}px)` }"
|
|
293
|
+
>
|
|
289
294
|
<div
|
|
290
295
|
:class="editorColumn({ class: rc.editorColumn })"
|
|
291
296
|
:style="{ width: showPreview ? `${editorWidth}%` : '100%' }"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref, reactive } from "vue";
|
|
3
3
|
import { useI18n } from "vue-i18n";
|
|
4
4
|
import { usePageRegistry, useInfobox, useRC } from "../../composables";
|
|
5
5
|
import { getLocalizedContent } from "../../utils";
|
|
@@ -61,6 +61,55 @@ const updateTextArray = (schema, vals) => {
|
|
|
61
61
|
en: str
|
|
62
62
|
}));
|
|
63
63
|
};
|
|
64
|
+
const isLinkModalOpen = ref(false);
|
|
65
|
+
const editingLinkIndex = ref(null);
|
|
66
|
+
const linkDraft = reactive({
|
|
67
|
+
label: "",
|
|
68
|
+
to: "",
|
|
69
|
+
icon: "",
|
|
70
|
+
color: "neutral",
|
|
71
|
+
variant: "link"
|
|
72
|
+
});
|
|
73
|
+
const openLinkModal = (index = null) => {
|
|
74
|
+
editingLinkIndex.value = index;
|
|
75
|
+
if (index !== null && page.value.links?.[index]) {
|
|
76
|
+
const link = page.value.links[index];
|
|
77
|
+
linkDraft.label = link.label;
|
|
78
|
+
linkDraft.to = link.to;
|
|
79
|
+
linkDraft.icon = link.icon;
|
|
80
|
+
linkDraft.color = link.color || "neutral";
|
|
81
|
+
linkDraft.variant = link.variant || "link";
|
|
82
|
+
} else {
|
|
83
|
+
linkDraft.label = "";
|
|
84
|
+
linkDraft.to = "";
|
|
85
|
+
linkDraft.icon = "";
|
|
86
|
+
linkDraft.color = "neutral";
|
|
87
|
+
linkDraft.variant = "link";
|
|
88
|
+
}
|
|
89
|
+
isLinkModalOpen.value = true;
|
|
90
|
+
};
|
|
91
|
+
const saveLink = () => {
|
|
92
|
+
if (!linkDraft.label || !linkDraft.to) return;
|
|
93
|
+
if (!page.value.links) page.value.links = [];
|
|
94
|
+
const newLink = {
|
|
95
|
+
label: linkDraft.label,
|
|
96
|
+
to: linkDraft.to,
|
|
97
|
+
icon: linkDraft.icon,
|
|
98
|
+
color: linkDraft.color,
|
|
99
|
+
variant: linkDraft.variant
|
|
100
|
+
};
|
|
101
|
+
if (editingLinkIndex.value !== null) {
|
|
102
|
+
page.value.links[editingLinkIndex.value] = newLink;
|
|
103
|
+
} else {
|
|
104
|
+
page.value.links.push(newLink);
|
|
105
|
+
}
|
|
106
|
+
isLinkModalOpen.value = false;
|
|
107
|
+
};
|
|
108
|
+
const removeLink = (index) => {
|
|
109
|
+
if (page.value.links) {
|
|
110
|
+
page.value.links.splice(index, 1);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
64
113
|
</script>
|
|
65
114
|
|
|
66
115
|
<template>
|
|
@@ -87,6 +136,16 @@ const updateTextArray = (schema, vals) => {
|
|
|
87
136
|
:class="titleInput({ class: rc.titleInput })"
|
|
88
137
|
/>
|
|
89
138
|
|
|
139
|
+
<UInput
|
|
140
|
+
v-model="page.slug"
|
|
141
|
+
variant="subtle"
|
|
142
|
+
placeholder="page-slug"
|
|
143
|
+
size="xs"
|
|
144
|
+
prefix="/"
|
|
145
|
+
:ui="{ base: 'text-center text-dimmed font-mono' }"
|
|
146
|
+
class="w-full opacity-60 hover:opacity-100 focus-within:opacity-100 transition-opacity"
|
|
147
|
+
/>
|
|
148
|
+
|
|
90
149
|
<span :class="type({ class: rc.type })">{{ t(getTypeLabelKey(page.type)) }}</span>
|
|
91
150
|
|
|
92
151
|
<div v-if="page.tags?.length" :class="tags({ class: rc.tags })">
|
|
@@ -221,20 +280,99 @@ const updateTextArray = (schema, vals) => {
|
|
|
221
280
|
</template>
|
|
222
281
|
</UCard>
|
|
223
282
|
<div :class="links({ class: rc.links })">
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
283
|
+
<div class="flex items-center justify-between mb-xs">
|
|
284
|
+
<h6>Links</h6>
|
|
285
|
+
<UButton
|
|
286
|
+
icon="lucide:plus"
|
|
287
|
+
size="xs"
|
|
288
|
+
variant="ghost"
|
|
289
|
+
color="primary"
|
|
290
|
+
@click="openLinkModal()"
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<div v-if="page.links?.length" class="flex flex-col gap-xs">
|
|
295
|
+
<div
|
|
296
|
+
v-for="(linkItem, index) in page.links"
|
|
297
|
+
:key="index"
|
|
298
|
+
class="flex items-center justify-between group/link"
|
|
299
|
+
>
|
|
300
|
+
<UButton
|
|
301
|
+
:label="linkItem.label"
|
|
302
|
+
:icon="linkItem.icon"
|
|
303
|
+
:to="linkItem.to"
|
|
304
|
+
:target="linkItem.to ? '_blank' : void 0"
|
|
305
|
+
:external="!!linkItem.to"
|
|
306
|
+
:variant="linkItem.variant || 'link'"
|
|
307
|
+
:color="linkItem.color || 'neutral'"
|
|
308
|
+
size="sm"
|
|
309
|
+
:ui="{ base: 'pl-0' }"
|
|
310
|
+
/>
|
|
311
|
+
<div class="flex items-center opacity-0 group-hover/link:opacity-100 transition-opacity">
|
|
312
|
+
<UButton
|
|
313
|
+
icon="lucide:pencil"
|
|
314
|
+
size="xs"
|
|
315
|
+
variant="ghost"
|
|
316
|
+
color="neutral"
|
|
317
|
+
@click="openLinkModal(index)"
|
|
318
|
+
/>
|
|
319
|
+
<UButton
|
|
320
|
+
icon="lucide:trash-2"
|
|
321
|
+
size="xs"
|
|
322
|
+
variant="ghost"
|
|
323
|
+
color="error"
|
|
324
|
+
@click="removeLink(index)"
|
|
325
|
+
/>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
329
|
+
<p v-else class="text-xs text-dimmed italic">No links added yet.</p>
|
|
330
|
+
|
|
331
|
+
<!-- Link management modal -->
|
|
332
|
+
<UModal v-model:open="isLinkModalOpen" :title="editingLinkIndex !== null ? 'Edit Link' : 'Add Link'">
|
|
333
|
+
<template #content>
|
|
334
|
+
<UCard>
|
|
335
|
+
<div class="flex flex-col gap-sm">
|
|
336
|
+
<UFormField label="Label">
|
|
337
|
+
<UInput v-model="linkDraft.label" placeholder="Check my GitHub" class="w-full" />
|
|
338
|
+
</UFormField>
|
|
339
|
+
<UFormField label="URL (to)">
|
|
340
|
+
<UInput v-model="linkDraft.to" placeholder="https://github.com/..." class="w-full" />
|
|
341
|
+
</UFormField>
|
|
342
|
+
<UFormField label="Icon">
|
|
343
|
+
<UInput v-model="linkDraft.icon" placeholder="lucide:github" class="w-full" />
|
|
344
|
+
</UFormField>
|
|
345
|
+
<div class="grid grid-cols-2 gap-sm">
|
|
346
|
+
<UFormField label="Color">
|
|
347
|
+
<USelect
|
|
348
|
+
v-model="linkDraft.color"
|
|
349
|
+
:items="['primary', 'secondary', 'neutral', 'error', 'warning', 'success', 'info']"
|
|
350
|
+
class="w-full"
|
|
351
|
+
/>
|
|
352
|
+
</UFormField>
|
|
353
|
+
<UFormField label="Variant">
|
|
354
|
+
<USelect
|
|
355
|
+
v-model="linkDraft.variant"
|
|
356
|
+
:items="['solid', 'outline', 'subtle', 'soft', 'ghost', 'link']"
|
|
357
|
+
class="w-full"
|
|
358
|
+
/>
|
|
359
|
+
</UFormField>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
<template #footer>
|
|
364
|
+
<div class="flex justify-end gap-sm">
|
|
365
|
+
<UButton label="Cancel" variant="ghost" color="neutral" @click="isLinkModalOpen = false" />
|
|
366
|
+
<UButton
|
|
367
|
+
:label="editingLinkIndex !== null ? 'Update Link' : 'Add Link'"
|
|
368
|
+
color="primary"
|
|
369
|
+
@click="saveLink"
|
|
370
|
+
/>
|
|
371
|
+
</div>
|
|
372
|
+
</template>
|
|
373
|
+
</UCard>
|
|
374
|
+
</template>
|
|
375
|
+
</UModal>
|
|
238
376
|
</div>
|
|
239
377
|
</aside>
|
|
240
378
|
</template>
|