@r2digisolutions/components 0.23.1 → 0.24.1
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/atoms/VerifiedBadge/VerifiedBadge.svelte +76 -0
- package/dist/components/atoms/VerifiedBadge/VerifiedBadge.svelte.d.ts +12 -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 +343 -140
- package/dist/components/organisms/ProfileHeaderUploader/ProfileHeaderUploader.svelte.d.ts +25 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -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
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
brand?: string;
|
|
10
10
|
/** Official brand logo URL (SVG/PNG) for BrandMark */
|
|
11
11
|
logoSrc?: string;
|
|
12
|
+
/** Single-color logo, painted with currentColor */
|
|
13
|
+
monochrome?: boolean;
|
|
14
|
+
/** Brand / logo link target (e.g. `/`) */
|
|
15
|
+
brandHref?: string;
|
|
12
16
|
tagline?: string;
|
|
13
17
|
footer?: string;
|
|
14
18
|
headline?: string;
|
|
@@ -29,6 +33,8 @@
|
|
|
29
33
|
const {
|
|
30
34
|
brand = 'R2DigiSolutions',
|
|
31
35
|
logoSrc,
|
|
36
|
+
monochrome = false,
|
|
37
|
+
brandHref,
|
|
32
38
|
tagline = 'Build faster with a cohesive design system.',
|
|
33
39
|
footer = '© R2DigiSolutions. All rights reserved.',
|
|
34
40
|
headline = 'Sign in to continue',
|
|
@@ -55,30 +61,48 @@
|
|
|
55
61
|
{:else}
|
|
56
62
|
<div
|
|
57
63
|
class={[
|
|
58
|
-
'flex flex-col justify-between overflow-hidden bg-gradient-to-br
|
|
59
|
-
compact
|
|
60
|
-
? 'relative gap-4 px-5 py-5'
|
|
61
|
-
: 'absolute inset-0 gap-6 p-8 sm:p-10'
|
|
64
|
+
'from-brand-600 via-brand-700 to-brand-950 text-white flex flex-col justify-between overflow-hidden bg-gradient-to-br',
|
|
65
|
+
compact ? 'gap-4 px-5 py-5 relative' : 'inset-0 gap-6 p-8 sm:p-10 absolute'
|
|
62
66
|
]}
|
|
63
67
|
>
|
|
64
68
|
<div
|
|
65
|
-
class="
|
|
69
|
+
class="-right-16 -top-16 h-64 w-64 bg-white/10 blur-2xl pointer-events-none absolute rounded-full"
|
|
66
70
|
aria-hidden="true"
|
|
67
71
|
></div>
|
|
68
72
|
<div
|
|
69
|
-
class="
|
|
73
|
+
class="-bottom-20 -left-10 h-72 w-72 bg-brand-400/20 blur-3xl pointer-events-none absolute rounded-full"
|
|
70
74
|
aria-hidden="true"
|
|
71
75
|
></div>
|
|
72
76
|
|
|
73
77
|
<div class={['relative z-10', compact ? 'space-y-3' : 'space-y-6']}>
|
|
74
|
-
<div class="flex items-center
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
<div class="gap-2.5 flex items-center">
|
|
79
|
+
{#if brandHref}
|
|
80
|
+
<a
|
|
81
|
+
href={brandHref}
|
|
82
|
+
class="gap-2.5 inline-flex items-center text-inherit no-underline"
|
|
83
|
+
aria-label={brand}
|
|
84
|
+
>
|
|
85
|
+
<BrandMark name={brand} {logoSrc} {monochrome} size={compact ? 'sm' : 'md'} />
|
|
86
|
+
<span
|
|
87
|
+
class={[
|
|
88
|
+
'font-semibold tracking-tight text-white',
|
|
89
|
+
compact ? 'text-sm' : 'text-base'
|
|
90
|
+
]}
|
|
91
|
+
>
|
|
92
|
+
{brand}
|
|
93
|
+
</span>
|
|
94
|
+
</a>
|
|
95
|
+
{:else}
|
|
96
|
+
<BrandMark name={brand} {logoSrc} {monochrome} size={compact ? 'sm' : 'md'} />
|
|
97
|
+
<span
|
|
98
|
+
class={['font-semibold tracking-tight text-white', compact ? 'text-sm' : 'text-base']}
|
|
99
|
+
>
|
|
100
|
+
{brand}
|
|
101
|
+
</span>
|
|
102
|
+
{/if}
|
|
79
103
|
</div>
|
|
80
104
|
<div class="space-y-2">
|
|
81
|
-
<p class="
|
|
105
|
+
<p class="font-semibold text-white/70 sm:text-xs text-[10px] tracking-[0.2em] uppercase">
|
|
82
106
|
Welcome
|
|
83
107
|
</p>
|
|
84
108
|
<h1
|
|
@@ -94,10 +118,10 @@
|
|
|
94
118
|
</p>
|
|
95
119
|
</div>
|
|
96
120
|
{#if !compact && highlights.length}
|
|
97
|
-
<ul class="
|
|
121
|
+
<ul class="space-y-2.5 pt-1 text-sm text-white/75 sm:block hidden">
|
|
98
122
|
{#each highlights as item (item)}
|
|
99
|
-
<li class="flex items-start
|
|
100
|
-
<span class="mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full
|
|
123
|
+
<li class="gap-2 flex items-start">
|
|
124
|
+
<span class="mt-1.5 h-1.5 w-1.5 bg-white/80 shrink-0 rounded-full"></span>
|
|
101
125
|
{item}
|
|
102
126
|
</li>
|
|
103
127
|
{/each}
|
|
@@ -106,7 +130,7 @@
|
|
|
106
130
|
</div>
|
|
107
131
|
|
|
108
132
|
{#if !compact}
|
|
109
|
-
<p class="
|
|
133
|
+
<p class="text-xs text-white/50 relative z-10">{footer}</p>
|
|
110
134
|
{/if}
|
|
111
135
|
</div>
|
|
112
136
|
{/if}
|
|
@@ -114,9 +138,9 @@
|
|
|
114
138
|
|
|
115
139
|
<div
|
|
116
140
|
class={[
|
|
117
|
-
'flex w-full flex-col overflow-hidden
|
|
141
|
+
'bg-surface flex w-full flex-col overflow-hidden',
|
|
118
142
|
// h-dvh (not height:100%): % collapses when html/body have no explicit height
|
|
119
|
-
fillParent && 'h-
|
|
143
|
+
fillParent && 'min-h-0 h-full',
|
|
120
144
|
!fillParent && fullHeight && 'h-dvh min-h-dvh',
|
|
121
145
|
!fillParent && !fullHeight && 'min-h-[32rem]',
|
|
122
146
|
className
|
|
@@ -126,49 +150,57 @@
|
|
|
126
150
|
>
|
|
127
151
|
<div
|
|
128
152
|
class={[
|
|
129
|
-
'flex h-full
|
|
153
|
+
'min-h-0 flex h-full w-full flex-1 flex-col',
|
|
130
154
|
showAside && 'lg:flex-row lg:items-stretch',
|
|
131
155
|
asideSide === 'right' && 'lg:flex-row-reverse'
|
|
132
156
|
]}
|
|
133
157
|
>
|
|
134
158
|
{#if showAside}
|
|
135
159
|
<aside
|
|
136
|
-
class="
|
|
160
|
+
class="min-h-0 lg:block lg:h-auto lg:w-1/2 lg:self-stretch relative hidden w-full overflow-hidden"
|
|
137
161
|
>
|
|
138
162
|
{@render marketingPanel(false)}
|
|
139
163
|
</aside>
|
|
140
164
|
{/if}
|
|
141
165
|
|
|
142
|
-
<section class="relative flex h-full
|
|
166
|
+
<section class="min-h-0 bg-surface relative flex h-full w-full flex-1 flex-col">
|
|
143
167
|
<div
|
|
144
|
-
class="pointer-events-none absolute
|
|
168
|
+
class="inset-0 from-brand-500/5 pointer-events-none absolute bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] via-transparent to-transparent"
|
|
145
169
|
aria-hidden="true"
|
|
146
170
|
></div>
|
|
147
171
|
|
|
148
|
-
<SafeArea top bottom class="relative z-10 flex h-full
|
|
172
|
+
<SafeArea top bottom class="min-h-0 relative z-10 flex h-full flex-1 flex-col">
|
|
149
173
|
{#if mobileHero && showAside}
|
|
150
|
-
<div class="shrink-0
|
|
174
|
+
<div class="lg:hidden shrink-0">
|
|
151
175
|
{@render marketingPanel(true)}
|
|
152
176
|
</div>
|
|
153
177
|
{:else}
|
|
154
|
-
<div class="
|
|
155
|
-
<BrandMark
|
|
178
|
+
<div class="px-5 pt-6 lg:hidden shrink-0 text-center">
|
|
179
|
+
<BrandMark
|
|
180
|
+
name={brand}
|
|
181
|
+
{logoSrc}
|
|
182
|
+
{monochrome}
|
|
183
|
+
href={brandHref}
|
|
184
|
+
showName
|
|
185
|
+
size="md"
|
|
186
|
+
class="justify-center"
|
|
187
|
+
/>
|
|
156
188
|
<p class="mt-2 text-sm text-muted">{tagline}</p>
|
|
157
189
|
</div>
|
|
158
190
|
{/if}
|
|
159
191
|
|
|
160
192
|
<!-- Form column: true center in remaining space -->
|
|
161
193
|
<div
|
|
162
|
-
class="
|
|
194
|
+
class="min-h-0 px-5 py-8 sm:px-8 sm:py-10 flex h-full flex-1 flex-col items-center justify-center overflow-y-auto"
|
|
163
195
|
>
|
|
164
|
-
<div class="mx-auto w-full
|
|
196
|
+
<div class="max-w-md mx-auto w-full shrink-0">
|
|
165
197
|
{#if children}
|
|
166
198
|
{@render children()}
|
|
167
199
|
{/if}
|
|
168
200
|
</div>
|
|
169
201
|
</div>
|
|
170
202
|
|
|
171
|
-
<p class="
|
|
203
|
+
<p class="px-5 pb-4 text-muted lg:hidden shrink-0 text-center text-[11px]">{footer}</p>
|
|
172
204
|
</SafeArea>
|
|
173
205
|
</section>
|
|
174
206
|
</div>
|
|
@@ -4,6 +4,10 @@ interface AuthShellProps {
|
|
|
4
4
|
brand?: string;
|
|
5
5
|
/** Official brand logo URL (SVG/PNG) for BrandMark */
|
|
6
6
|
logoSrc?: string;
|
|
7
|
+
/** Single-color logo, painted with currentColor */
|
|
8
|
+
monochrome?: boolean;
|
|
9
|
+
/** Brand / logo link target (e.g. `/`) */
|
|
10
|
+
brandHref?: string;
|
|
7
11
|
tagline?: string;
|
|
8
12
|
footer?: string;
|
|
9
13
|
headline?: string;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import Panel from '../../molecules/Panel/Panel.svelte';
|
|
16
16
|
import SplitPane from '../../molecules/SplitPane/SplitPane.svelte';
|
|
17
17
|
import IconButton from '../../atoms/IconButton/IconButton.svelte';
|
|
18
|
+
import Menubar, { type MenubarItem } from '../Menubar/Menubar.svelte';
|
|
18
19
|
import Select from '../../molecules/Select/Select.svelte';
|
|
19
20
|
import DropdownMenu, {
|
|
20
21
|
type DropdownItem
|
|
@@ -92,6 +93,9 @@
|
|
|
92
93
|
import ZoomOut from '@lucide/svelte/icons/zoom-out';
|
|
93
94
|
import Grid3x3 from '@lucide/svelte/icons/grid-3x3';
|
|
94
95
|
import Magnet from '@lucide/svelte/icons/magnet';
|
|
96
|
+
import Monitor from '@lucide/svelte/icons/monitor';
|
|
97
|
+
import Tablet from '@lucide/svelte/icons/tablet';
|
|
98
|
+
import Smartphone from '@lucide/svelte/icons/smartphone';
|
|
95
99
|
import Copy from '@lucide/svelte/icons/copy';
|
|
96
100
|
import Trash2 from '@lucide/svelte/icons/trash-2';
|
|
97
101
|
import Lock from '@lucide/svelte/icons/lock';
|
|
@@ -126,6 +130,11 @@
|
|
|
126
130
|
value?: CanvasDocument;
|
|
127
131
|
assets?: MediaAsset[];
|
|
128
132
|
zoom?: number;
|
|
133
|
+
/**
|
|
134
|
+
* `frame` opens on the cover photo so it can be panned and zoomed.
|
|
135
|
+
* `edit` is the full canvas: panels, menu and component search.
|
|
136
|
+
*/
|
|
137
|
+
mode?: 'edit' | 'frame';
|
|
129
138
|
class?: string;
|
|
130
139
|
onchange?: (doc: CanvasDocument) => void;
|
|
131
140
|
onassetschange?: (assets: MediaAsset[]) => void;
|
|
@@ -140,6 +149,7 @@
|
|
|
140
149
|
value = $bindable(emptyCanvasDocument()),
|
|
141
150
|
assets = $bindable<MediaAsset[]>([]),
|
|
142
151
|
zoom = $bindable(1),
|
|
152
|
+
mode = 'edit',
|
|
143
153
|
class: className = '',
|
|
144
154
|
onchange,
|
|
145
155
|
onassetschange,
|
|
@@ -154,11 +164,14 @@
|
|
|
154
164
|
});
|
|
155
165
|
|
|
156
166
|
let selectedIds = $state<string[]>([]);
|
|
167
|
+
let editingTextId = $state<string | null>(null);
|
|
168
|
+
let frameBoot = false;
|
|
157
169
|
let showSidebar = $state(true);
|
|
158
170
|
let showInspector = $state(true);
|
|
159
171
|
let assetsSize = $state(58);
|
|
160
172
|
let sidebarTab = $state<'elements' | 'uploads' | 'widgets'>('elements');
|
|
161
173
|
let showGrid = $state(false);
|
|
174
|
+
let stageFrame = $state<'edit' | 'desktop' | 'tablet' | 'mobile'>('edit');
|
|
162
175
|
let showGuides = $state(true);
|
|
163
176
|
let snap = $state(true);
|
|
164
177
|
let cellSize = $state(8);
|
|
@@ -199,6 +212,56 @@
|
|
|
199
212
|
};
|
|
200
213
|
});
|
|
201
214
|
|
|
215
|
+
$effect(() => {
|
|
216
|
+
if (mode !== 'frame' || frameBoot) return;
|
|
217
|
+
const image =
|
|
218
|
+
stageDoc.layers.find((layer) => layer.kind === 'image' && layer.name === 'Cover') ??
|
|
219
|
+
stageDoc.layers.find((layer) => layer.kind === 'image');
|
|
220
|
+
frameBoot = true;
|
|
221
|
+
showSidebar = false;
|
|
222
|
+
showInspector = false;
|
|
223
|
+
if (image) selectedIds = [image.id];
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
const menuItems = $derived<MenubarItem[]>([
|
|
227
|
+
{
|
|
228
|
+
id: 'file',
|
|
229
|
+
label: 'Archivo',
|
|
230
|
+
items: [
|
|
231
|
+
{ id: 'export-png', label: 'Exportar PNG' },
|
|
232
|
+
{ id: 'export-jpeg', label: 'Exportar JPEG' }
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
id: 'edit',
|
|
237
|
+
label: 'Edición',
|
|
238
|
+
items: [
|
|
239
|
+
{ id: 'undo', label: 'Deshacer', shortcut: '⌘Z', disabled: history.past.length === 0 },
|
|
240
|
+
{ id: 'redo', label: 'Rehacer', shortcut: '⇧⌘Z', disabled: history.future.length === 0 },
|
|
241
|
+
{
|
|
242
|
+
id: 'delete',
|
|
243
|
+
label: 'Borrar selección',
|
|
244
|
+
destructive: true,
|
|
245
|
+
shortcut: '⌫',
|
|
246
|
+
disabled: selectedIds.length === 0
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
id: 'view',
|
|
252
|
+
label: 'Vista',
|
|
253
|
+
items: [
|
|
254
|
+
{ id: 'grid', label: 'Rejilla', checked: showGrid },
|
|
255
|
+
{ id: 'snap', label: 'Imán', checked: snap },
|
|
256
|
+
{ id: 'guides', label: 'Guías', checked: showGuides },
|
|
257
|
+
{ id: 'panels', label: 'Paneles', checked: showSidebar && showInspector },
|
|
258
|
+
{ id: 'desktop', label: 'Escritorio' },
|
|
259
|
+
{ id: 'tablet', label: 'Tablet' },
|
|
260
|
+
{ id: 'mobile', label: 'Móvil' }
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
]);
|
|
264
|
+
|
|
202
265
|
const selectedLayer = $derived(
|
|
203
266
|
selectedIds.length === 1 ? (stageDoc.layers.find((l) => l.id === selectedIds[0]) ?? null) : null
|
|
204
267
|
);
|
|
@@ -456,10 +519,7 @@
|
|
|
456
519
|
const rootSize = { width: stageDoc.width, height: stageDoc.height };
|
|
457
520
|
const prev = stageDoc.layers.find((l) => l.id === layer.id);
|
|
458
521
|
let layers = stageDoc.layers.map((l) => (l.id === layer.id ? layer : l));
|
|
459
|
-
if (
|
|
460
|
-
prev &&
|
|
461
|
-
(shouldAutoSizeChildren(layer) || isContainerKind(layer.kind))
|
|
462
|
-
) {
|
|
522
|
+
if (prev && (shouldAutoSizeChildren(layer) || isContainerKind(layer.kind))) {
|
|
463
523
|
const prevAbs = computeAbsoluteRects(stageDoc.layers, rootSize).get(prev.id) ?? prev.rect;
|
|
464
524
|
const nextAbs = computeAbsoluteRects(layers, rootSize).get(layer.id) ?? layer.rect;
|
|
465
525
|
if (Math.abs(nextAbs.w - prevAbs.w) > 0.5 || Math.abs(nextAbs.h - prevAbs.h) > 0.5) {
|
|
@@ -945,6 +1005,12 @@
|
|
|
945
1005
|
nudgeSelected(dirX, dirY, e.shiftKey);
|
|
946
1006
|
return;
|
|
947
1007
|
}
|
|
1008
|
+
if (editingTextId && e.key === 'Escape') {
|
|
1009
|
+
e.preventDefault();
|
|
1010
|
+
(document.activeElement as HTMLElement | null)?.blur?.();
|
|
1011
|
+
editingTextId = null;
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
948
1014
|
if (t?.closest?.('input, textarea, select, [contenteditable="true"]')) return;
|
|
949
1015
|
|
|
950
1016
|
if (drawMode) {
|
|
@@ -1095,9 +1161,39 @@
|
|
|
1095
1161
|
toast.success('Widget duplicated');
|
|
1096
1162
|
}
|
|
1097
1163
|
|
|
1164
|
+
function commitText(id: string, text: string) {
|
|
1165
|
+
const layer = stageDoc.layers.find((l) => l.id === id);
|
|
1166
|
+
editingTextId = null;
|
|
1167
|
+
if (!layer || (layer.text ?? '') === text) return;
|
|
1168
|
+
patchLayer({ ...layer, text });
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
function onMenu(id: string, _parentId: string, checked?: boolean) {
|
|
1172
|
+
if (id === 'export-png') void handleExport('png');
|
|
1173
|
+
else if (id === 'export-jpeg') void handleExport('jpeg');
|
|
1174
|
+
else if (id === 'undo') undo();
|
|
1175
|
+
else if (id === 'redo') redo();
|
|
1176
|
+
else if (id === 'delete') deleteSelected();
|
|
1177
|
+
else if (id === 'grid' && checked !== undefined) showGrid = checked;
|
|
1178
|
+
else if (id === 'snap' && checked !== undefined) snap = checked;
|
|
1179
|
+
else if (id === 'guides' && checked !== undefined) showGuides = checked;
|
|
1180
|
+
else if (id === 'panels' && checked !== undefined) {
|
|
1181
|
+
showSidebar = checked;
|
|
1182
|
+
showInspector = checked;
|
|
1183
|
+
} else if (id === 'desktop') stageFrame = stageFrame === 'desktop' ? 'edit' : 'desktop';
|
|
1184
|
+
else if (id === 'tablet') stageFrame = stageFrame === 'tablet' ? 'edit' : 'tablet';
|
|
1185
|
+
else if (id === 'mobile') stageFrame = stageFrame === 'mobile' ? 'edit' : 'mobile';
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1098
1188
|
function enterLayer(id: string) {
|
|
1099
1189
|
const layer = stageDoc.layers.find((l) => l.id === id);
|
|
1100
1190
|
if (!layer) return;
|
|
1191
|
+
if (layer.kind === 'text' || layer.kind === 'sticky') {
|
|
1192
|
+
selectedIds = [id];
|
|
1193
|
+
editingTextId = id;
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
editingTextId = null;
|
|
1101
1197
|
if (layer.kind === 'widget' && layer.definitionId && !editingWidgetId) {
|
|
1102
1198
|
enterWidgetEdit(layer.definitionId);
|
|
1103
1199
|
return;
|
|
@@ -1117,6 +1213,9 @@
|
|
|
1117
1213
|
<svelte:window onkeydowncapture={handleKeydown} />
|
|
1118
1214
|
|
|
1119
1215
|
<div class={['min-h-0 relative flex h-full flex-col', className]}>
|
|
1216
|
+
{#if mode !== 'frame'}
|
|
1217
|
+
<Menubar items={menuItems} onselect={onMenu} />
|
|
1218
|
+
{/if}
|
|
1120
1219
|
<header
|
|
1121
1220
|
class="gap-3 border-border bg-surface-elevated px-3 py-2 flex shrink-0 items-center border-b"
|
|
1122
1221
|
>
|
|
@@ -1572,7 +1671,7 @@
|
|
|
1572
1671
|
{/snippet}
|
|
1573
1672
|
|
|
1574
1673
|
{#snippet workspace()}
|
|
1575
|
-
<div class="min-h-0 h-full">
|
|
1674
|
+
<div class="min-h-0 relative h-full">
|
|
1576
1675
|
<MediaStage
|
|
1577
1676
|
document={stageDoc}
|
|
1578
1677
|
{selectedIds}
|
|
@@ -1582,8 +1681,15 @@
|
|
|
1582
1681
|
{snap}
|
|
1583
1682
|
{cellSize}
|
|
1584
1683
|
{drawMode}
|
|
1684
|
+
preview={stageFrame}
|
|
1585
1685
|
expandWidgets={!editingWidget}
|
|
1586
|
-
onselect={(ids) =>
|
|
1686
|
+
onselect={(ids) => {
|
|
1687
|
+
if (editingTextId && !ids.includes(editingTextId)) {
|
|
1688
|
+
(document.activeElement as HTMLElement | null)?.blur?.();
|
|
1689
|
+
editingTextId = null;
|
|
1690
|
+
}
|
|
1691
|
+
selectedIds = ids;
|
|
1692
|
+
}}
|
|
1587
1693
|
onzoom={setZoom}
|
|
1588
1694
|
onlayerchange={patchLayer}
|
|
1589
1695
|
ondocumentchange={(doc) => {
|
|
@@ -1614,7 +1720,50 @@
|
|
|
1614
1720
|
}}
|
|
1615
1721
|
ondrawcancel={() => (drawMode = false)}
|
|
1616
1722
|
onenterlayer={enterLayer}
|
|
1723
|
+
{editingTextId}
|
|
1724
|
+
ontextcommit={commitText}
|
|
1617
1725
|
/>
|
|
1726
|
+
<div class="inset-x-0 bottom-3 pointer-events-none absolute z-20 flex justify-center">
|
|
1727
|
+
<div class="pointer-events-auto">
|
|
1728
|
+
<Dock size="sm">
|
|
1729
|
+
<DockItem
|
|
1730
|
+
size="sm"
|
|
1731
|
+
active={stageFrame === 'edit'}
|
|
1732
|
+
ariaLabel="Lienzo"
|
|
1733
|
+
onclick={() => (stageFrame = 'edit')}
|
|
1734
|
+
>
|
|
1735
|
+
Lienzo
|
|
1736
|
+
</DockItem>
|
|
1737
|
+
<DockItem
|
|
1738
|
+
size="sm"
|
|
1739
|
+
active={stageFrame === 'desktop'}
|
|
1740
|
+
ariaLabel="Escritorio"
|
|
1741
|
+
onclick={() => (stageFrame = 'desktop')}
|
|
1742
|
+
>
|
|
1743
|
+
<Monitor class="h-3.5 w-3.5" />
|
|
1744
|
+
Escritorio
|
|
1745
|
+
</DockItem>
|
|
1746
|
+
<DockItem
|
|
1747
|
+
size="sm"
|
|
1748
|
+
active={stageFrame === 'tablet'}
|
|
1749
|
+
ariaLabel="Tablet"
|
|
1750
|
+
onclick={() => (stageFrame = 'tablet')}
|
|
1751
|
+
>
|
|
1752
|
+
<Tablet class="h-3.5 w-3.5" />
|
|
1753
|
+
Tablet
|
|
1754
|
+
</DockItem>
|
|
1755
|
+
<DockItem
|
|
1756
|
+
size="sm"
|
|
1757
|
+
active={stageFrame === 'mobile'}
|
|
1758
|
+
ariaLabel="Móvil"
|
|
1759
|
+
onclick={() => (stageFrame = 'mobile')}
|
|
1760
|
+
>
|
|
1761
|
+
<Smartphone class="h-3.5 w-3.5" />
|
|
1762
|
+
Móvil
|
|
1763
|
+
</DockItem>
|
|
1764
|
+
</Dock>
|
|
1765
|
+
</div>
|
|
1766
|
+
</div>
|
|
1618
1767
|
</div>
|
|
1619
1768
|
{/snippet}
|
|
1620
1769
|
|
|
@@ -1662,7 +1811,7 @@
|
|
|
1662
1811
|
</EditorShell>
|
|
1663
1812
|
|
|
1664
1813
|
{#if selectedIds.length > 1}
|
|
1665
|
-
<div class="inset-x-0 bottom-
|
|
1814
|
+
<div class="inset-x-0 bottom-16 px-4 pointer-events-none absolute z-30 flex justify-center">
|
|
1666
1815
|
<div class="pointer-events-auto">
|
|
1667
1816
|
<BulkActionBar
|
|
1668
1817
|
count={selectedIds.length}
|
|
@@ -5,6 +5,11 @@ interface CanvasEditorProps {
|
|
|
5
5
|
value?: CanvasDocument;
|
|
6
6
|
assets?: MediaAsset[];
|
|
7
7
|
zoom?: number;
|
|
8
|
+
/**
|
|
9
|
+
* `frame` opens on the cover photo so it can be panned and zoomed.
|
|
10
|
+
* `edit` is the full canvas: panels, menu and component search.
|
|
11
|
+
*/
|
|
12
|
+
mode?: 'edit' | 'frame';
|
|
8
13
|
class?: string;
|
|
9
14
|
onchange?: (doc: CanvasDocument) => void;
|
|
10
15
|
onassetschange?: (assets: MediaAsset[]) => void;
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
|
|
93
93
|
function desktopClass(active: boolean, disabled?: boolean) {
|
|
94
94
|
return [
|
|
95
|
-
'gap-1.5 px-3 font-medium relative flex items-center transition-colors no-underline',
|
|
95
|
+
'gap-1.5 px-3 font-medium relative flex shrink-0 items-center whitespace-nowrap transition-colors no-underline',
|
|
96
96
|
'focus-visible:ring-brand-500/30 focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset',
|
|
97
97
|
linkSize,
|
|
98
98
|
variant === 'underline' && 'border-b-2',
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
|
|
180
180
|
<nav
|
|
181
181
|
class={[
|
|
182
|
-
'min-w-0 gap-0.5 md:flex hidden h-full items-stretch',
|
|
182
|
+
'min-w-0 gap-0.5 md:flex hidden h-full flex-nowrap items-stretch',
|
|
183
183
|
centerLinks ? 'flex-1 justify-center' : 'flex-1',
|
|
184
184
|
!showBrand && !centerLinks && 'flex-1'
|
|
185
185
|
]}
|