sandcms 0.6.2 → 0.6.3
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 +1 -1
- package/dist/admin/Account.svelte +284 -83
- package/dist/admin/ApiKeys.svelte +146 -79
- package/dist/admin/AssetAttachment.svelte +9 -9
- package/dist/admin/BlueprintFields.svelte +20 -2
- package/dist/admin/BlueprintFields.svelte.d.ts +2 -0
- 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 +71 -65
- package/dist/admin/Fields.svelte +24 -16
- package/dist/admin/FocusPicker.svelte +1 -2
- package/dist/admin/Gallery.svelte +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 +129 -64
- package/dist/admin/Login.svelte +0 -1
- package/dist/admin/MediaLibrary.svelte +61 -50
- package/dist/admin/MediaPicker.svelte +57 -42
- 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/Users.svelte +106 -50
- package/dist/admin/client.d.ts +2 -0
- package/dist/admin/client.js +18 -0
- 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/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 +774 -138
- package/dist/admin/slug.d.ts +1 -0
- package/dist/admin/slug.js +6 -0
- package/dist/cli/index.js +0 -0
- package/dist/server/admin-load.js +2 -2
- package/dist/server/api.js +6 -1
- package/dist/server/auth.d.ts +1 -0
- package/dist/server/auth.js +23 -0
- package/docs/api.md +1 -1
- package/docs/package.md +4 -4
- package/docs/releases.md +10 -0
- package/docs/upgrades.md +9 -0
- package/package.json +5 -3
|
@@ -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 {
|
|
@@ -47,70 +55,127 @@
|
|
|
47
55
|
}))
|
|
48
56
|
)
|
|
49
57
|
);
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
const destinations: Record<LinkType, string> = {
|
|
59
|
+
url: 'Address',
|
|
60
|
+
entry: 'Entry',
|
|
61
|
+
file: 'File',
|
|
62
|
+
email: 'Email address',
|
|
63
|
+
phone: 'Phone number'
|
|
64
|
+
};
|
|
65
|
+
const icons = { url: Link2, entry: FileText, file: Paperclip, email: Mail, phone: Phone };
|
|
66
|
+
let open = $state(false),
|
|
67
|
+
draft = $state<LinkValue>({ type: 'url', value: '' });
|
|
68
|
+
function edit() {
|
|
69
|
+
draft = { ...link };
|
|
70
|
+
open = true;
|
|
52
71
|
}
|
|
72
|
+
const target = (l: LinkValue) =>
|
|
73
|
+
l.type === 'entry'
|
|
74
|
+
? (entries.find((e) => e.value === l.value)?.label ?? '')
|
|
75
|
+
: l.type === 'file'
|
|
76
|
+
? (assets.find((a) => a.id === l.value)?.filename ?? '')
|
|
77
|
+
: l.value;
|
|
53
78
|
</script>
|
|
54
79
|
|
|
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}
|
|
80
|
+
<div class="cms-link">
|
|
81
|
+
{#if value}
|
|
82
|
+
{@const Icon = icons[link.type]}
|
|
83
|
+
<div class="cms-link-summary">
|
|
84
|
+
<Icon size={16} />
|
|
85
|
+
<span class="cms-link-text">
|
|
86
|
+
<strong>{link.label || target(link) || 'Untitled link'}</strong>
|
|
87
|
+
<span class="cms-muted"
|
|
88
|
+
>{titles[link.type]}{link.label && target(link) ? ' · ' + target(link) : ''}{link.newTab
|
|
89
|
+
? ' · New tab'
|
|
90
|
+
: ''}</span
|
|
91
|
+
>
|
|
92
|
+
</span>
|
|
93
|
+
</div>
|
|
94
|
+
<Button {id} variant="outline" size="sm" aria-invalid={invalid} onclick={edit}>Edit</Button>
|
|
95
|
+
<Button variant="ghost" size="icon-sm" aria-label="Remove link" onclick={() => onchange(null)}
|
|
96
|
+
><X /></Button
|
|
97
|
+
>
|
|
98
|
+
{:else}<Button {id} variant="outline" class="cms-link-add" aria-invalid={invalid} onclick={edit}
|
|
99
|
+
><Plus /> Add link</Button
|
|
100
|
+
>{/if}
|
|
116
101
|
</div>
|
|
102
|
+
<Dialog.Root bind:open>
|
|
103
|
+
<Dialog.Content portalProps={{ disabled: true }}>
|
|
104
|
+
<Dialog.Header><Dialog.Title>{value ? 'Edit link' : 'Add link'}</Dialog.Title></Dialog.Header>
|
|
105
|
+
<form
|
|
106
|
+
class="cms-stack"
|
|
107
|
+
onsubmit={(event) => {
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
onchange(draft);
|
|
110
|
+
open = false;
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<div class="cms-field">
|
|
114
|
+
<Label for={id + '-type'}>Link type</Label>
|
|
115
|
+
<SelectField
|
|
116
|
+
id={id + '-type'}
|
|
117
|
+
value={draft.type}
|
|
118
|
+
clearable={false}
|
|
119
|
+
options={linkTypes.map((type) => ({ value: type, label: titles[type] }))}
|
|
120
|
+
onchange={(type) => (draft = { ...draft, type: type as LinkType, value: '' })}
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
<div class="cms-field">
|
|
124
|
+
<Label for={id + '-value'}>{destinations[draft.type]}</Label>
|
|
125
|
+
{#if draft.type === 'entry'}
|
|
126
|
+
<SelectField
|
|
127
|
+
id={id + '-value'}
|
|
128
|
+
value={draft.value}
|
|
129
|
+
options={entries}
|
|
130
|
+
placeholder="Choose an entry"
|
|
131
|
+
onchange={(value) => (draft = { ...draft, value })}
|
|
132
|
+
/>
|
|
133
|
+
{:else if draft.type === 'file'}
|
|
134
|
+
<MediaPicker
|
|
135
|
+
id={id + '-value'}
|
|
136
|
+
value={draft.value || null}
|
|
137
|
+
{assets}
|
|
138
|
+
{workerUrl}
|
|
139
|
+
fileBlueprint={fileBlueprints.find((b) => b.id === field.fileBlueprint)}
|
|
140
|
+
onchange={(value) =>
|
|
141
|
+
(draft = { ...draft, value: typeof value === 'string' ? value : '' })}
|
|
142
|
+
/>
|
|
143
|
+
{:else}
|
|
144
|
+
<Input
|
|
145
|
+
id={id + '-value'}
|
|
146
|
+
value={draft.value}
|
|
147
|
+
type={draft.type === 'email' ? 'email' : draft.type === 'phone' ? 'tel' : 'text'}
|
|
148
|
+
placeholder={draft.type === 'email'
|
|
149
|
+
? 'hello@example.com'
|
|
150
|
+
: draft.type === 'phone'
|
|
151
|
+
? '+15551234567'
|
|
152
|
+
: 'https://example.com or /path'}
|
|
153
|
+
oninput={(event) => (draft = { ...draft, value: event.currentTarget.value })}
|
|
154
|
+
/>
|
|
155
|
+
{/if}
|
|
156
|
+
</div>
|
|
157
|
+
<div class="cms-field">
|
|
158
|
+
<Label for={id + '-label'}>Link text</Label>
|
|
159
|
+
<Input
|
|
160
|
+
id={id + '-label'}
|
|
161
|
+
value={draft.label ?? ''}
|
|
162
|
+
placeholder="Optional"
|
|
163
|
+
oninput={(event) => (draft = { ...draft, label: event.currentTarget.value })}
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
<div class="cms-checkbox">
|
|
167
|
+
<Checkbox
|
|
168
|
+
id={id + '-new-tab'}
|
|
169
|
+
checked={draft.newTab ?? false}
|
|
170
|
+
onCheckedChange={(newTab) => (draft = { ...draft, newTab })}
|
|
171
|
+
/>
|
|
172
|
+
<Label for={id + '-new-tab'}>Open in new tab</Label>
|
|
173
|
+
</div>
|
|
174
|
+
<Dialog.Footer
|
|
175
|
+
><Button variant="outline" onclick={() => (open = false)}>Cancel</Button><Button
|
|
176
|
+
type="submit">Done</Button
|
|
177
|
+
></Dialog.Footer
|
|
178
|
+
>
|
|
179
|
+
</form>
|
|
180
|
+
</Dialog.Content>
|
|
181
|
+
</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
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { api, assetUrl, 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';
|
|
@@ -37,15 +38,33 @@
|
|
|
37
38
|
batchBlueprint = $state<string | undefined>(),
|
|
38
39
|
confirmDelete = $state(false);
|
|
39
40
|
let openedLink = $state('');
|
|
40
|
-
afterNavigate(() => openedLink = '');
|
|
41
|
+
afterNavigate(() => (openedLink = ''));
|
|
41
42
|
$effect(() => {
|
|
42
43
|
const id = page.url.searchParams.get('asset');
|
|
43
|
-
if (!id) {
|
|
44
|
+
if (!id) {
|
|
45
|
+
openedLink = '';
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
44
48
|
const asset = data.assets?.find((asset) => asset.id === id);
|
|
45
49
|
if (asset && openedLink !== id) {
|
|
46
|
-
openedLink = id;
|
|
50
|
+
openedLink = id;
|
|
51
|
+
active = asset;
|
|
52
|
+
metadata = structuredClone(asset.metadata);
|
|
53
|
+
confirmDelete = false;
|
|
47
54
|
}
|
|
48
55
|
});
|
|
56
|
+
const usedIn = $derived.by(() => {
|
|
57
|
+
const grouped = new Map<
|
|
58
|
+
string,
|
|
59
|
+
{ blueprint: string; documentId: string; snapshots: string[] }
|
|
60
|
+
>();
|
|
61
|
+
for (const usage of (active && data.usages?.[active.id]) || []) {
|
|
62
|
+
const item = grouped.get(usage.documentId) ?? { ...usage, snapshots: [] };
|
|
63
|
+
item.snapshots.push(usage.snapshot);
|
|
64
|
+
grouped.set(usage.documentId, item);
|
|
65
|
+
}
|
|
66
|
+
return [...grouped.values()];
|
|
67
|
+
});
|
|
49
68
|
const isPublic = (id: string) =>
|
|
50
69
|
data.usages?.[id]?.some((usage) => usage.snapshot === 'published') ?? false;
|
|
51
70
|
onMount(() => {
|
|
@@ -117,11 +136,7 @@
|
|
|
117
136
|
</script>
|
|
118
137
|
|
|
119
138
|
<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>
|
|
139
|
+
<h1>Media library</h1>
|
|
125
140
|
<div class="cms-stack">
|
|
126
141
|
{#if uploadChoices.length > 1}<Label for="upload-blueprint">Upload as</Label><SelectField
|
|
127
142
|
id="upload-blueprint"
|
|
@@ -147,34 +162,37 @@
|
|
|
147
162
|
{/if}
|
|
148
163
|
{#if progress}<p role="status">{progress}</p>{/if}
|
|
149
164
|
{#if error}<Notice error>{error}</Notice>{/if}
|
|
150
|
-
<div class="cms-
|
|
165
|
+
<div class="cms-list-meta">
|
|
151
166
|
<span class="cms-muted">{data.assets?.length ?? 0} assets</span><span class="cms-muted"
|
|
152
167
|
>Up to {(data.uploadLimit ?? 0) / 1_000_000} MB per image · SVG up to 1 MB</span
|
|
153
168
|
>
|
|
154
169
|
</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
|
-
{
|
|
170
|
+
<SearchList
|
|
171
|
+
path="media/list"
|
|
172
|
+
initial={data.assets ?? []}
|
|
173
|
+
label="Search media"
|
|
174
|
+
refreshKey={JSON.stringify(data.assets)}
|
|
175
|
+
>
|
|
176
|
+
{#snippet children(assets)}
|
|
177
|
+
{#if assets.length}<div class="cms-media-grid">
|
|
178
|
+
{#each assets as asset (asset.id)}
|
|
179
|
+
<AssetAttachment
|
|
180
|
+
{asset}
|
|
181
|
+
workerUrl={data.workerUrl!}
|
|
182
|
+
class="cms-media-card"
|
|
183
|
+
visibility={isPublic(asset.id) ? 'Public' : 'Private'}
|
|
184
|
+
onopen={() => {
|
|
185
|
+
active = asset;
|
|
186
|
+
metadata = structuredClone(asset.metadata);
|
|
187
|
+
confirmDelete = false;
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
{/each}
|
|
191
|
+
</div>{:else if !data.assets?.length}<Card.Root class="cms-empty">
|
|
192
|
+
<Image size={36} />
|
|
193
|
+
<h2>No images yet</h2>
|
|
194
|
+
</Card.Root>{/if}
|
|
195
|
+
{/snippet}
|
|
178
196
|
</SearchList>
|
|
179
197
|
<Dialog.Root
|
|
180
198
|
open={!!active}
|
|
@@ -183,9 +201,9 @@
|
|
|
183
201
|
}}
|
|
184
202
|
><Dialog.Content portalProps={{ disabled: true }} class="cms-asset-dialog"
|
|
185
203
|
><Dialog.Header
|
|
186
|
-
><Dialog.Title>{active?.filename}</Dialog.Title
|
|
187
|
-
|
|
188
|
-
|
|
204
|
+
><Dialog.Title>{active?.filename}</Dialog.Title>{#if active}<Badge variant="outline"
|
|
205
|
+
>{isPublic(active.id) ? 'Public' : 'Private'}</Badge
|
|
206
|
+
>{/if}</Dialog.Header
|
|
189
207
|
>{#if active}{@const blueprint = data.fileBlueprints?.find((b) => b.id === active!.blueprint)}
|
|
190
208
|
<div class="cms-stack">
|
|
191
209
|
{#if !Object.values(blueprint?.fields ?? {}).some((field) => field.type === 'focus') && assetUrl(active, data.workerUrl!)}<img
|
|
@@ -193,13 +211,7 @@
|
|
|
193
211
|
src={assetUrl(active, data.workerUrl!)}
|
|
194
212
|
alt={String(active.metadata.alt ?? '')}
|
|
195
213
|
/>{/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
|
|
214
|
+
{#if blueprint}<Fields
|
|
203
215
|
imageUrl={active.variants.some(
|
|
204
216
|
(v) => v.preset === 'sandcms-preview' || v.format === 'svg'
|
|
205
217
|
)
|
|
@@ -227,14 +239,13 @@
|
|
|
227
239
|
onclick={() => action('media/retry', { id: active!.id })}>Retry processing</Button
|
|
228
240
|
>{/if}
|
|
229
241
|
{/if}
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
>{usage.
|
|
236
|
-
|
|
237
|
-
</div>
|
|
242
|
+
{#if usedIn.length}<p class="cms-usages">
|
|
243
|
+
Used in {#each usedIn as usage, i}{i ? ', ' : ''}<a
|
|
244
|
+
href={'/admin/content/' + usage.blueprint + '/' + usage.documentId}
|
|
245
|
+
>{usage.blueprint}</a
|
|
246
|
+
>
|
|
247
|
+
<span class="cms-muted">({usage.snapshots.join(', ')})</span>{/each}
|
|
248
|
+
</p>{/if}
|
|
238
249
|
{#if confirmDelete}<div class="cms-alert">
|
|
239
250
|
<p>
|
|
240
251
|
Delete this image? Its references will be cleared from drafts and published content.
|
|
@@ -221,11 +221,9 @@
|
|
|
221
221
|
: 'Choose an image'}
|
|
222
222
|
</Button>{/snippet}</Dialog.Trigger
|
|
223
223
|
><Dialog.Content portalProps={{ disabled: true }} class="cms-media-dialog"
|
|
224
|
-
><Dialog.Header
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
></Dialog.Header
|
|
228
|
-
><UploadQueue items={uploads} />
|
|
224
|
+
><Dialog.Header><Dialog.Title>Media library</Dialog.Title></Dialog.Header><UploadQueue
|
|
225
|
+
items={uploads}
|
|
226
|
+
/>
|
|
229
227
|
{#if failures.length}
|
|
230
228
|
<Button
|
|
231
229
|
variant="outline"
|
|
@@ -239,43 +237,60 @@
|
|
|
239
237
|
{error}
|
|
240
238
|
</p>{/if}
|
|
241
239
|
{#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
|
-
|
|
240
|
+
path={'media/list' +
|
|
241
|
+
(fileBlueprint
|
|
242
|
+
? '?' +
|
|
243
|
+
new URLSearchParams([
|
|
244
|
+
['blueprint', fileBlueprint.id],
|
|
245
|
+
...fileBlueprint.accept.map((mime): [string, string] => ['mime', mime])
|
|
246
|
+
]).toString()
|
|
247
|
+
: '')}
|
|
248
|
+
initial={all.filter(
|
|
249
|
+
(a) =>
|
|
250
|
+
!fileBlueprint ||
|
|
251
|
+
(a.blueprint === fileBlueprint.id && fileBlueprint.accept.includes(a.mime))
|
|
252
|
+
)}
|
|
253
|
+
label="Search media"
|
|
254
|
+
refreshKey={JSON.stringify(all)}
|
|
255
|
+
>
|
|
256
|
+
{#snippet children(matches)}
|
|
257
|
+
<div class="cms-picker-drop-area" bind:this={dropArea}>
|
|
258
|
+
<div class="cms-picker-grid">
|
|
259
|
+
<UploadButton tile {busy} {multiple} accept={accept.join(',')} onchange={upload} />
|
|
260
|
+
{#each matches.filter((a) => a.status !== 'deleting') as asset (asset.id)}
|
|
261
|
+
<AssetAttachment
|
|
262
|
+
{asset}
|
|
263
|
+
{workerUrl}
|
|
264
|
+
class="cms-picker-item"
|
|
265
|
+
selected={selected.some((a) => a.id === asset.id)}
|
|
266
|
+
onopen={() => {
|
|
267
|
+
if (!all.some((a) => a.id === asset.id)) {
|
|
268
|
+
extra = [...extra, asset];
|
|
269
|
+
onasset?.(asset);
|
|
270
|
+
}
|
|
271
|
+
select(asset.id);
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
{/each}
|
|
275
|
+
</div>
|
|
276
|
+
<div class="cms-picker-drop-overlay" data-active={dragging} aria-hidden={!dragging}>
|
|
277
|
+
<Upload size={32} />
|
|
278
|
+
<strong
|
|
279
|
+
>{busy
|
|
280
|
+
? 'Upload in progress'
|
|
281
|
+
: multiple
|
|
282
|
+
? 'Drop images here'
|
|
283
|
+
: 'Drop an image here'}</strong
|
|
284
|
+
>
|
|
285
|
+
<span
|
|
286
|
+
>{busy
|
|
287
|
+
? 'Wait for your current upload to finish.'
|
|
288
|
+
: 'Release to upload to your library'}</span
|
|
289
|
+
>
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
{/snippet}</SearchList
|
|
293
|
+
>{/if}
|
|
279
294
|
{#if multiple}<div class="flex justify-end">
|
|
280
295
|
<Button onclick={() => (open = false)}>Done</Button>
|
|
281
296
|
</div>{/if}</Dialog.Content
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { Button } from './components/ui/button/index.js';
|
|
7
7
|
import { Input } from './components/ui/input/index.js';
|
|
8
8
|
import { Label } from './components/ui/label/index.js';
|
|
9
|
+
import { Checkbox } from './components/ui/checkbox/index.js';
|
|
9
10
|
import * as Dialog from './components/ui/dialog/index.js';
|
|
10
11
|
import SelectField from './SelectField.svelte';
|
|
11
12
|
let { data }: { data: AdminData } = $props();
|
|
@@ -19,6 +20,8 @@
|
|
|
19
20
|
busy = $state(false),
|
|
20
21
|
error = $state(''),
|
|
21
22
|
removed = $state(false);
|
|
23
|
+
const toggle = (list: string[], item: string, on: boolean) =>
|
|
24
|
+
on ? [...new Set([...list, item])] : list.filter((value) => value !== item);
|
|
22
25
|
const available = $derived(notificationFields(data.blueprint?.fields ?? {}));
|
|
23
26
|
function show() {
|
|
24
27
|
const settings = data.notificationSettings;
|
|
@@ -73,12 +76,7 @@
|
|
|
73
76
|
<Button variant="outline" onclick={show}>Notifications</Button>
|
|
74
77
|
<Dialog.Root bind:open
|
|
75
78
|
><Dialog.Content portalProps={{ disabled: true }} class="max-h-[85vh] overflow-y-auto">
|
|
76
|
-
<Dialog.Header
|
|
77
|
-
><Dialog.Title>Email notifications</Dialog.Title><Dialog.Description
|
|
78
|
-
>Choose who receives new {data.blueprint?.label} submissions. Changes apply to future sends, including
|
|
79
|
-
manual resends.</Dialog.Description
|
|
80
|
-
></Dialog.Header
|
|
81
|
-
>
|
|
79
|
+
<Dialog.Header><Dialog.Title>Email notifications</Dialog.Title></Dialog.Header>
|
|
82
80
|
<form
|
|
83
81
|
class="cms-stack"
|
|
84
82
|
onsubmit={(e) => {
|
|
@@ -93,18 +91,26 @@
|
|
|
93
91
|
Email is not configured. Ask your operator to configure SMTP before enabling
|
|
94
92
|
notifications.
|
|
95
93
|
</p>{/if}
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
<div class="cms-checkbox">
|
|
95
|
+
<Checkbox
|
|
96
|
+
id="notifications-enabled"
|
|
99
97
|
bind:checked={enabled}
|
|
100
98
|
disabled={!data.emailEnabled && !enabled}
|
|
101
|
-
|
|
102
|
-
>
|
|
103
|
-
<fieldset class="cms-
|
|
104
|
-
<legend>CMS recipients</legend>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
/><Label for="notifications-enabled">Email notifications enabled</Label>
|
|
100
|
+
</div>
|
|
101
|
+
<fieldset class="cms-field">
|
|
102
|
+
<legend class="cms-legend">CMS recipients</legend>
|
|
103
|
+
<div class="cms-checkboxes">
|
|
104
|
+
{#each data.notificationUsers ?? [] as person}<div class="cms-checkbox">
|
|
105
|
+
<Checkbox
|
|
106
|
+
id={'notify-' + person.id}
|
|
107
|
+
checked={userIds.includes(person.id)}
|
|
108
|
+
onCheckedChange={(on) => (userIds = toggle(userIds, person.id, on))}
|
|
109
|
+
/><Label for={'notify-' + person.id}
|
|
110
|
+
>{person.name} <span class="cms-muted">{person.email}</span></Label
|
|
111
|
+
>
|
|
112
|
+
</div>{/each}
|
|
113
|
+
</div>
|
|
108
114
|
</fieldset>
|
|
109
115
|
<div class="cms-field">
|
|
110
116
|
<Label for="notification-addresses">Additional email addresses</Label><Input
|
|
@@ -112,7 +118,7 @@
|
|
|
112
118
|
bind:value={addresses}
|
|
113
119
|
placeholder="enquiries@example.com, team@example.com"
|
|
114
120
|
/>
|
|
115
|
-
<p class="cms-muted">
|
|
121
|
+
<p class="cms-muted">Comma-separated, up to 20 recipients in total.</p>
|
|
116
122
|
</div>
|
|
117
123
|
<div class="cms-field">
|
|
118
124
|
<Label for="notification-content">Email content</Label><SelectField
|
|
@@ -125,15 +131,18 @@
|
|
|
125
131
|
]}
|
|
126
132
|
/>
|
|
127
133
|
</div>
|
|
128
|
-
{#if content === 'fields'}<fieldset class="cms-
|
|
129
|
-
<legend>Included fields</legend>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
{#if content === 'fields'}<fieldset class="cms-field">
|
|
135
|
+
<legend class="cms-legend">Included fields</legend>
|
|
136
|
+
<div class="cms-checkboxes">
|
|
137
|
+
{#each available as field}<div class="cms-checkbox">
|
|
138
|
+
<Checkbox
|
|
139
|
+
id={'notify-field-' + field.value}
|
|
140
|
+
checked={fields.includes(field.value)}
|
|
141
|
+
onCheckedChange={(on) => (fields = toggle(fields, field.value, on))}
|
|
142
|
+
/><Label for={'notify-field-' + field.value}>{field.label}</Label>
|
|
143
|
+
</div>{/each}
|
|
144
|
+
</div>
|
|
145
|
+
<p class="cms-muted">Files, rich text, and repeated groups can’t be included.</p>
|
|
137
146
|
</fieldset>{/if}
|
|
138
147
|
<div class="cms-field">
|
|
139
148
|
<Label for="notification-reply">Reply-to field</Label><SelectField
|
|
@@ -144,7 +153,6 @@
|
|
|
144
153
|
.map((f) => ({ value: f.value, label: f.label }))}
|
|
145
154
|
placeholder="Use configured default"
|
|
146
155
|
/>
|
|
147
|
-
<p class="cms-muted">Used only when the submitted answer is a valid email address.</p>
|
|
148
156
|
</div>
|
|
149
157
|
{#if error}<p class="cms-error" role="alert">{error}</p>{/if}
|
|
150
158
|
<Button type="submit" disabled={busy}>{busy ? 'Saving…' : 'Save notifications'}</Button>
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
pressed={active.italic}
|
|
70
70
|
onPressedChange={() => editor?.chain().focus().toggleItalic().run()}><i>I</i></Toggle
|
|
71
71
|
>
|
|
72
|
-
<Separator orientation="vertical" class="
|
|
72
|
+
<Separator orientation="vertical" class="h-auto self-stretch" />
|
|
73
73
|
<Toggle
|
|
74
74
|
pressed={active.paragraph}
|
|
75
75
|
onPressedChange={() => editor?.chain().focus().setParagraph().run()}>Text</Toggle
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
pressed={active.h3}
|
|
85
85
|
onPressedChange={() => editor?.chain().focus().toggleHeading({ level: 3 }).run()}>H3</Toggle
|
|
86
86
|
>
|
|
87
|
-
<Separator orientation="vertical" class="
|
|
87
|
+
<Separator orientation="vertical" class="h-auto self-stretch" />
|
|
88
88
|
<RichTextLink {editor} />
|
|
89
89
|
<Toggle
|
|
90
90
|
pressed={active.bulletList}
|