sandcms 0.6.2 → 0.7.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/README.md +14 -10
- package/dist/admin/Account.svelte +286 -83
- package/dist/admin/Admin.svelte +14 -1
- package/dist/admin/ApiKeys.svelte +146 -79
- package/dist/admin/AssetAttachment.svelte +10 -12
- package/dist/admin/AssetAttachment.svelte.d.ts +0 -1
- package/dist/admin/BlueprintFields.svelte +20 -5
- package/dist/admin/BlueprintFields.svelte.d.ts +2 -1
- package/dist/admin/Collection.svelte +111 -54
- package/dist/admin/Dashboard.svelte +3 -37
- package/dist/admin/DateField.svelte +75 -0
- package/dist/admin/DateField.svelte.d.ts +11 -0
- package/dist/admin/Editor.svelte +70 -65
- package/dist/admin/Fields.svelte +24 -23
- package/dist/admin/Fields.svelte.d.ts +0 -1
- package/dist/admin/FocusPicker.svelte +1 -2
- package/dist/admin/Gallery.svelte +2 -7
- package/dist/admin/Gallery.svelte.d.ts +0 -1
- package/dist/admin/GlobalSearch.svelte +54 -26
- package/dist/admin/HoverHint.svelte +37 -0
- package/dist/admin/HoverHint.svelte.d.ts +8 -0
- package/dist/admin/Inbox.svelte +6 -11
- package/dist/admin/LinkField.svelte +128 -66
- package/dist/admin/LinkField.svelte.d.ts +0 -1
- package/dist/admin/Login.svelte +0 -1
- package/dist/admin/MediaLibrary.svelte +70 -56
- package/dist/admin/MediaPicker.svelte +62 -55
- package/dist/admin/MediaPicker.svelte.d.ts +0 -1
- package/dist/admin/NotificationSettings.svelte +35 -27
- package/dist/admin/RichText.svelte +2 -2
- package/dist/admin/RowMenu.svelte +28 -0
- package/dist/admin/RowMenu.svelte.d.ts +10 -0
- package/dist/admin/SearchList.svelte +51 -14
- package/dist/admin/Shell.svelte +64 -29
- package/dist/admin/ThemePicker.svelte +72 -0
- package/dist/admin/ThemePicker.svelte.d.ts +18 -0
- package/dist/admin/UploadButton.svelte +2 -1
- package/dist/admin/UploadProgress.svelte +24 -0
- package/dist/admin/UploadProgress.svelte.d.ts +7 -0
- package/dist/admin/Users.svelte +106 -50
- package/dist/admin/client.d.ts +5 -670
- package/dist/admin/client.js +20 -1
- package/dist/admin/components/ui/alert/alert.svelte.d.ts +3 -13
- package/dist/admin/components/ui/attachment/attachment-media.svelte.d.ts +3 -13
- package/dist/admin/components/ui/attachment/attachment.svelte.d.ts +6 -26
- package/dist/admin/components/ui/badge/badge.svelte.d.ts +7 -25
- package/dist/admin/components/ui/button/button.svelte.d.ts +15 -53
- package/dist/admin/components/ui/calendar/calendar-caption.svelte +76 -0
- package/dist/admin/components/ui/calendar/calendar-caption.svelte.d.ts +19 -0
- package/dist/admin/components/ui/calendar/calendar-cell.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-cell.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-day.svelte +33 -0
- package/dist/admin/components/ui/calendar/calendar-day.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-body.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-body.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-head.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-head.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-row.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-row.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid.svelte +16 -0
- package/dist/admin/components/ui/calendar/calendar-grid.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-head-cell.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-head-cell.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-header.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-header.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-heading.svelte +16 -0
- package/dist/admin/components/ui/calendar/calendar-heading.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-month-select.svelte +48 -0
- package/dist/admin/components/ui/calendar/calendar-month-select.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-month.svelte +15 -0
- package/dist/admin/components/ui/calendar/calendar-month.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-months.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-months.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-nav.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-nav.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-next-button.svelte +37 -0
- package/dist/admin/components/ui/calendar/calendar-next-button.svelte.d.ts +8 -0
- package/dist/admin/components/ui/calendar/calendar-prev-button.svelte +37 -0
- package/dist/admin/components/ui/calendar/calendar-prev-button.svelte.d.ts +8 -0
- package/dist/admin/components/ui/calendar/calendar-year-select.svelte +47 -0
- package/dist/admin/components/ui/calendar/calendar-year-select.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar.svelte +115 -0
- package/dist/admin/components/ui/calendar/calendar.svelte.d.ts +21 -0
- package/dist/admin/components/ui/calendar/index.d.ts +19 -0
- package/dist/admin/components/ui/calendar/index.js +21 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +16 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +46 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +9 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-content.svelte +31 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-item.svelte +27 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-label.svelte +24 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-label.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-portal.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +16 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +36 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-separator.svelte +17 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-separator.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +23 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +5 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +31 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/index.d.ts +18 -0
- package/dist/admin/components/ui/dropdown-menu/index.js +18 -0
- package/dist/admin/components/ui/input-otp/index.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/index.js +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-group.svelte +23 -0
- package/dist/admin/components/ui/input-otp/input-otp-group.svelte.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-separator.svelte +27 -0
- package/dist/admin/components/ui/input-otp/input-otp-separator.svelte.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-slot.svelte +29 -0
- package/dist/admin/components/ui/input-otp/input-otp-slot.svelte.d.ts +4 -0
- package/dist/admin/components/ui/input-otp/input-otp.svelte +24 -0
- package/dist/admin/components/ui/input-otp/input-otp.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/index.d.ts +9 -0
- package/dist/admin/components/ui/popover/index.js +11 -0
- package/dist/admin/components/ui/popover/popover-close.svelte +7 -0
- package/dist/admin/components/ui/popover/popover-close.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/popover-content.svelte +31 -0
- package/dist/admin/components/ui/popover/popover-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/popover/popover-description.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-header.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-portal.svelte +7 -0
- package/dist/admin/components/ui/popover/popover-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/popover/popover-title.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-trigger.svelte +17 -0
- package/dist/admin/components/ui/popover/popover-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/popover.svelte +7 -0
- package/dist/admin/components/ui/popover/popover.svelte.d.ts +3 -0
- package/dist/admin/components/ui/switch/switch.svelte +2 -2
- package/dist/admin/components/ui/toggle/toggle.svelte.d.ts +6 -26
- package/dist/admin/components/ui/tooltip/index.d.ts +6 -0
- package/dist/admin/components/ui/tooltip/index.js +8 -0
- package/dist/admin/components/ui/tooltip/tooltip-content.svelte +48 -0
- package/dist/admin/components/ui/tooltip/tooltip-content.svelte.d.ts +11 -0
- package/dist/admin/components/ui/tooltip/tooltip-portal.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-portal.svelte.d.ts +4 -0
- package/dist/admin/components/ui/tooltip/tooltip-provider.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-provider.svelte.d.ts +4 -0
- package/dist/admin/components/ui/tooltip/tooltip-trigger.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-trigger.svelte.d.ts +25 -0
- package/dist/admin/components/ui/tooltip/tooltip.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip.svelte.d.ts +25 -0
- package/dist/admin/generated/admin.css +1298 -234
- package/dist/admin/slug.d.ts +1 -0
- package/dist/admin/slug.js +6 -0
- package/dist/admin/theme-context.d.ts +7 -0
- package/dist/admin/theme-context.js +3 -0
- package/dist/admin/theme.d.ts +7 -0
- package/dist/admin/theme.js +14 -0
- package/dist/admin/types.d.ts +2 -1
- package/dist/admin/uploads.d.ts +8 -1
- package/dist/admin/uploads.js +94 -16
- package/dist/blueprints/files.js +1 -0
- package/dist/blueprints/load.js +7 -2
- package/dist/blueprints/types.d.ts +4 -1
- package/dist/cli/doctor.d.ts +3 -1
- package/dist/cli/doctor.js +85 -30
- package/dist/cli/files.d.ts +2 -6
- package/dist/cli/files.js +11 -2
- package/dist/cli/index.js +99 -31
- package/dist/cli/scaffold.js +8 -8
- package/dist/cli/setup.js +16 -26
- package/dist/cli/upgrade.js +21 -2
- package/dist/env.d.ts +32 -0
- package/dist/env.js +53 -3
- package/dist/server/admin-load.d.ts +13 -5
- package/dist/server/admin-load.js +8 -3
- package/dist/server/api-access.d.ts +4 -0
- package/dist/server/api-access.js +15 -2
- package/dist/server/api-pagination.d.ts +3 -0
- package/dist/server/api.js +11 -3
- package/dist/server/auth.d.ts +11 -9
- package/dist/server/auth.js +23 -0
- package/dist/server/cms.d.ts +65 -18
- package/dist/server/cms.js +62 -6
- package/dist/server/db/migration-data.js +4 -0
- package/dist/server/db/migrations/0009_local_media.sql +9 -0
- package/dist/server/db/migrations/meta/0009_snapshot.json +1763 -0
- package/dist/server/db/migrations/meta/_journal.json +7 -0
- package/dist/server/db/schema.d.ts +119 -2
- package/dist/server/db/schema.js +15 -3
- package/dist/server/hooks.js +155 -81
- package/dist/server/media/contracts.d.ts +115 -0
- package/dist/server/media/contracts.js +12 -0
- package/dist/server/media/deletions.d.ts +2 -1
- package/dist/server/media/deletions.js +3 -3
- package/dist/server/media/delivery.js +7 -11
- package/dist/server/media/import-r2.d.ts +56 -0
- package/dist/server/media/import-r2.js +342 -0
- package/dist/server/media/processor-child.d.ts +2 -0
- package/dist/server/media/processor-child.js +236 -0
- package/dist/server/media/processor.d.ts +51 -0
- package/dist/server/media/processor.js +135 -0
- package/dist/server/media/render-math.d.ts +24 -0
- package/dist/server/media/render-math.js +50 -0
- package/dist/server/media/runner.d.ts +30 -1
- package/dist/server/media/runner.js +418 -165
- package/dist/server/media/service.d.ts +56 -10
- package/dist/server/media/service.js +309 -98
- package/dist/server/media/storage.d.ts +5 -0
- package/dist/server/media/storage.js +279 -0
- package/dist/server/media/svg.d.ts +5 -0
- package/dist/server/media/svg.js +142 -0
- package/dist/server/media/upload-ticket.d.ts +12 -0
- package/dist/server/media/upload-ticket.js +35 -0
- package/dist/server/media/verify.d.ts +36 -0
- package/dist/server/media/verify.js +109 -0
- package/dist/server/platform/http.d.ts +27 -0
- package/dist/server/platform/http.js +77 -0
- package/dist/server/platform/index.d.ts +52 -0
- package/dist/server/platform/index.js +98 -0
- package/dist/server/platform/snapshots.d.ts +18 -0
- package/dist/server/platform/snapshots.js +110 -0
- package/dist/server/platform/volume.d.ts +20 -0
- package/dist/server/platform/volume.js +60 -0
- package/dist/worker/svg.d.ts +1 -5
- package/dist/worker/svg.js +2 -142
- package/docs/acceptance.md +6 -4
- package/docs/api.md +42 -4
- package/docs/cloudflare.md +48 -142
- package/docs/content.md +2 -2
- package/docs/deployment.md +159 -57
- package/docs/forms.md +1 -1
- package/docs/media.md +85 -21
- package/docs/package.md +21 -18
- package/docs/plans/0.7-self-hosted.md +264 -0
- package/docs/releases.md +27 -1
- package/docs/upgrades.md +44 -6
- package/package.json +38 -37
- package/templates/Dockerfile +28 -0
- package/templates/integration.ts +18 -2
- package/templates/railpack.json +1 -1
- package/templates/sandcms/blueprints/files/image.yaml +1 -1
- package/templates/sandcms/config.yaml +0 -1
- package/dist/cli/cloudflare.d.ts +0 -8
- package/dist/cli/cloudflare.js +0 -135
- package/templates/sandcms/worker/index.ts +0 -1
- package/templates/sandcms/worker/local.ts +0 -1
- package/templates/sandcms/worker/wrangler.jsonc +0 -6
package/dist/admin/Inbox.svelte
CHANGED
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
|
|
48
48
|
<div class="cms-page-heading">
|
|
49
49
|
<div>
|
|
50
|
-
<div class="cms-eyebrow">FORM INBOX</div>
|
|
51
50
|
<h1>{data.blueprint?.label}</h1>
|
|
52
51
|
<p class="cms-muted">
|
|
53
52
|
{data.submissions?.filter((s) => !s.read).length ?? 0} unread · {data.submissions?.length ??
|
|
@@ -86,8 +85,7 @@
|
|
|
86
85
|
>
|
|
87
86
|
</Table.Root>{:else}<div class="cms-empty">
|
|
88
87
|
<Inbox size={34} />
|
|
89
|
-
<h2>
|
|
90
|
-
<p>New submissions will appear here.</p>
|
|
88
|
+
<h2>No submissions yet</h2>
|
|
91
89
|
</div>{/if}
|
|
92
90
|
</Card.Root>
|
|
93
91
|
<Dialog.Root
|
|
@@ -123,14 +121,11 @@
|
|
|
123
121
|
No recipients are currently available. Ask an admin to update notification settings.
|
|
124
122
|
</p>{/if}
|
|
125
123
|
{:else}<p>No email attempt recorded.</p>{/if}
|
|
126
|
-
<p class="cms-muted">
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
variant="outline"
|
|
132
|
-
disabled={sending}
|
|
133
|
-
onclick={resend}>{sending ? 'Sending…' : 'Resend notification'}</Button
|
|
124
|
+
{#if data.emailEnabled && data.notificationsEnabled}<p class="cms-muted">
|
|
125
|
+
Resending can produce duplicate email.
|
|
126
|
+
</p>
|
|
127
|
+
<Button variant="outline" disabled={sending} onclick={resend}
|
|
128
|
+
>{sending ? 'Sending…' : 'Resend notification'}</Button
|
|
134
129
|
>{/if}
|
|
135
130
|
{#if error}<p class="cms-error" role="alert">{error}</p>{/if}
|
|
136
131
|
</section>
|
|
@@ -5,7 +5,15 @@
|
|
|
5
5
|
import { Input } from './components/ui/input/index.js';
|
|
6
6
|
import { Label } from './components/ui/label/index.js';
|
|
7
7
|
import { Button } from './components/ui/button/index.js';
|
|
8
|
-
import {
|
|
8
|
+
import { Checkbox } from './components/ui/checkbox/index.js';
|
|
9
|
+
import * as Dialog from './components/ui/dialog/index.js';
|
|
10
|
+
import Link2 from '@lucide/svelte/icons/link-2';
|
|
11
|
+
import FileText from '@lucide/svelte/icons/file-text';
|
|
12
|
+
import Paperclip from '@lucide/svelte/icons/paperclip';
|
|
13
|
+
import Mail from '@lucide/svelte/icons/mail';
|
|
14
|
+
import Phone from '@lucide/svelte/icons/phone';
|
|
15
|
+
import Plus from '@lucide/svelte/icons/plus';
|
|
16
|
+
import X from '@lucide/svelte/icons/x';
|
|
9
17
|
import SelectField from './SelectField.svelte';
|
|
10
18
|
import MediaPicker from './MediaPicker.svelte';
|
|
11
19
|
let {
|
|
@@ -14,7 +22,6 @@
|
|
|
14
22
|
value,
|
|
15
23
|
assets,
|
|
16
24
|
relations,
|
|
17
|
-
workerUrl,
|
|
18
25
|
fileBlueprints,
|
|
19
26
|
invalid = false,
|
|
20
27
|
onchange
|
|
@@ -24,7 +31,6 @@
|
|
|
24
31
|
value?: Json;
|
|
25
32
|
assets: Asset[];
|
|
26
33
|
relations: Relations;
|
|
27
|
-
workerUrl: string;
|
|
28
34
|
fileBlueprints: FileBlueprint[];
|
|
29
35
|
invalid?: boolean;
|
|
30
36
|
onchange: (value: LinkValue | null) => void;
|
|
@@ -47,70 +53,126 @@
|
|
|
47
53
|
}))
|
|
48
54
|
)
|
|
49
55
|
);
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
const destinations: Record<LinkType, string> = {
|
|
57
|
+
url: 'Address',
|
|
58
|
+
entry: 'Entry',
|
|
59
|
+
file: 'File',
|
|
60
|
+
email: 'Email address',
|
|
61
|
+
phone: 'Phone number'
|
|
62
|
+
};
|
|
63
|
+
const icons = { url: Link2, entry: FileText, file: Paperclip, email: Mail, phone: Phone };
|
|
64
|
+
let open = $state(false),
|
|
65
|
+
draft = $state<LinkValue>({ type: 'url', value: '' });
|
|
66
|
+
function edit() {
|
|
67
|
+
draft = { ...link };
|
|
68
|
+
open = true;
|
|
52
69
|
}
|
|
70
|
+
const target = (l: LinkValue) =>
|
|
71
|
+
l.type === 'entry'
|
|
72
|
+
? (entries.find((e) => e.value === l.value)?.label ?? '')
|
|
73
|
+
: l.type === 'file'
|
|
74
|
+
? (assets.find((a) => a.id === l.value)?.filename ?? '')
|
|
75
|
+
: l.value;
|
|
53
76
|
</script>
|
|
54
77
|
|
|
55
|
-
<div class="cms-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<MediaPicker
|
|
77
|
-
{id}
|
|
78
|
-
value={link.value || null}
|
|
79
|
-
{assets}
|
|
80
|
-
{workerUrl}
|
|
81
|
-
fileBlueprint={fileBlueprints.find((b) => b.id === field.fileBlueprint)}
|
|
82
|
-
onchange={(value) => set({ value: typeof value === 'string' ? value : '' })}
|
|
83
|
-
/>
|
|
84
|
-
{:else}
|
|
85
|
-
<Input
|
|
86
|
-
{id}
|
|
87
|
-
value={link.value}
|
|
88
|
-
aria-invalid={invalid}
|
|
89
|
-
type={link.type === 'email' ? 'email' : link.type === 'phone' ? 'tel' : 'text'}
|
|
90
|
-
placeholder={link.type === 'email'
|
|
91
|
-
? 'hello@example.com'
|
|
92
|
-
: link.type === 'phone'
|
|
93
|
-
? '+15551234567'
|
|
94
|
-
: 'https://example.com or /path'}
|
|
95
|
-
oninput={(event) => set({ value: event.currentTarget.value })}
|
|
96
|
-
/>
|
|
97
|
-
{/if}
|
|
98
|
-
<div class="cms-field">
|
|
99
|
-
<Label for={id + '-label'}>Link text</Label>
|
|
100
|
-
<Input
|
|
101
|
-
id={id + '-label'}
|
|
102
|
-
value={link.label ?? ''}
|
|
103
|
-
placeholder="Optional"
|
|
104
|
-
oninput={(event) => set({ label: event.currentTarget.value })}
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
<div class="cms-checkbox">
|
|
108
|
-
<Switch
|
|
109
|
-
id={id + '-new-tab'}
|
|
110
|
-
checked={link.newTab ?? false}
|
|
111
|
-
onCheckedChange={(newTab) => set({ newTab })}
|
|
112
|
-
/>
|
|
113
|
-
<Label for={id + '-new-tab'}>Open in new tab</Label>
|
|
114
|
-
</div>
|
|
115
|
-
{#if value}<Button variant="outline" onclick={() => onchange(null)}>Clear link</Button>{/if}
|
|
78
|
+
<div class="cms-link">
|
|
79
|
+
{#if value}
|
|
80
|
+
{@const Icon = icons[link.type]}
|
|
81
|
+
<div class="cms-link-summary">
|
|
82
|
+
<Icon size={16} />
|
|
83
|
+
<span class="cms-link-text">
|
|
84
|
+
<strong>{link.label || target(link) || 'Untitled link'}</strong>
|
|
85
|
+
<span class="cms-muted"
|
|
86
|
+
>{titles[link.type]}{link.label && target(link) ? ' · ' + target(link) : ''}{link.newTab
|
|
87
|
+
? ' · New tab'
|
|
88
|
+
: ''}</span
|
|
89
|
+
>
|
|
90
|
+
</span>
|
|
91
|
+
</div>
|
|
92
|
+
<Button {id} variant="outline" size="sm" aria-invalid={invalid} onclick={edit}>Edit</Button>
|
|
93
|
+
<Button variant="ghost" size="icon-sm" aria-label="Remove link" onclick={() => onchange(null)}
|
|
94
|
+
><X /></Button
|
|
95
|
+
>
|
|
96
|
+
{:else}<Button {id} variant="outline" class="cms-link-add" aria-invalid={invalid} onclick={edit}
|
|
97
|
+
><Plus /> Add link</Button
|
|
98
|
+
>{/if}
|
|
116
99
|
</div>
|
|
100
|
+
<Dialog.Root bind:open>
|
|
101
|
+
<Dialog.Content portalProps={{ disabled: true }}>
|
|
102
|
+
<Dialog.Header><Dialog.Title>{value ? 'Edit link' : 'Add link'}</Dialog.Title></Dialog.Header>
|
|
103
|
+
<form
|
|
104
|
+
class="cms-stack"
|
|
105
|
+
onsubmit={(event) => {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
onchange(draft);
|
|
108
|
+
open = false;
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<div class="cms-field">
|
|
112
|
+
<Label for={id + '-type'}>Link type</Label>
|
|
113
|
+
<SelectField
|
|
114
|
+
id={id + '-type'}
|
|
115
|
+
value={draft.type}
|
|
116
|
+
clearable={false}
|
|
117
|
+
options={linkTypes.map((type) => ({ value: type, label: titles[type] }))}
|
|
118
|
+
onchange={(type) => (draft = { ...draft, type: type as LinkType, value: '' })}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="cms-field">
|
|
122
|
+
<Label for={id + '-value'}>{destinations[draft.type]}</Label>
|
|
123
|
+
{#if draft.type === 'entry'}
|
|
124
|
+
<SelectField
|
|
125
|
+
id={id + '-value'}
|
|
126
|
+
value={draft.value}
|
|
127
|
+
options={entries}
|
|
128
|
+
placeholder="Choose an entry"
|
|
129
|
+
onchange={(value) => (draft = { ...draft, value })}
|
|
130
|
+
/>
|
|
131
|
+
{:else if draft.type === 'file'}
|
|
132
|
+
<MediaPicker
|
|
133
|
+
id={id + '-value'}
|
|
134
|
+
value={draft.value || null}
|
|
135
|
+
{assets}
|
|
136
|
+
fileBlueprint={fileBlueprints.find((b) => b.id === field.fileBlueprint)}
|
|
137
|
+
onchange={(value) =>
|
|
138
|
+
(draft = { ...draft, value: typeof value === 'string' ? value : '' })}
|
|
139
|
+
/>
|
|
140
|
+
{:else}
|
|
141
|
+
<Input
|
|
142
|
+
id={id + '-value'}
|
|
143
|
+
value={draft.value}
|
|
144
|
+
type={draft.type === 'email' ? 'email' : draft.type === 'phone' ? 'tel' : 'text'}
|
|
145
|
+
placeholder={draft.type === 'email'
|
|
146
|
+
? 'hello@example.com'
|
|
147
|
+
: draft.type === 'phone'
|
|
148
|
+
? '+15551234567'
|
|
149
|
+
: 'https://example.com or /path'}
|
|
150
|
+
oninput={(event) => (draft = { ...draft, value: event.currentTarget.value })}
|
|
151
|
+
/>
|
|
152
|
+
{/if}
|
|
153
|
+
</div>
|
|
154
|
+
<div class="cms-field">
|
|
155
|
+
<Label for={id + '-label'}>Link text</Label>
|
|
156
|
+
<Input
|
|
157
|
+
id={id + '-label'}
|
|
158
|
+
value={draft.label ?? ''}
|
|
159
|
+
placeholder="Optional"
|
|
160
|
+
oninput={(event) => (draft = { ...draft, label: event.currentTarget.value })}
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="cms-checkbox">
|
|
164
|
+
<Checkbox
|
|
165
|
+
id={id + '-new-tab'}
|
|
166
|
+
checked={draft.newTab ?? false}
|
|
167
|
+
onCheckedChange={(newTab) => (draft = { ...draft, newTab })}
|
|
168
|
+
/>
|
|
169
|
+
<Label for={id + '-new-tab'}>Open in new tab</Label>
|
|
170
|
+
</div>
|
|
171
|
+
<Dialog.Footer
|
|
172
|
+
><Button variant="outline" onclick={() => (open = false)}>Cancel</Button><Button
|
|
173
|
+
type="submit">Done</Button
|
|
174
|
+
></Dialog.Footer
|
|
175
|
+
>
|
|
176
|
+
</form>
|
|
177
|
+
</Dialog.Content>
|
|
178
|
+
</Dialog.Root>
|
package/dist/admin/Login.svelte
CHANGED
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
<div class="cms-login">
|
|
46
46
|
<a href="/" class="cms-wordmark"><Layers size={24} /> SandCMS</a>
|
|
47
47
|
<Card.Root class="cms-login-card gap-0">
|
|
48
|
-
<div class="cms-eyebrow">YOUR WEBSITE, IN GOOD HANDS</div>
|
|
49
48
|
<h1>{twoFactor ? 'Verify your sign-in' : 'Welcome back'}</h1>
|
|
50
49
|
<p class="cms-muted">
|
|
51
50
|
{twoFactor
|
|
@@ -6,14 +6,16 @@
|
|
|
6
6
|
import type { Payload } from '../blueprints/types.js';
|
|
7
7
|
import Fields from './Fields.svelte';
|
|
8
8
|
import type { AdminData, Asset } from './types.js';
|
|
9
|
-
import { api, assetUrl, message } from './client.js';
|
|
9
|
+
import { api, assetUrl, megabytes, message } from './client.js';
|
|
10
10
|
import { Button } from './components/ui/button/index.js';
|
|
11
11
|
import { Label } from './components/ui/label/index.js';
|
|
12
|
+
import { Badge } from './components/ui/badge/index.js';
|
|
12
13
|
import * as Dialog from './components/ui/dialog/index.js';
|
|
13
14
|
import Image from '@lucide/svelte/icons/image';
|
|
14
15
|
import SelectField from './SelectField.svelte';
|
|
15
16
|
import { uploadImages, type UploadItem, type UploadFailure } from './uploads.js';
|
|
16
17
|
import UploadQueue from './UploadQueue.svelte';
|
|
18
|
+
import UploadProgress from './UploadProgress.svelte';
|
|
17
19
|
import AssetAttachment from './AssetAttachment.svelte';
|
|
18
20
|
import UploadButton from './UploadButton.svelte';
|
|
19
21
|
import Notice from './Notice.svelte';
|
|
@@ -37,15 +39,33 @@
|
|
|
37
39
|
batchBlueprint = $state<string | undefined>(),
|
|
38
40
|
confirmDelete = $state(false);
|
|
39
41
|
let openedLink = $state('');
|
|
40
|
-
afterNavigate(() => openedLink = '');
|
|
42
|
+
afterNavigate(() => (openedLink = ''));
|
|
41
43
|
$effect(() => {
|
|
42
44
|
const id = page.url.searchParams.get('asset');
|
|
43
|
-
if (!id) {
|
|
45
|
+
if (!id) {
|
|
46
|
+
openedLink = '';
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
44
49
|
const asset = data.assets?.find((asset) => asset.id === id);
|
|
45
50
|
if (asset && openedLink !== id) {
|
|
46
|
-
openedLink = id;
|
|
51
|
+
openedLink = id;
|
|
52
|
+
active = asset;
|
|
53
|
+
metadata = structuredClone(asset.metadata);
|
|
54
|
+
confirmDelete = false;
|
|
47
55
|
}
|
|
48
56
|
});
|
|
57
|
+
const usedIn = $derived.by(() => {
|
|
58
|
+
const grouped = new Map<
|
|
59
|
+
string,
|
|
60
|
+
{ blueprint: string; documentId: string; snapshots: string[] }
|
|
61
|
+
>();
|
|
62
|
+
for (const usage of (active && data.usages?.[active.id]) || []) {
|
|
63
|
+
const item = grouped.get(usage.documentId) ?? { ...usage, snapshots: [] };
|
|
64
|
+
item.snapshots.push(usage.snapshot);
|
|
65
|
+
grouped.set(usage.documentId, item);
|
|
66
|
+
}
|
|
67
|
+
return [...grouped.values()];
|
|
68
|
+
});
|
|
49
69
|
const isPublic = (id: string) =>
|
|
50
70
|
data.usages?.[id]?.some((usage) => usage.snapshot === 'published') ?? false;
|
|
51
71
|
onMount(() => {
|
|
@@ -90,6 +110,9 @@
|
|
|
90
110
|
batchBlueprint,
|
|
91
111
|
(index, state, error) => {
|
|
92
112
|
uploads[index] = { ...uploads[index], state, error };
|
|
113
|
+
},
|
|
114
|
+
(index, sent) => {
|
|
115
|
+
uploads[index] = { ...uploads[index], sent };
|
|
93
116
|
}
|
|
94
117
|
);
|
|
95
118
|
error = failures.map((failure) => failure.message).join('\n');
|
|
@@ -117,11 +140,7 @@
|
|
|
117
140
|
</script>
|
|
118
141
|
|
|
119
142
|
<div class="cms-page-heading">
|
|
120
|
-
<
|
|
121
|
-
<div class="cms-eyebrow">YOUR SHARED LIBRARY</div>
|
|
122
|
-
<h1>Media library</h1>
|
|
123
|
-
<p class="cms-muted">Upload once. Use it wherever your story takes you.</p>
|
|
124
|
-
</div>
|
|
143
|
+
<h1>Media library</h1>
|
|
125
144
|
<div class="cms-stack">
|
|
126
145
|
{#if uploadChoices.length > 1}<Label for="upload-blueprint">Upload as</Label><SelectField
|
|
127
146
|
id="upload-blueprint"
|
|
@@ -138,6 +157,7 @@
|
|
|
138
157
|
</div>
|
|
139
158
|
</div>
|
|
140
159
|
<UploadQueue items={uploads} />
|
|
160
|
+
<UploadProgress items={uploads} />
|
|
141
161
|
{#if failures.length}
|
|
142
162
|
<Button
|
|
143
163
|
variant="outline"
|
|
@@ -147,34 +167,36 @@
|
|
|
147
167
|
{/if}
|
|
148
168
|
{#if progress}<p role="status">{progress}</p>{/if}
|
|
149
169
|
{#if error}<Notice error>{error}</Notice>{/if}
|
|
150
|
-
<div class="cms-
|
|
170
|
+
<div class="cms-list-meta">
|
|
151
171
|
<span class="cms-muted">{data.assets?.length ?? 0} assets</span><span class="cms-muted"
|
|
152
|
-
>Up to {(data.uploadLimit ?? 0)
|
|
172
|
+
>Up to {megabytes(data.uploadLimit ?? 0)} MB per image, including TIFF · SVG up to 1 MB</span
|
|
153
173
|
>
|
|
154
174
|
</div>
|
|
155
|
-
<SearchList
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
<SearchList
|
|
176
|
+
path="media/list"
|
|
177
|
+
initial={data.assets ?? []}
|
|
178
|
+
label="Search media"
|
|
179
|
+
refreshKey={JSON.stringify(data.assets)}
|
|
180
|
+
>
|
|
181
|
+
{#snippet children(assets)}
|
|
182
|
+
{#if assets.length}<div class="cms-media-grid">
|
|
183
|
+
{#each assets as asset (asset.id)}
|
|
184
|
+
<AssetAttachment
|
|
185
|
+
{asset}
|
|
186
|
+
class="cms-media-card"
|
|
187
|
+
visibility={isPublic(asset.id) ? 'Public' : 'Private'}
|
|
188
|
+
onopen={() => {
|
|
189
|
+
active = asset;
|
|
190
|
+
metadata = structuredClone(asset.metadata);
|
|
191
|
+
confirmDelete = false;
|
|
192
|
+
}}
|
|
193
|
+
/>
|
|
194
|
+
{/each}
|
|
195
|
+
</div>{:else if !data.assets?.length}<Card.Root class="cms-empty">
|
|
196
|
+
<Image size={36} />
|
|
197
|
+
<h2>No images yet</h2>
|
|
198
|
+
</Card.Root>{/if}
|
|
199
|
+
{/snippet}
|
|
178
200
|
</SearchList>
|
|
179
201
|
<Dialog.Root
|
|
180
202
|
open={!!active}
|
|
@@ -183,27 +205,21 @@
|
|
|
183
205
|
}}
|
|
184
206
|
><Dialog.Content portalProps={{ disabled: true }} class="cms-asset-dialog"
|
|
185
207
|
><Dialog.Header
|
|
186
|
-
><Dialog.Title>{active?.filename}</Dialog.Title
|
|
187
|
-
|
|
188
|
-
|
|
208
|
+
><Dialog.Title>{active?.filename}</Dialog.Title>{#if active}<Badge variant="outline"
|
|
209
|
+
>{isPublic(active.id) ? 'Public' : 'Private'}</Badge
|
|
210
|
+
>{/if}</Dialog.Header
|
|
189
211
|
>{#if active}{@const blueprint = data.fileBlueprints?.find((b) => b.id === active!.blueprint)}
|
|
190
212
|
<div class="cms-stack">
|
|
191
|
-
{#if !Object.values(blueprint?.fields ?? {}).some((field) => field.type === 'focus') && assetUrl(active
|
|
213
|
+
{#if !Object.values(blueprint?.fields ?? {}).some((field) => field.type === 'focus') && assetUrl(active)}<img
|
|
192
214
|
class="cms-asset-preview"
|
|
193
|
-
src={assetUrl(active
|
|
215
|
+
src={assetUrl(active)}
|
|
194
216
|
alt={String(active.metadata.alt ?? '')}
|
|
195
217
|
/>{/if}
|
|
196
|
-
<
|
|
197
|
-
{isPublic(active.id)
|
|
198
|
-
? 'Used in published content. Website variants are public; the original stays private.'
|
|
199
|
-
: 'Private. Only signed-in editors can view this image until it is used in published content.'}
|
|
200
|
-
</p>
|
|
201
|
-
{#if blueprint}<p class="cms-muted">{blueprint.label}</p>
|
|
202
|
-
<Fields
|
|
218
|
+
{#if blueprint}<Fields
|
|
203
219
|
imageUrl={active.variants.some(
|
|
204
220
|
(v) => v.preset === 'sandcms-preview' || v.format === 'svg'
|
|
205
221
|
)
|
|
206
|
-
? assetUrl(active
|
|
222
|
+
? assetUrl(active)
|
|
207
223
|
: undefined}
|
|
208
224
|
fields={blueprint.fields}
|
|
209
225
|
value={metadata}
|
|
@@ -212,7 +228,6 @@
|
|
|
212
228
|
}}
|
|
213
229
|
assets={data.assets ?? []}
|
|
214
230
|
relations={data.relations ?? {}}
|
|
215
|
-
workerUrl={data.workerUrl!}
|
|
216
231
|
fileBlueprints={data.fileBlueprints}
|
|
217
232
|
prefix="media"
|
|
218
233
|
/>{/if}
|
|
@@ -227,14 +242,13 @@
|
|
|
227
242
|
onclick={() => action('media/retry', { id: active!.id })}>Retry processing</Button
|
|
228
243
|
>{/if}
|
|
229
244
|
{/if}
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
>{usage.
|
|
236
|
-
|
|
237
|
-
</div>
|
|
245
|
+
{#if usedIn.length}<p class="cms-usages">
|
|
246
|
+
Used in {#each usedIn as usage, i}{i ? ', ' : ''}<a
|
|
247
|
+
href={'/admin/content/' + usage.blueprint + '/' + usage.documentId}
|
|
248
|
+
>{usage.blueprint}</a
|
|
249
|
+
>
|
|
250
|
+
<span class="cms-muted">({usage.snapshots.join(', ')})</span>{/each}
|
|
251
|
+
</p>{/if}
|
|
238
252
|
{#if confirmDelete}<div class="cms-alert">
|
|
239
253
|
<p>
|
|
240
254
|
Delete this image? Its references will be cleared from drafts and published content.
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
import Upload from '@lucide/svelte/icons/upload';
|
|
9
9
|
import { uploadImages, type UploadItem, type UploadFailure } from './uploads.js';
|
|
10
10
|
import UploadQueue from './UploadQueue.svelte';
|
|
11
|
+
import UploadProgress from './UploadProgress.svelte';
|
|
12
|
+
import { imageMimeTypes } from '../blueprints/files.js';
|
|
11
13
|
import AssetAttachment from './AssetAttachment.svelte';
|
|
12
14
|
import SortableList from './SortableList.svelte';
|
|
13
15
|
import UploadButton from './UploadButton.svelte';
|
|
14
16
|
let {
|
|
15
17
|
value,
|
|
16
18
|
assets,
|
|
17
|
-
workerUrl,
|
|
18
19
|
onchange,
|
|
19
20
|
multiple = false,
|
|
20
21
|
hideSelection = false,
|
|
@@ -24,7 +25,6 @@
|
|
|
24
25
|
}: {
|
|
25
26
|
value: string | string[] | null;
|
|
26
27
|
assets: Asset[];
|
|
27
|
-
workerUrl: string;
|
|
28
28
|
onchange: (v: string | string[] | null) => void;
|
|
29
29
|
multiple?: boolean;
|
|
30
30
|
hideSelection?: boolean;
|
|
@@ -35,16 +35,7 @@
|
|
|
35
35
|
let uploads = $state<UploadItem[]>([]);
|
|
36
36
|
let dropArea = $state<HTMLDivElement | null>(null);
|
|
37
37
|
let dragging = $state(false);
|
|
38
|
-
const accept = $derived(
|
|
39
|
-
fileBlueprint?.accept ?? [
|
|
40
|
-
'image/jpeg',
|
|
41
|
-
'image/png',
|
|
42
|
-
'image/webp',
|
|
43
|
-
'image/avif',
|
|
44
|
-
'image/gif',
|
|
45
|
-
'image/svg+xml'
|
|
46
|
-
]
|
|
47
|
-
);
|
|
38
|
+
const accept = $derived(fileBlueprint?.accept ?? imageMimeTypes);
|
|
48
39
|
// Listen across the window so the grid responds as soon as files enter the app.
|
|
49
40
|
// The depth counter avoids flicker when crossing descendants of the grid.
|
|
50
41
|
$effect(() => {
|
|
@@ -172,6 +163,9 @@
|
|
|
172
163
|
batchBlueprint,
|
|
173
164
|
(index, state, error) => {
|
|
174
165
|
uploads[index] = { ...uploads[index], state, error };
|
|
166
|
+
},
|
|
167
|
+
(index, sent) => {
|
|
168
|
+
uploads[index] = { ...uploads[index], sent };
|
|
175
169
|
}
|
|
176
170
|
);
|
|
177
171
|
error = failures.map((failure) => failure.message).join('\n');
|
|
@@ -184,7 +178,6 @@
|
|
|
184
178
|
{#snippet selectedImage(asset: Asset)}
|
|
185
179
|
<AssetAttachment
|
|
186
180
|
{asset}
|
|
187
|
-
{workerUrl}
|
|
188
181
|
orientation="horizontal"
|
|
189
182
|
class="w-full"
|
|
190
183
|
onremove={() => onchange(multiple ? (value as string[]).filter((id) => id !== asset.id) : null)}
|
|
@@ -221,11 +214,9 @@
|
|
|
221
214
|
: 'Choose an image'}
|
|
222
215
|
</Button>{/snippet}</Dialog.Trigger
|
|
223
216
|
><Dialog.Content portalProps={{ disabled: true }} class="cms-media-dialog"
|
|
224
|
-
><Dialog.Header
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
></Dialog.Header
|
|
228
|
-
><UploadQueue items={uploads} />
|
|
217
|
+
><Dialog.Header><Dialog.Title>Media library</Dialog.Title></Dialog.Header><UploadQueue
|
|
218
|
+
items={uploads}
|
|
219
|
+
/><UploadProgress items={uploads} />
|
|
229
220
|
{#if failures.length}
|
|
230
221
|
<Button
|
|
231
222
|
variant="outline"
|
|
@@ -239,43 +230,59 @@
|
|
|
239
230
|
{error}
|
|
240
231
|
</p>{/if}
|
|
241
232
|
{#if open}<SearchList
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
233
|
+
path={'media/list' +
|
|
234
|
+
(fileBlueprint
|
|
235
|
+
? '?' +
|
|
236
|
+
new URLSearchParams([
|
|
237
|
+
['blueprint', fileBlueprint.id],
|
|
238
|
+
...fileBlueprint.accept.map((mime): [string, string] => ['mime', mime])
|
|
239
|
+
]).toString()
|
|
240
|
+
: '')}
|
|
241
|
+
initial={all.filter(
|
|
242
|
+
(a) =>
|
|
243
|
+
!fileBlueprint ||
|
|
244
|
+
(a.blueprint === fileBlueprint.id && fileBlueprint.accept.includes(a.mime))
|
|
245
|
+
)}
|
|
246
|
+
label="Search media"
|
|
247
|
+
refreshKey={JSON.stringify(all)}
|
|
248
|
+
>
|
|
249
|
+
{#snippet children(matches)}
|
|
250
|
+
<div class="cms-picker-drop-area" bind:this={dropArea}>
|
|
251
|
+
<div class="cms-picker-grid">
|
|
252
|
+
<UploadButton tile {busy} {multiple} accept={accept.join(',')} onchange={upload} />
|
|
253
|
+
{#each matches.filter((a) => a.status !== 'deleting') as asset (asset.id)}
|
|
254
|
+
<AssetAttachment
|
|
255
|
+
{asset}
|
|
256
|
+
class="cms-picker-item"
|
|
257
|
+
selected={selected.some((a) => a.id === asset.id)}
|
|
258
|
+
onopen={() => {
|
|
259
|
+
if (!all.some((a) => a.id === asset.id)) {
|
|
260
|
+
extra = [...extra, asset];
|
|
261
|
+
onasset?.(asset);
|
|
262
|
+
}
|
|
263
|
+
select(asset.id);
|
|
264
|
+
}}
|
|
265
|
+
/>
|
|
266
|
+
{/each}
|
|
267
|
+
</div>
|
|
268
|
+
<div class="cms-picker-drop-overlay" data-active={dragging} aria-hidden={!dragging}>
|
|
269
|
+
<Upload size={32} />
|
|
270
|
+
<strong
|
|
271
|
+
>{busy
|
|
272
|
+
? 'Upload in progress'
|
|
273
|
+
: multiple
|
|
274
|
+
? 'Drop images here'
|
|
275
|
+
: 'Drop an image here'}</strong
|
|
276
|
+
>
|
|
277
|
+
<span
|
|
278
|
+
>{busy
|
|
279
|
+
? 'Wait for your current upload to finish.'
|
|
280
|
+
: 'Release to upload to your library'}</span
|
|
281
|
+
>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
{/snippet}</SearchList
|
|
285
|
+
>{/if}
|
|
279
286
|
{#if multiple}<div class="flex justify-end">
|
|
280
287
|
<Button onclick={() => (open = false)}>Done</Button>
|
|
281
288
|
</div>{/if}</Dialog.Content
|