@r2digisolutions/components 0.23.1 → 0.24.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/dist/components/atoms/BrandMark/BrandMark.svelte +47 -7
- package/dist/components/atoms/BrandMark/BrandMark.svelte.d.ts +4 -0
- package/dist/components/atoms/Slider/Slider.svelte +19 -15
- package/dist/components/atoms/Slider/Slider.svelte.d.ts +2 -0
- package/dist/components/molecules/AuthCard/AuthCard.svelte +19 -4
- package/dist/components/molecules/AuthCard/AuthCard.svelte.d.ts +4 -0
- package/dist/components/molecules/CanvasElementsPanel/CanvasElementsPanel.svelte +90 -26
- package/dist/components/molecules/CanvasInspector/CanvasInspector.svelte +176 -5
- package/dist/components/molecules/Combobox/Combobox.svelte +2 -2
- package/dist/components/molecules/DateTimePicker/DateTimePicker.svelte +121 -33
- package/dist/components/molecules/FormSection/FormSection.svelte +25 -28
- package/dist/components/molecules/ImageEditor/ImageEditor.svelte +183 -0
- package/dist/components/molecules/ImageEditor/ImageEditor.svelte.d.ts +19 -0
- package/dist/components/molecules/LocaleSwitcher/LocaleSwitcher.svelte +58 -35
- package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte +293 -39
- package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte.d.ts +6 -1
- package/dist/components/molecules/MediaStage/MediaStage.svelte +302 -245
- package/dist/components/molecules/MentionInput/MentionInput.svelte +332 -120
- package/dist/components/molecules/MentionInput/MentionInput.svelte.d.ts +13 -2
- package/dist/components/molecules/Select/Select.svelte +14 -1
- package/dist/components/molecules/Select/Select.svelte.d.ts +3 -0
- package/dist/components/molecules/UserMenu/UserMenu.svelte +30 -27
- package/dist/components/molecules/WidgetFrame/WidgetFrame.svelte +200 -17
- package/dist/components/molecules/WidgetFrame/WidgetFrame.svelte.d.ts +14 -0
- package/dist/components/organisms/AppShell/AppShell.svelte +7 -1
- package/dist/components/organisms/AppShell/AppShell.svelte.d.ts +2 -0
- package/dist/components/organisms/AuthShell/AuthShell.svelte +61 -29
- package/dist/components/organisms/AuthShell/AuthShell.svelte.d.ts +4 -0
- package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +156 -7
- package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte.d.ts +5 -0
- package/dist/components/organisms/Navbar/Navbar.svelte +2 -2
- package/dist/components/organisms/ProfileHeaderUploader/ProfileHeaderUploader.svelte +314 -141
- package/dist/components/organisms/ProfileHeaderUploader/ProfileHeaderUploader.svelte.d.ts +20 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/styles.css +17 -0
- package/dist/utils/canvasDocument.d.ts +56 -4
- package/dist/utils/canvasDocument.js +91 -2
- package/dist/utils/canvasExport.d.ts +1 -1
- package/dist/utils/canvasExport.js +15 -25
- package/package.json +1 -1
|
@@ -21,12 +21,29 @@
|
|
|
21
21
|
coverSrc?: string;
|
|
22
22
|
/** Existing remote avatar URL (shown when no local File is selected). */
|
|
23
23
|
avatarSrc?: string;
|
|
24
|
+
/** Events and banners only need the cover strip. */
|
|
25
|
+
showAvatar?: boolean;
|
|
26
|
+
/** `contain` shows the whole image inside the cover frame. */
|
|
27
|
+
coverFit?: 'cover' | 'contain';
|
|
28
|
+
emptyTitle?: string;
|
|
29
|
+
dropTitle?: string;
|
|
30
|
+
editLabel?: string;
|
|
31
|
+
changeLabel?: string;
|
|
32
|
+
frameLabel?: string;
|
|
33
|
+
removeLabel?: string;
|
|
34
|
+
/** Text links under the avatar once a local cover / avatar is selected. */
|
|
35
|
+
removeCoverLabel?: string;
|
|
36
|
+
removeAvatarLabel?: string;
|
|
37
|
+
avatarEmptyLabel?: string;
|
|
24
38
|
accept?: string;
|
|
25
39
|
maxCoverMb?: number;
|
|
26
40
|
maxAvatarMb?: number;
|
|
27
41
|
disabled?: boolean;
|
|
28
42
|
class?: string;
|
|
29
43
|
onchange?: (value: ProfileHeaderValue) => void;
|
|
44
|
+
/** Top-right actions once a cover exists. The cover itself still replaces the file. */
|
|
45
|
+
onframe?: () => void;
|
|
46
|
+
onedit?: () => void;
|
|
30
47
|
}
|
|
31
48
|
|
|
32
49
|
let {
|
|
@@ -36,12 +53,25 @@
|
|
|
36
53
|
avatarHelperText = 'Avatar · square image recommended',
|
|
37
54
|
coverSrc = '',
|
|
38
55
|
avatarSrc = '',
|
|
56
|
+
showAvatar = true,
|
|
57
|
+
coverFit = 'cover',
|
|
58
|
+
emptyTitle = 'Add cover photo',
|
|
59
|
+
dropTitle = 'Drop cover photo',
|
|
60
|
+
editLabel = 'Edit cover',
|
|
61
|
+
changeLabel = 'Change',
|
|
62
|
+
frameLabel = 'Adjust',
|
|
63
|
+
removeLabel = 'Remove',
|
|
64
|
+
removeCoverLabel = 'Remove cover',
|
|
65
|
+
removeAvatarLabel = 'Remove photo',
|
|
66
|
+
avatarEmptyLabel = 'Photo',
|
|
39
67
|
accept = 'image/*',
|
|
40
68
|
maxCoverMb = 10,
|
|
41
69
|
maxAvatarMb = 5,
|
|
42
70
|
disabled = false,
|
|
43
71
|
class: className = '',
|
|
44
|
-
onchange
|
|
72
|
+
onchange,
|
|
73
|
+
onframe,
|
|
74
|
+
onedit
|
|
45
75
|
}: ProfileHeaderUploaderProps = $props();
|
|
46
76
|
|
|
47
77
|
let cover = $state<ProfileMedia | null>(null);
|
|
@@ -90,6 +120,10 @@
|
|
|
90
120
|
return null;
|
|
91
121
|
}
|
|
92
122
|
|
|
123
|
+
export function replaceCover(file: File) {
|
|
124
|
+
setCover(file);
|
|
125
|
+
}
|
|
126
|
+
|
|
93
127
|
function setCover(file: File | null) {
|
|
94
128
|
if (file) {
|
|
95
129
|
const err = validateImage(file, maxCoverMb);
|
|
@@ -126,6 +160,15 @@
|
|
|
126
160
|
if (avatarInput) avatarInput.value = '';
|
|
127
161
|
}
|
|
128
162
|
|
|
163
|
+
function dragStillInside(event: DragEvent) {
|
|
164
|
+
const next = event.relatedTarget;
|
|
165
|
+
return (
|
|
166
|
+
next instanceof Node &&
|
|
167
|
+
event.currentTarget instanceof Node &&
|
|
168
|
+
event.currentTarget.contains(next)
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
129
172
|
function handleCoverDrop(e: DragEvent) {
|
|
130
173
|
e.preventDefault();
|
|
131
174
|
coverDragging = false;
|
|
@@ -148,7 +191,7 @@
|
|
|
148
191
|
});
|
|
149
192
|
</script>
|
|
150
193
|
|
|
151
|
-
<div class={['flex w-full flex-col
|
|
194
|
+
<div class={['gap-3 flex w-full flex-col', className]}>
|
|
152
195
|
{#if label}
|
|
153
196
|
<div id={labelId} class="text-sm font-medium text-primary">{label}</div>
|
|
154
197
|
{/if}
|
|
@@ -167,25 +210,30 @@
|
|
|
167
210
|
if (file) setCover(file);
|
|
168
211
|
}}
|
|
169
212
|
/>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
213
|
+
{#if showAvatar}
|
|
214
|
+
<input
|
|
215
|
+
bind:this={avatarInput}
|
|
216
|
+
id={avatarInputId}
|
|
217
|
+
type="file"
|
|
218
|
+
{accept}
|
|
219
|
+
{disabled}
|
|
220
|
+
class="sr-only"
|
|
221
|
+
tabindex={-1}
|
|
222
|
+
aria-hidden="true"
|
|
223
|
+
onchange={(e) => {
|
|
224
|
+
const file = (e.currentTarget as HTMLInputElement).files?.[0] ?? null;
|
|
225
|
+
if (file) setAvatar(file);
|
|
226
|
+
}}
|
|
227
|
+
/>
|
|
228
|
+
{/if}
|
|
184
229
|
|
|
185
230
|
<div
|
|
186
|
-
class="
|
|
231
|
+
class="rounded-xl border-border bg-surface-elevated shadow-sm relative border"
|
|
187
232
|
aria-labelledby={label ? labelId : undefined}
|
|
188
|
-
aria-describedby={[
|
|
233
|
+
aria-describedby={[
|
|
234
|
+
coverHelperText || avatarHelperText ? helperId : '',
|
|
235
|
+
errorMessage ? errorId : ''
|
|
236
|
+
]
|
|
189
237
|
.filter(Boolean)
|
|
190
238
|
.join(' ') || undefined}
|
|
191
239
|
>
|
|
@@ -205,7 +253,10 @@
|
|
|
205
253
|
if (!disabled) coverDragging = true;
|
|
206
254
|
}}
|
|
207
255
|
ondragover={(e) => e.preventDefault()}
|
|
208
|
-
ondragleave={() =>
|
|
256
|
+
ondragleave={(e) => {
|
|
257
|
+
if (dragStillInside(e)) return;
|
|
258
|
+
coverDragging = false;
|
|
259
|
+
}}
|
|
209
260
|
ondrop={handleCoverDrop}
|
|
210
261
|
onkeydown={(e) => {
|
|
211
262
|
if (disabled) return;
|
|
@@ -216,44 +267,149 @@
|
|
|
216
267
|
}}
|
|
217
268
|
onclick={() => !disabled && coverInput?.click()}
|
|
218
269
|
class={[
|
|
219
|
-
'group relative aspect-3/1
|
|
220
|
-
'
|
|
270
|
+
'group min-h-36 relative aspect-3/1 w-full overflow-hidden transition-colors outline-none',
|
|
271
|
+
showAvatar ? 'rounded-t-xl' : 'rounded-xl',
|
|
272
|
+
'focus-visible:ring-brand-500/40 focus-visible:ring-2 focus-visible:ring-inset',
|
|
221
273
|
coverDragging ? 'bg-brand-500/10' : 'bg-surface-overlay',
|
|
222
274
|
disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'
|
|
223
275
|
]}
|
|
224
276
|
>
|
|
225
277
|
{#if hasCoverMedia}
|
|
226
|
-
<img
|
|
227
|
-
|
|
278
|
+
<img
|
|
279
|
+
src={coverDisplayUrl}
|
|
280
|
+
alt=""
|
|
281
|
+
class={['h-full w-full', coverFit === 'contain' ? 'object-contain' : 'object-cover']}
|
|
282
|
+
/>
|
|
283
|
+
{#if !disabled && onedit}
|
|
228
284
|
<div
|
|
229
|
-
class="
|
|
285
|
+
class="inset-0 from-black/35 p-3 pointer-events-none absolute flex items-start justify-end bg-linear-to-b via-transparent to-transparent"
|
|
286
|
+
>
|
|
287
|
+
<div class="gap-1.5 pointer-events-auto flex flex-wrap items-center justify-end">
|
|
288
|
+
{#if onframe}
|
|
289
|
+
<button
|
|
290
|
+
type="button"
|
|
291
|
+
class="gap-1.5 rounded-lg bg-white/95 px-2 py-1.5 text-xs font-medium text-primary shadow-sm backdrop-blur dark:bg-neutral-900/95 inline-flex items-center"
|
|
292
|
+
onclick={(event) => {
|
|
293
|
+
event.stopPropagation();
|
|
294
|
+
onframe?.();
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
<svg
|
|
298
|
+
class="h-3.5 w-3.5"
|
|
299
|
+
viewBox="0 0 24 24"
|
|
300
|
+
fill="none"
|
|
301
|
+
stroke="currentColor"
|
|
302
|
+
stroke-width="2"
|
|
303
|
+
aria-hidden="true"
|
|
304
|
+
>
|
|
305
|
+
<path
|
|
306
|
+
d="M6 3v4M18 3v4M6 17v4M18 17v4M3 6h4M3 18h4M17 6h4M17 18h4"
|
|
307
|
+
stroke-linecap="round"
|
|
308
|
+
/>
|
|
309
|
+
</svg>
|
|
310
|
+
{frameLabel}
|
|
311
|
+
</button>
|
|
312
|
+
{/if}
|
|
313
|
+
<button
|
|
314
|
+
type="button"
|
|
315
|
+
class="gap-1.5 rounded-lg bg-white/95 px-2 py-1.5 text-xs font-medium text-primary shadow-sm backdrop-blur dark:bg-neutral-900/95 inline-flex items-center"
|
|
316
|
+
onclick={(event) => {
|
|
317
|
+
event.stopPropagation();
|
|
318
|
+
onedit();
|
|
319
|
+
}}
|
|
320
|
+
>
|
|
321
|
+
<svg
|
|
322
|
+
class="h-3.5 w-3.5"
|
|
323
|
+
viewBox="0 0 24 24"
|
|
324
|
+
fill="none"
|
|
325
|
+
stroke="currentColor"
|
|
326
|
+
stroke-width="2"
|
|
327
|
+
aria-hidden="true"
|
|
328
|
+
>
|
|
329
|
+
<path d="M12 20h9" stroke-linecap="round" />
|
|
330
|
+
<path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L8 18l-4 1 1-4Z" stroke-linejoin="round" />
|
|
331
|
+
</svg>
|
|
332
|
+
{editLabel}
|
|
333
|
+
</button>
|
|
334
|
+
<button
|
|
335
|
+
type="button"
|
|
336
|
+
class="gap-1.5 rounded-lg bg-white/95 px-2 py-1.5 text-xs font-medium text-primary shadow-sm backdrop-blur dark:bg-neutral-900/95 inline-flex items-center"
|
|
337
|
+
onclick={(event) => {
|
|
338
|
+
event.stopPropagation();
|
|
339
|
+
coverInput?.click();
|
|
340
|
+
}}
|
|
341
|
+
>
|
|
342
|
+
<svg
|
|
343
|
+
class="h-3.5 w-3.5"
|
|
344
|
+
viewBox="0 0 24 24"
|
|
345
|
+
fill="none"
|
|
346
|
+
stroke="currentColor"
|
|
347
|
+
stroke-width="2"
|
|
348
|
+
aria-hidden="true"
|
|
349
|
+
>
|
|
350
|
+
<rect x="3" y="5" width="18" height="14" rx="2" />
|
|
351
|
+
<circle cx="9" cy="10" r="1.5" />
|
|
352
|
+
<path d="m21 16-5-5-8 8" stroke-linejoin="round" />
|
|
353
|
+
</svg>
|
|
354
|
+
{changeLabel}
|
|
355
|
+
</button>
|
|
356
|
+
<button
|
|
357
|
+
type="button"
|
|
358
|
+
class="gap-1.5 rounded-lg bg-white/95 px-2 py-1.5 text-xs font-medium text-red-600 shadow-sm backdrop-blur dark:bg-neutral-900/95 inline-flex items-center"
|
|
359
|
+
onclick={(event) => {
|
|
360
|
+
event.stopPropagation();
|
|
361
|
+
setCover(null);
|
|
362
|
+
}}
|
|
363
|
+
>
|
|
364
|
+
<svg
|
|
365
|
+
class="h-3.5 w-3.5"
|
|
366
|
+
viewBox="0 0 24 24"
|
|
367
|
+
fill="none"
|
|
368
|
+
stroke="currentColor"
|
|
369
|
+
stroke-width="2"
|
|
370
|
+
aria-hidden="true"
|
|
371
|
+
>
|
|
372
|
+
<path
|
|
373
|
+
d="M4 7h16M9 7V5h6v2M8 7l1 13h6l1-13"
|
|
374
|
+
stroke-linecap="round"
|
|
375
|
+
stroke-linejoin="round"
|
|
376
|
+
/>
|
|
377
|
+
</svg>
|
|
378
|
+
{removeLabel}
|
|
379
|
+
</button>
|
|
380
|
+
</div>
|
|
381
|
+
</div>
|
|
382
|
+
{:else if !disabled}
|
|
383
|
+
<div
|
|
384
|
+
class="inset-0 from-black/35 p-3 absolute flex items-start justify-end bg-linear-to-b via-transparent to-transparent opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
|
|
230
385
|
>
|
|
231
386
|
<span
|
|
232
|
-
class="
|
|
387
|
+
class="gap-1.5 rounded-lg bg-white/95 px-2.5 py-1.5 text-xs font-medium text-primary shadow-sm backdrop-blur dark:bg-neutral-900/95 inline-flex items-center"
|
|
233
388
|
>
|
|
234
|
-
|
|
235
|
-
<path
|
|
236
|
-
stroke-linecap="round"
|
|
237
|
-
stroke-linejoin="round"
|
|
238
|
-
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931z"
|
|
239
|
-
/>
|
|
240
|
-
</svg>
|
|
241
|
-
Edit cover
|
|
389
|
+
{editLabel}
|
|
242
390
|
</span>
|
|
243
391
|
</div>
|
|
244
392
|
{/if}
|
|
245
393
|
{:else}
|
|
246
|
-
<div
|
|
394
|
+
<div
|
|
395
|
+
class="inset-0 gap-2 px-4 absolute flex flex-col items-center justify-center text-center"
|
|
396
|
+
>
|
|
247
397
|
<div
|
|
248
398
|
class={[
|
|
249
|
-
'
|
|
399
|
+
'h-10 w-10 rounded-lg flex items-center justify-center',
|
|
250
400
|
coverDragging
|
|
251
401
|
? 'bg-brand-600 text-white'
|
|
252
402
|
: 'bg-brand-100 text-brand-700 dark:bg-brand-500/15 dark:text-brand-300'
|
|
253
403
|
]}
|
|
254
404
|
aria-hidden="true"
|
|
255
405
|
>
|
|
256
|
-
<svg
|
|
406
|
+
<svg
|
|
407
|
+
class="h-5 w-5"
|
|
408
|
+
fill="none"
|
|
409
|
+
viewBox="0 0 24 24"
|
|
410
|
+
stroke="currentColor"
|
|
411
|
+
stroke-width="1.75"
|
|
412
|
+
>
|
|
257
413
|
<path
|
|
258
414
|
stroke-linecap="round"
|
|
259
415
|
stroke-linejoin="round"
|
|
@@ -262,7 +418,7 @@
|
|
|
262
418
|
</svg>
|
|
263
419
|
</div>
|
|
264
420
|
<p class="text-sm font-medium text-primary">
|
|
265
|
-
{coverDragging ?
|
|
421
|
+
{coverDragging ? dropTitle : emptyTitle}
|
|
266
422
|
</p>
|
|
267
423
|
<p class="text-xs text-secondary">{coverHelperText}</p>
|
|
268
424
|
</div>
|
|
@@ -270,124 +426,141 @@
|
|
|
270
426
|
|
|
271
427
|
{#if coverDragging}
|
|
272
428
|
<div
|
|
273
|
-
class="pointer-events-none absolute
|
|
429
|
+
class="inset-0 ring-brand-500/50 pointer-events-none absolute ring-2 ring-inset"
|
|
274
430
|
aria-hidden="true"
|
|
275
431
|
></div>
|
|
276
432
|
{/if}
|
|
277
433
|
</div>
|
|
278
434
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
<div class="-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
?
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
e
|
|
294
|
-
e.stopPropagation();
|
|
295
|
-
if (!disabled) avatarDragging = true;
|
|
296
|
-
}}
|
|
297
|
-
ondragover={(e) => {
|
|
298
|
-
e.preventDefault();
|
|
299
|
-
e.stopPropagation();
|
|
300
|
-
}}
|
|
301
|
-
ondragleave={(e) => {
|
|
302
|
-
e.stopPropagation();
|
|
303
|
-
avatarDragging = false;
|
|
304
|
-
}}
|
|
305
|
-
ondrop={(e) => {
|
|
306
|
-
e.stopPropagation();
|
|
307
|
-
handleAvatarDrop(e);
|
|
308
|
-
}}
|
|
309
|
-
onkeydown={(e) => {
|
|
310
|
-
if (disabled) return;
|
|
311
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
435
|
+
{#if showAvatar}
|
|
436
|
+
<!-- Avatar overlapping cover -->
|
|
437
|
+
<div class="px-4 pb-4 pt-0 relative">
|
|
438
|
+
<div class="-mt-10 gap-4 sm:-mt-12 flex items-end">
|
|
439
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
440
|
+
<div
|
|
441
|
+
role="button"
|
|
442
|
+
tabindex={disabled ? -1 : 0}
|
|
443
|
+
aria-label={hasAvatarMedia
|
|
444
|
+
? avatar
|
|
445
|
+
? `Change profile photo, ${avatar.name}`
|
|
446
|
+
: 'Change profile photo'
|
|
447
|
+
: 'Upload profile photo'}
|
|
448
|
+
aria-disabled={disabled || undefined}
|
|
449
|
+
ondragenter={(e) => {
|
|
312
450
|
e.preventDefault();
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
{
|
|
451
|
+
e.stopPropagation();
|
|
452
|
+
if (!disabled) avatarDragging = true;
|
|
453
|
+
}}
|
|
454
|
+
ondragover={(e) => {
|
|
455
|
+
e.preventDefault();
|
|
456
|
+
e.stopPropagation();
|
|
457
|
+
}}
|
|
458
|
+
ondragleave={(e) => {
|
|
459
|
+
e.stopPropagation();
|
|
460
|
+
if (dragStillInside(e)) return;
|
|
461
|
+
avatarDragging = false;
|
|
462
|
+
}}
|
|
463
|
+
ondrop={(e) => {
|
|
464
|
+
e.stopPropagation();
|
|
465
|
+
handleAvatarDrop(e);
|
|
466
|
+
}}
|
|
467
|
+
onkeydown={(e) => {
|
|
468
|
+
if (disabled) return;
|
|
469
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
470
|
+
e.preventDefault();
|
|
471
|
+
avatarInput?.click();
|
|
472
|
+
}
|
|
473
|
+
}}
|
|
474
|
+
onclick={(e) => {
|
|
475
|
+
e.stopPropagation();
|
|
476
|
+
if (!disabled) avatarInput?.click();
|
|
477
|
+
}}
|
|
478
|
+
class={[
|
|
479
|
+
'group h-20 w-20 border-surface-elevated bg-surface-overlay shadow-md sm:h-24 sm:w-24 relative z-10 shrink-0 overflow-hidden rounded-full border-4 transition outline-none',
|
|
480
|
+
'focus-visible:ring-brand-500/40 focus-visible:ring-offset-surface-elevated focus-visible:ring-2 focus-visible:ring-offset-2',
|
|
481
|
+
avatarDragging ? 'ring-brand-500 ring-2' : '',
|
|
482
|
+
disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'
|
|
483
|
+
]}
|
|
484
|
+
>
|
|
485
|
+
{#if hasAvatarMedia}
|
|
486
|
+
<img src={avatarDisplayUrl} alt="" class="h-full w-full object-cover" />
|
|
487
|
+
{#if !disabled}
|
|
488
|
+
<div
|
|
489
|
+
class="inset-0 bg-black/45 absolute flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
|
|
490
|
+
>
|
|
491
|
+
<span
|
|
492
|
+
class="h-8 w-8 bg-white text-primary shadow-sm inline-flex items-center justify-center rounded-full"
|
|
493
|
+
aria-hidden="true"
|
|
494
|
+
>
|
|
495
|
+
<svg
|
|
496
|
+
class="h-4 w-4"
|
|
497
|
+
fill="none"
|
|
498
|
+
viewBox="0 0 24 24"
|
|
499
|
+
stroke="currentColor"
|
|
500
|
+
stroke-width="2"
|
|
501
|
+
>
|
|
502
|
+
<path
|
|
503
|
+
stroke-linecap="round"
|
|
504
|
+
stroke-linejoin="round"
|
|
505
|
+
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931z"
|
|
506
|
+
/>
|
|
507
|
+
</svg>
|
|
508
|
+
</span>
|
|
509
|
+
</div>
|
|
510
|
+
{/if}
|
|
511
|
+
{:else}
|
|
330
512
|
<div
|
|
331
|
-
class="
|
|
513
|
+
class="gap-0.5 text-secondary flex h-full w-full flex-col items-center justify-center"
|
|
332
514
|
>
|
|
333
|
-
<
|
|
334
|
-
class="
|
|
335
|
-
|
|
515
|
+
<svg
|
|
516
|
+
class="h-6 w-6"
|
|
517
|
+
fill="none"
|
|
518
|
+
viewBox="0 0 24 24"
|
|
519
|
+
stroke="currentColor"
|
|
520
|
+
stroke-width="1.75"
|
|
336
521
|
>
|
|
337
|
-
<
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
</span>
|
|
522
|
+
<path
|
|
523
|
+
stroke-linecap="round"
|
|
524
|
+
stroke-linejoin="round"
|
|
525
|
+
d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0"
|
|
526
|
+
/>
|
|
527
|
+
</svg>
|
|
528
|
+
<span class="font-medium text-[10px]">{avatarEmptyLabel}</span>
|
|
345
529
|
</div>
|
|
346
530
|
{/if}
|
|
347
|
-
|
|
348
|
-
<div class="flex h-full w-full flex-col items-center justify-center gap-0.5 text-secondary">
|
|
349
|
-
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.75">
|
|
350
|
-
<path
|
|
351
|
-
stroke-linecap="round"
|
|
352
|
-
stroke-linejoin="round"
|
|
353
|
-
d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0"
|
|
354
|
-
/>
|
|
355
|
-
</svg>
|
|
356
|
-
<span class="text-[10px] font-medium">Photo</span>
|
|
357
|
-
</div>
|
|
358
|
-
{/if}
|
|
359
|
-
</div>
|
|
531
|
+
</div>
|
|
360
532
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
533
|
+
<div class="min-w-0 pb-1 flex-1">
|
|
534
|
+
{#if hasLocalMedia}
|
|
535
|
+
<div class="gap-2 flex flex-wrap items-center">
|
|
536
|
+
{#if cover && !disabled}
|
|
537
|
+
<button
|
|
538
|
+
type="button"
|
|
539
|
+
onclick={() => setCover(null)}
|
|
540
|
+
class="rounded-lg px-2 py-1 text-xs font-medium text-secondary hover:bg-surface-overlay hover:text-primary transition"
|
|
541
|
+
>
|
|
542
|
+
{removeCoverLabel}
|
|
543
|
+
</button>
|
|
544
|
+
{/if}
|
|
545
|
+
{#if avatar && !disabled}
|
|
546
|
+
<button
|
|
547
|
+
type="button"
|
|
548
|
+
onclick={() => setAvatar(null)}
|
|
549
|
+
class="rounded-lg px-2 py-1 text-xs font-medium text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40 transition"
|
|
550
|
+
>
|
|
551
|
+
{removeAvatarLabel}
|
|
552
|
+
</button>
|
|
553
|
+
{/if}
|
|
554
|
+
</div>
|
|
555
|
+
{:else}
|
|
556
|
+
<p id={helperId} class="text-xs text-secondary leading-relaxed">
|
|
557
|
+
{avatarHelperText}
|
|
558
|
+
</p>
|
|
559
|
+
{/if}
|
|
560
|
+
</div>
|
|
388
561
|
</div>
|
|
389
562
|
</div>
|
|
390
|
-
|
|
563
|
+
{/if}
|
|
391
564
|
</div>
|
|
392
565
|
|
|
393
566
|
{#if errorMessage}
|
|
@@ -11,13 +11,32 @@ interface ProfileHeaderUploaderProps {
|
|
|
11
11
|
coverSrc?: string;
|
|
12
12
|
/** Existing remote avatar URL (shown when no local File is selected). */
|
|
13
13
|
avatarSrc?: string;
|
|
14
|
+
/** Events and banners only need the cover strip. */
|
|
15
|
+
showAvatar?: boolean;
|
|
16
|
+
/** `contain` shows the whole image inside the cover frame. */
|
|
17
|
+
coverFit?: 'cover' | 'contain';
|
|
18
|
+
emptyTitle?: string;
|
|
19
|
+
dropTitle?: string;
|
|
20
|
+
editLabel?: string;
|
|
21
|
+
changeLabel?: string;
|
|
22
|
+
frameLabel?: string;
|
|
23
|
+
removeLabel?: string;
|
|
24
|
+
/** Text links under the avatar once a local cover / avatar is selected. */
|
|
25
|
+
removeCoverLabel?: string;
|
|
26
|
+
removeAvatarLabel?: string;
|
|
27
|
+
avatarEmptyLabel?: string;
|
|
14
28
|
accept?: string;
|
|
15
29
|
maxCoverMb?: number;
|
|
16
30
|
maxAvatarMb?: number;
|
|
17
31
|
disabled?: boolean;
|
|
18
32
|
class?: string;
|
|
19
33
|
onchange?: (value: ProfileHeaderValue) => void;
|
|
34
|
+
/** Top-right actions once a cover exists. The cover itself still replaces the file. */
|
|
35
|
+
onframe?: () => void;
|
|
36
|
+
onedit?: () => void;
|
|
20
37
|
}
|
|
21
|
-
declare const ProfileHeaderUploader: import("svelte").Component<ProfileHeaderUploaderProps, {
|
|
38
|
+
declare const ProfileHeaderUploader: import("svelte").Component<ProfileHeaderUploaderProps, {
|
|
39
|
+
replaceCover: (file: File) => void;
|
|
40
|
+
}, "">;
|
|
22
41
|
type ProfileHeaderUploader = ReturnType<typeof ProfileHeaderUploader>;
|
|
23
42
|
export default ProfileHeaderUploader;
|
package/dist/index.d.ts
CHANGED
|
@@ -348,6 +348,8 @@ export { default as DiffViewer } from './components/molecules/DiffViewer/DiffVie
|
|
|
348
348
|
export type { DiffMode } from './components/molecules/DiffViewer/DiffViewer.svelte';
|
|
349
349
|
export { default as SignaturePad } from './components/molecules/SignaturePad/SignaturePad.svelte';
|
|
350
350
|
export { default as ImageCropper } from './components/molecules/ImageCropper/ImageCropper.svelte';
|
|
351
|
+
export { default as ImageEditor } from './components/molecules/ImageEditor/ImageEditor.svelte';
|
|
352
|
+
export type { ImageEditorFormat } from './components/molecules/ImageEditor/ImageEditor.svelte';
|
|
351
353
|
export type { CropAspect, CropFormat } from './components/molecules/ImageCropper/ImageCropper.svelte';
|
|
352
354
|
export { default as AudioPlayer } from './components/molecules/AudioPlayer/AudioPlayer.svelte';
|
|
353
355
|
export { default as VideoPlayer } from './components/molecules/VideoPlayer/VideoPlayer.svelte';
|
|
@@ -871,7 +873,7 @@ export { msToPx, pxToMs, pxPerMsFromZoom, snapMs, clampMs, formatTimecode, ticks
|
|
|
871
873
|
export type { TimeTick, TimeTickLevel } from './utils/mediaTime.js';
|
|
872
874
|
export type { MediaAsset, MediaAssetKind, MediaClip, MediaClipAlign, MediaClipRect, MediaClipResettableField, MediaClipRectAxis, MediaTransitionPlayback, MediaTrack, MediaTrackKind } from './utils/mediaTracks.js';
|
|
873
875
|
export { uid, createMediaClip, createMediaTrack, createMediaAsset, clipDurationMs, moveClip, trimClipStart, trimClipEnd, isClipActiveAt, findClipAt, updateClipInTracks, removeClipFromTracks, removeClipsFromTracks, splitClipAt, splitClipsAt, duplicateClipInTracks, mergeClipsInTracks, canMergeMediaClips, moveClipsByDelta, findClipById, nextTrackName, reorderTracks, moveTrack, removeTrack, removeTracks, defaultOverlayRect, defaultMediaClipRect, resolveClipRect, alignClipRect, alignMediaRect, clipHasSpatialRect, isMediaClipFieldModified, resetMediaClipField, findTransitionAt, transitionLayerStyle, transitionDipOverlay, resolvePreviewOpacity, resolveClipOpacity, MEDIA_CLIP_DEFAULTS, kindFromFile, probeMediaSrc } from './utils/mediaTracks.js';
|
|
874
|
-
export { emptyCanvasDocument, createCanvasLayer, createCanvasGuide, createPathFromDocPoints, rebakePathLayer, pathPointsToDoc, reorderCanvasLayers, updateCanvasLayer, updateCanvasLayers, alignLayerRect, snapLayerRect, snapRectToGuides, migrateCanvasDocument, defaultSlotFromRect, rectFromSlot, ensureLayerSlot, canvasLayerFieldDefault, isCanvasFieldModified, resetCanvasField, applyTextAutoSize, CANVAS_PRESETS, presetIdForSize } from './utils/canvasDocument.js';
|
|
876
|
+
export { emptyCanvasDocument, createCanvasLayer, createCanvasGuide, createPathFromDocPoints, rebakePathLayer, pathPointsToDoc, reorderCanvasLayers, updateCanvasLayer, updateCanvasLayers, alignLayerRect, snapLayerRect, snapRectToGuides, migrateCanvasDocument, defaultSlotFromRect, rectFromSlot, ensureLayerSlot, canvasLayerFieldDefault, isCanvasFieldModified, resetCanvasField, applyTextAutoSize, CANVAS_PRESETS, COVER_ARTBOARD, coverDocumentFromImage, persistCoverDocument, hydrateCoverDocument, canvasLayerFilter, mediaContentBox, presetIdForSize } from './utils/canvasDocument.js';
|
|
875
877
|
export type { CanvasDocument, CanvasLayer, CanvasLayerKind, CanvasLayerRect, CanvasPoint, CanvasObjectFit, CanvasTextAlign, CanvasResettableField, CanvasAlign, CanvasFontStyle, CanvasTextDecoration, CanvasGuide, CanvasGuideOrientation, CanvasAnchors, CanvasSlot, CanvasExposedProp, CanvasWidgetDefinition } from './utils/canvasDocument.js';
|
|
876
878
|
export { isContainerKind, canHaveChildren, getChildren, getDescendantIds, getSubtreeIds, getAncestors, enclosingGroupId, isEffectivelyVisible, isEffectivelyLocked, isLayoutPositionLocked, isLayoutSizeLocked, selectionAncestorIds, LAYOUT_POSITION_KINDS, LAYOUT_SIZE_KINDS, paintTransformForLayer, isDescendant, canReparent, ANCHOR_PRESETS, resolveSlotRect, slotFromLocalRect, translateSlot, stepAxis, computeAbsoluteRects, absoluteRectFor, reparentLayer, wrapSelection, groupLayers, ungroupLayers, layerFromAbsoluteRect, fitGroupsToChildren, scaleSubtreeAbsolute, scaleSelectionAbsolute, shouldAutoSizeChildren, topLevelSelectedIds, translateSelectionAbsolute, unionAbsRect, clampDeltaToKeepUnion, selectedAncestorId, deleteSubtree, duplicateSubtree, reorderSiblings, clipPathForLayer, scrollBoxOverflow, scrollBarMetrics, applyScrollBoxOffsets } from './utils/canvasHierarchy.js';
|
|
877
879
|
export { createWidgetDefinition, createWidgetFromSelection, placeWidgetInstance, resolveWidgetInstance, flattenLayersWithWidgets, breakWidgetInstance, updateWidgetDefinition, deleteWidgetDefinition, renameWidgetDefinition, duplicateWidgetDefinition, syncInstanceSizesToDefinition, setExposedProp, isPropExposed, getExposedProp, getExposedFieldDefault, resolveExposedPropValue, groupExposedPropsByLayer, setInstanceOverride, getNamedSlotsFromDefinition, listFillableSlotsForInstance } from './utils/canvasWidget.js';
|
package/dist/index.js
CHANGED
|
@@ -260,6 +260,7 @@ export { default as JSONViewer } from './components/molecules/JSONViewer/JSONVie
|
|
|
260
260
|
export { default as DiffViewer } from './components/molecules/DiffViewer/DiffViewer.svelte';
|
|
261
261
|
export { default as SignaturePad } from './components/molecules/SignaturePad/SignaturePad.svelte';
|
|
262
262
|
export { default as ImageCropper } from './components/molecules/ImageCropper/ImageCropper.svelte';
|
|
263
|
+
export { default as ImageEditor } from './components/molecules/ImageEditor/ImageEditor.svelte';
|
|
263
264
|
export { default as AudioPlayer } from './components/molecules/AudioPlayer/AudioPlayer.svelte';
|
|
264
265
|
export { default as VideoPlayer } from './components/molecules/VideoPlayer/VideoPlayer.svelte';
|
|
265
266
|
export { default as VolumeControl } from './components/molecules/VolumeControl/VolumeControl.svelte';
|
|
@@ -591,7 +592,7 @@ export { queryStringToGroup, groupToQueryString, groupToFilterItems, removeRuleF
|
|
|
591
592
|
export { emptyBlogDocument, createBlock, createComponentBlock, serializeBlogDocument, parseBlogDocument, registerBlogComponent, unregisterBlogComponent, getBlogComponent, listBlogComponents, clearBlogComponentRegistry, NATIVE_BLOCK_TYPES, defaultDataForType, blogWidthClass, blogAlignClass, blogAspectPadding } from './utils/blogDocument.js';
|
|
592
593
|
export { msToPx, pxToMs, pxPerMsFromZoom, snapMs, clampMs, formatTimecode, ticksForDuration, snapStepForZoom } from './utils/mediaTime.js';
|
|
593
594
|
export { uid, createMediaClip, createMediaTrack, createMediaAsset, clipDurationMs, moveClip, trimClipStart, trimClipEnd, isClipActiveAt, findClipAt, updateClipInTracks, removeClipFromTracks, removeClipsFromTracks, splitClipAt, splitClipsAt, duplicateClipInTracks, mergeClipsInTracks, canMergeMediaClips, moveClipsByDelta, findClipById, nextTrackName, reorderTracks, moveTrack, removeTrack, removeTracks, defaultOverlayRect, defaultMediaClipRect, resolveClipRect, alignClipRect, alignMediaRect, clipHasSpatialRect, isMediaClipFieldModified, resetMediaClipField, findTransitionAt, transitionLayerStyle, transitionDipOverlay, resolvePreviewOpacity, resolveClipOpacity, MEDIA_CLIP_DEFAULTS, kindFromFile, probeMediaSrc } from './utils/mediaTracks.js';
|
|
594
|
-
export { emptyCanvasDocument, createCanvasLayer, createCanvasGuide, createPathFromDocPoints, rebakePathLayer, pathPointsToDoc, reorderCanvasLayers, updateCanvasLayer, updateCanvasLayers, alignLayerRect, snapLayerRect, snapRectToGuides, migrateCanvasDocument, defaultSlotFromRect, rectFromSlot, ensureLayerSlot, canvasLayerFieldDefault, isCanvasFieldModified, resetCanvasField, applyTextAutoSize, CANVAS_PRESETS, presetIdForSize } from './utils/canvasDocument.js';
|
|
595
|
+
export { emptyCanvasDocument, createCanvasLayer, createCanvasGuide, createPathFromDocPoints, rebakePathLayer, pathPointsToDoc, reorderCanvasLayers, updateCanvasLayer, updateCanvasLayers, alignLayerRect, snapLayerRect, snapRectToGuides, migrateCanvasDocument, defaultSlotFromRect, rectFromSlot, ensureLayerSlot, canvasLayerFieldDefault, isCanvasFieldModified, resetCanvasField, applyTextAutoSize, CANVAS_PRESETS, COVER_ARTBOARD, coverDocumentFromImage, persistCoverDocument, hydrateCoverDocument, canvasLayerFilter, mediaContentBox, presetIdForSize } from './utils/canvasDocument.js';
|
|
595
596
|
export { isContainerKind, canHaveChildren, getChildren, getDescendantIds, getSubtreeIds, getAncestors, enclosingGroupId, isEffectivelyVisible, isEffectivelyLocked, isLayoutPositionLocked, isLayoutSizeLocked, selectionAncestorIds, LAYOUT_POSITION_KINDS, LAYOUT_SIZE_KINDS, paintTransformForLayer, isDescendant, canReparent, ANCHOR_PRESETS, resolveSlotRect, slotFromLocalRect, translateSlot, stepAxis, computeAbsoluteRects, absoluteRectFor, reparentLayer, wrapSelection, groupLayers, ungroupLayers, layerFromAbsoluteRect, fitGroupsToChildren, scaleSubtreeAbsolute, scaleSelectionAbsolute, shouldAutoSizeChildren, topLevelSelectedIds, translateSelectionAbsolute, unionAbsRect, clampDeltaToKeepUnion, selectedAncestorId, deleteSubtree, duplicateSubtree, reorderSiblings, clipPathForLayer, scrollBoxOverflow, scrollBarMetrics, applyScrollBoxOffsets } from './utils/canvasHierarchy.js';
|
|
596
597
|
export { createWidgetDefinition, createWidgetFromSelection, placeWidgetInstance, resolveWidgetInstance, flattenLayersWithWidgets, breakWidgetInstance, updateWidgetDefinition, deleteWidgetDefinition, renameWidgetDefinition, duplicateWidgetDefinition, syncInstanceSizesToDefinition, setExposedProp, isPropExposed, getExposedProp, getExposedFieldDefault, resolveExposedPropValue, groupExposedPropsByLayer, setInstanceOverride, getNamedSlotsFromDefinition, listFillableSlotsForInstance } from './utils/canvasWidget.js';
|
|
597
598
|
export { createCanvasHistory, pushCanvasHistory, undoCanvasHistory, redoCanvasHistory, serializeCanvasDoc, parseCanvasDoc } from './utils/canvasHistory.js';
|