includio-cms 0.0.29 → 0.0.31
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/admin/client/entry/entry-page.svelte +3 -1
- package/dist/admin/components/fields/field-renderer.svelte +0 -4
- package/dist/admin/components/fields/url-field-wrapper.svelte +3 -9
- package/dist/admin/components/fields/url-field.svelte +4 -1
- package/dist/admin/components/media/media-library.svelte +51 -66
- package/dist/components/ui/dialog/dialog-content.svelte +7 -7
- package/dist/components/ui/dialog/dialog-content.svelte.d.ts +3 -3
- package/package.json +4 -7
|
@@ -13,11 +13,7 @@
|
|
|
13
13
|
import FileField from './file-field.svelte';
|
|
14
14
|
import NumberField from './number-field.svelte';
|
|
15
15
|
import SeoField from './seo-field.svelte';
|
|
16
|
-
import UrlField from './url-field.svelte';
|
|
17
16
|
import RelationField from './relation-field.svelte';
|
|
18
|
-
import { urlFieldDataSchema } from '../../../schemas/field/url.js';
|
|
19
|
-
import { getAtPath, setAtPath } from '../../utils/objectPath.js';
|
|
20
|
-
import { onMount } from 'svelte';
|
|
21
17
|
import UrlFieldWrapper from './url-field-wrapper.svelte';
|
|
22
18
|
|
|
23
19
|
type Props = {
|
|
@@ -42,12 +42,6 @@
|
|
|
42
42
|
let fieldValid = $state(false);
|
|
43
43
|
</script>
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
{/snippet}
|
|
49
|
-
|
|
50
|
-
{#if fieldValid}
|
|
51
|
-
<UrlFieldComponent {form} {field} path={path as FormPathLeaves<T, UrlFieldData>} {...props} />
|
|
52
|
-
{/if}
|
|
53
|
-
</svelte:boundary>
|
|
45
|
+
{#if fieldValid}
|
|
46
|
+
<UrlFieldComponent {form} {field} path={path as FormPathLeaves<T, UrlFieldData>} {...props} />
|
|
47
|
+
{/if}
|
|
@@ -40,10 +40,13 @@
|
|
|
40
40
|
linkedEntry = entry;
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
if (!$value.id && $value.url && Object.values($value.url).some((url) => url.length > 2)) {
|
|
44
45
|
fetchSuggestions($value.url).then((suggestions) => {
|
|
45
46
|
autocompleteSuggestions = suggestions;
|
|
46
47
|
});
|
|
48
|
+
} else {
|
|
49
|
+
autocompleteSuggestions = [];
|
|
47
50
|
}
|
|
48
51
|
});
|
|
49
52
|
|
|
@@ -23,16 +23,15 @@
|
|
|
23
23
|
let { selected = $bindable([]), multiple = false, accept }: Props = $props();
|
|
24
24
|
|
|
25
25
|
let currentFile: MediaFile | null = $state(null);
|
|
26
|
-
|
|
27
26
|
let selectedFolder = $state<string | null>(null);
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
remotes.getMediaFiles({
|
|
31
|
-
data: { folderId:
|
|
32
|
-
})
|
|
33
|
-
|
|
28
|
+
async function fetchFiles(folderId: string | null, accept: string | undefined) {
|
|
29
|
+
return await remotes.getMediaFiles({
|
|
30
|
+
data: { folderId: folderId || undefined, mimeTypes: accept?.split(',') }
|
|
31
|
+
});
|
|
32
|
+
}
|
|
34
33
|
|
|
35
|
-
let files = $derived(
|
|
34
|
+
let files = $derived(await fetchFiles(selectedFolder, accept));
|
|
36
35
|
|
|
37
36
|
let folders = $derived(await remotes.getMediaFolders());
|
|
38
37
|
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
if (currentFile) {
|
|
41
40
|
await remotes.deleteMediaFile(currentFile.id);
|
|
42
41
|
toast.success('File deleted');
|
|
43
|
-
|
|
42
|
+
files = await fetchFiles(selectedFolder, accept);
|
|
44
43
|
currentFile = null;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -48,18 +47,8 @@
|
|
|
48
47
|
onMount(() => {
|
|
49
48
|
if (Array.isArray(selected)) {
|
|
50
49
|
selected = selected.filter((id) => !id.startsWith('/uploads'));
|
|
51
|
-
if (files) {
|
|
52
|
-
currentFile = files.find((file) => file.id === selected[0]) || null;
|
|
53
|
-
}
|
|
54
50
|
} else if (typeof selected === 'string') {
|
|
55
51
|
selected = selected.startsWith('/uploads') ? '' : selected;
|
|
56
|
-
if (files) {
|
|
57
|
-
currentFile = files.find((file) => file.id === selected) || null;
|
|
58
|
-
}
|
|
59
|
-
} else {
|
|
60
|
-
if (files) {
|
|
61
|
-
currentFile = files[0];
|
|
62
|
-
}
|
|
63
52
|
}
|
|
64
53
|
});
|
|
65
54
|
</script>
|
|
@@ -94,52 +83,44 @@
|
|
|
94
83
|
</div>
|
|
95
84
|
|
|
96
85
|
<div>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
file.id
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
/>
|
|
136
|
-
{:else}
|
|
137
|
-
<Pdf class="pointer-events-none h-full w-full object-contain" />
|
|
138
|
-
{/if}
|
|
139
|
-
</button>
|
|
140
|
-
{/each}
|
|
141
|
-
</div>
|
|
142
|
-
{/await}
|
|
86
|
+
<div class="grid grid-cols-[repeat(auto-fill,minmax(9rem,1fr))] gap-2">
|
|
87
|
+
{#each files as file}
|
|
88
|
+
<button
|
|
89
|
+
type="button"
|
|
90
|
+
class="block aspect-square overflow-hidden rounded-2xl border p-1 {selected.includes(
|
|
91
|
+
file.id
|
|
92
|
+
)
|
|
93
|
+
? 'outline-primary outline-4'
|
|
94
|
+
: ''}"
|
|
95
|
+
onclick={() => {
|
|
96
|
+
currentFile = file;
|
|
97
|
+
if (multiple && Array.isArray(selected)) {
|
|
98
|
+
selected = selected.includes(file.id)
|
|
99
|
+
? selected.filter((id) => id !== file.id)
|
|
100
|
+
: [...selected, file.id];
|
|
101
|
+
} else {
|
|
102
|
+
selected = file.id;
|
|
103
|
+
}
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{#if file.type === 'image'}
|
|
107
|
+
<img
|
|
108
|
+
class="pointer-events-none h-full w-full object-contain"
|
|
109
|
+
src={file.url}
|
|
110
|
+
alt={file.name}
|
|
111
|
+
/>
|
|
112
|
+
{:else if file.type === 'video'}
|
|
113
|
+
<img
|
|
114
|
+
class="pointer-events-none h-full w-full object-contain"
|
|
115
|
+
src={file.thumbnailUrl}
|
|
116
|
+
alt={file.name}
|
|
117
|
+
/>
|
|
118
|
+
{:else}
|
|
119
|
+
<Pdf class="pointer-events-none h-full w-full object-contain" />
|
|
120
|
+
{/if}
|
|
121
|
+
</button>
|
|
122
|
+
{/each}
|
|
123
|
+
</div>
|
|
143
124
|
</div>
|
|
144
125
|
</div>
|
|
145
126
|
|
|
@@ -147,8 +128,12 @@
|
|
|
147
128
|
<Item.Content class="h-full">
|
|
148
129
|
{#if currentFile}
|
|
149
130
|
<div class="flex items-center justify-end border-b px-6 py-3">
|
|
150
|
-
<Button
|
|
151
|
-
|
|
131
|
+
<Button
|
|
132
|
+
type="button"
|
|
133
|
+
size="sm"
|
|
134
|
+
class="mr-2.5"
|
|
135
|
+
variant="destructive"
|
|
136
|
+
onclick={deleteFileCommand}>Delete</Button
|
|
152
137
|
>
|
|
153
138
|
</div>
|
|
154
139
|
<div class="space-y-6 p-6">
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { Dialog as DialogPrimitive } from
|
|
3
|
-
import XIcon from
|
|
4
|
-
import type { Snippet } from
|
|
5
|
-
import * as Dialog from
|
|
6
|
-
import { cn, type WithoutChildrenOrChild } from
|
|
2
|
+
import { Dialog as DialogPrimitive } from 'bits-ui';
|
|
3
|
+
import XIcon from '@lucide/svelte/icons/x';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import * as Dialog from './index.js';
|
|
6
|
+
import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
ref = $bindable(null),
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
bind:ref
|
|
26
26
|
data-slot="dialog-content"
|
|
27
27
|
class={cn(
|
|
28
|
-
|
|
28
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
|
29
29
|
className
|
|
30
30
|
)}
|
|
31
31
|
{...restProps}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
{@render children?.()}
|
|
34
34
|
{#if showCloseButton}
|
|
35
35
|
<DialogPrimitive.Close
|
|
36
|
-
class="ring-offset-background focus:ring-ring
|
|
36
|
+
class="ring-offset-background focus:ring-ring absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
37
37
|
>
|
|
38
38
|
<XIcon />
|
|
39
39
|
<span class="sr-only">Close</span>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Dialog as DialogPrimitive } from
|
|
2
|
-
import type { Snippet } from
|
|
3
|
-
import { type WithoutChildrenOrChild } from
|
|
1
|
+
import { Dialog as DialogPrimitive } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { type WithoutChildrenOrChild } from '../../../utils.js';
|
|
4
4
|
type $$ComponentProps = WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
|
|
5
5
|
portalProps?: DialogPrimitive.PortalProps;
|
|
6
6
|
children: Snippet;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "includio-cms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run prepack",
|
|
@@ -144,7 +144,8 @@
|
|
|
144
144
|
"typescript": "^5.0.0",
|
|
145
145
|
"typescript-eslint": "^8.20.0",
|
|
146
146
|
"vite": "^7.0.4",
|
|
147
|
-
"vitest": "^3.2.3"
|
|
147
|
+
"vitest": "^3.2.3",
|
|
148
|
+
"drizzle-orm": "^0.40.0"
|
|
148
149
|
},
|
|
149
150
|
"keywords": [
|
|
150
151
|
"svelte"
|
|
@@ -153,21 +154,17 @@
|
|
|
153
154
|
"@inlang/paraglide-js": "^2.0.0",
|
|
154
155
|
"@internationalized/date": "^3.8.2",
|
|
155
156
|
"@lucide/svelte": "^0.544.0",
|
|
156
|
-
"@node-rs/argon2": "^2.0.2",
|
|
157
157
|
"@oslojs/crypto": "^1.0.1",
|
|
158
158
|
"@oslojs/encoding": "^1.1.0",
|
|
159
159
|
"@tabler/icons-svelte": "^3.34.0",
|
|
160
|
-
"@tanstack/svelte-query": "^5.82.0",
|
|
161
|
-
"@tanstack/svelte-query-devtools": "^5.84.0",
|
|
162
160
|
"@tanstack/table-core": "^8.21.3",
|
|
163
161
|
"@tiptap/core": "^3.4.4",
|
|
164
162
|
"@tiptap/extension-bubble-menu": "^3.4.4",
|
|
165
163
|
"@tiptap/pm": "^3.4.4",
|
|
166
164
|
"@tiptap/starter-kit": "^3.4.4",
|
|
167
165
|
"arctic": "^3.7.0",
|
|
168
|
-
"bits-ui": "^2.11.
|
|
166
|
+
"bits-ui": "^2.11.5",
|
|
169
167
|
"dotenv": "^16.5.0",
|
|
170
|
-
"drizzle-orm": "^0.40.0",
|
|
171
168
|
"fast-glob": "^3.3.3",
|
|
172
169
|
"fluent-ffmpeg": "^2.1.3",
|
|
173
170
|
"mode-watcher": "^1.0.8",
|