@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
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
type MarqueeRect as MarqueeBox
|
|
19
19
|
} from '../../../utils/marqueeSelect.js';
|
|
20
20
|
import {
|
|
21
|
-
applyTextAutoSize,
|
|
22
21
|
createCanvasGuide,
|
|
23
22
|
pathPointsToDoc,
|
|
24
23
|
rebakePathLayer,
|
|
@@ -88,6 +87,14 @@
|
|
|
88
87
|
ondrawcancel?: () => void;
|
|
89
88
|
/** Double-click a widget instance or container. */
|
|
90
89
|
onenterlayer?: (id: string) => void;
|
|
90
|
+
/** Text or note layer currently being typed into. */
|
|
91
|
+
editingTextId?: string | null;
|
|
92
|
+
ontextcommit?: (id: string, text: string) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Device preview. Rulers stay on the workspace edges.
|
|
95
|
+
* Only the artboard changes size.
|
|
96
|
+
*/
|
|
97
|
+
preview?: 'edit' | 'desktop' | 'tablet' | 'mobile';
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
let {
|
|
@@ -109,7 +116,10 @@
|
|
|
109
116
|
ondropelement,
|
|
110
117
|
ondrawcomplete,
|
|
111
118
|
ondrawcancel,
|
|
112
|
-
onenterlayer
|
|
119
|
+
onenterlayer,
|
|
120
|
+
editingTextId = null,
|
|
121
|
+
ontextcommit,
|
|
122
|
+
preview = 'edit'
|
|
113
123
|
}: MediaStageProps = $props();
|
|
114
124
|
|
|
115
125
|
let viewportEl = $state<HTMLDivElement | null>(null);
|
|
@@ -205,9 +215,14 @@
|
|
|
205
215
|
);
|
|
206
216
|
const selectionFrame = $derived(selectionLive ?? selectionBounds);
|
|
207
217
|
|
|
218
|
+
const previewMaxW = $derived(
|
|
219
|
+
preview === 'mobile' ? 390 : preview === 'tablet' ? 834 : preview === 'desktop' ? 1280 : 0
|
|
220
|
+
);
|
|
221
|
+
|
|
208
222
|
const fitScale = $derived.by(() => {
|
|
209
223
|
if (vw <= 0 || vh <= 0) return 1;
|
|
210
|
-
const
|
|
224
|
+
const availW = previewMaxW > 0 ? Math.min(vw - PAD * 2, previewMaxW) : vw - PAD * 2;
|
|
225
|
+
const sx = availW / doc.width;
|
|
211
226
|
const sy = (vh - PAD * 2) / doc.height;
|
|
212
227
|
return Math.max(0.05, Math.min(sx, sy, 1));
|
|
213
228
|
});
|
|
@@ -420,8 +435,9 @@
|
|
|
420
435
|
const source = layers.find((l) => l.id === layer.id);
|
|
421
436
|
if (!source) return;
|
|
422
437
|
|
|
423
|
-
const
|
|
424
|
-
const
|
|
438
|
+
const textLike = source.kind === 'text' || source.kind === 'sticky';
|
|
439
|
+
const minW = source.kind === 'line' || source.kind === 'arrow' ? 24 : textLike ? 8 : 40;
|
|
440
|
+
const minH = source.kind === 'line' ? 2 : textLike ? 8 : 24;
|
|
425
441
|
let nextAbs = snapLayerRect(
|
|
426
442
|
{ x: rect.x, y: rect.y, w: rect.w, h: rect.h },
|
|
427
443
|
cellSize,
|
|
@@ -433,6 +449,10 @@
|
|
|
433
449
|
8,
|
|
434
450
|
false
|
|
435
451
|
);
|
|
452
|
+
if (textLike && (source.autoSize ?? source.kind === 'text')) {
|
|
453
|
+
// El tamaño lo pone el texto; la rejilla solo coloca.
|
|
454
|
+
nextAbs = { ...nextAbs, w: rect.w, h: rect.h };
|
|
455
|
+
}
|
|
436
456
|
|
|
437
457
|
const prevAbs = absMap.get(source.id) ?? source.rect;
|
|
438
458
|
if (positionLocked) {
|
|
@@ -499,12 +519,8 @@
|
|
|
499
519
|
scaleDescendants: false
|
|
500
520
|
});
|
|
501
521
|
} else {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
absToLocalUpdate(source, nextAbs),
|
|
505
|
-
prevAbs,
|
|
506
|
-
nextAbs
|
|
507
|
-
);
|
|
522
|
+
// Texto auto: la letra la escala MediaLayerItem desde el ancho (esquinas). Aquí solo el rect.
|
|
523
|
+
const updated = absToLocalUpdate(source, nextAbs);
|
|
508
524
|
nextLayers = layers.map((l) => (l.id === updated.id ? updated : l));
|
|
509
525
|
}
|
|
510
526
|
commitGroupGeometry(nextLayers);
|
|
@@ -932,8 +948,8 @@
|
|
|
932
948
|
}
|
|
933
949
|
|
|
934
950
|
function setGuidePreview(orientation: CanvasGuideOrientation, clientX: number, clientY: number) {
|
|
935
|
-
if (!
|
|
936
|
-
const r =
|
|
951
|
+
if (!artboardEl) return;
|
|
952
|
+
const r = artboardEl.getBoundingClientRect();
|
|
937
953
|
guidePreview = {
|
|
938
954
|
orientation,
|
|
939
955
|
x: clientX - r.left,
|
|
@@ -1279,263 +1295,291 @@
|
|
|
1279
1295
|
style:width={`${Math.max(vw || 0, boardW + PAD * 2)}px`}
|
|
1280
1296
|
style:height={`${Math.max(vh || 0, boardH + PAD * 2)}px`}
|
|
1281
1297
|
>
|
|
1282
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1283
1298
|
<div
|
|
1284
|
-
bind:this={artboardEl}
|
|
1285
|
-
onwheel={handleScrollWheel}
|
|
1286
|
-
onclick={(e) => {
|
|
1287
|
-
e.stopPropagation();
|
|
1288
|
-
if (drawMode) {
|
|
1289
|
-
handleDrawClick(e);
|
|
1290
|
-
return;
|
|
1291
|
-
}
|
|
1292
|
-
clearSelectionIfEmptyClick(e);
|
|
1293
|
-
}}
|
|
1294
|
-
ondblclick={(e) => {
|
|
1295
|
-
if (drawMode) {
|
|
1296
|
-
handleDrawDblClick(e);
|
|
1297
|
-
return;
|
|
1298
|
-
}
|
|
1299
|
-
const pt = clientToDoc(e.clientX, e.clientY);
|
|
1300
|
-
const hit = pickLayerAtDoc(pt);
|
|
1301
|
-
if (hit) onenterlayer?.(hit);
|
|
1302
|
-
}}
|
|
1303
|
-
onmousemove={handleDrawMove}
|
|
1304
1299
|
class={[
|
|
1305
|
-
'
|
|
1306
|
-
|
|
1300
|
+
'relative shrink-0',
|
|
1301
|
+
preview === 'desktop' && 'rounded-xl border-border shadow-lg border',
|
|
1302
|
+
preview === 'tablet' &&
|
|
1303
|
+
'border-neutral-800 shadow-lg bg-neutral-900 p-1.5 rounded-[1.25rem] border-8',
|
|
1304
|
+
preview === 'mobile' &&
|
|
1305
|
+
'border-neutral-800 shadow-lg bg-neutral-900 p-1.5 rounded-[1.75rem] border-8'
|
|
1307
1306
|
]}
|
|
1308
|
-
style:width={`${boardW}px`}
|
|
1309
|
-
style:height={`${boardH}px`}
|
|
1310
1307
|
>
|
|
1308
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1309
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
1311
1310
|
<div
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1311
|
+
bind:this={artboardEl}
|
|
1312
|
+
onwheel={handleScrollWheel}
|
|
1313
|
+
onclick={(e) => {
|
|
1314
|
+
e.stopPropagation();
|
|
1315
|
+
if (drawMode) {
|
|
1316
|
+
handleDrawClick(e);
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
clearSelectionIfEmptyClick(e);
|
|
1320
|
+
}}
|
|
1321
|
+
ondblclick={(e) => {
|
|
1322
|
+
if (drawMode) {
|
|
1323
|
+
handleDrawDblClick(e);
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
const pt = clientToDoc(e.clientX, e.clientY);
|
|
1327
|
+
const hit = pickLayerAtDoc(pt);
|
|
1328
|
+
if (hit) onenterlayer?.(hit);
|
|
1329
|
+
}}
|
|
1330
|
+
onmousemove={handleDrawMove}
|
|
1331
|
+
class={[
|
|
1332
|
+
'ring-black/10 relative shrink-0 overflow-visible shadow-[0_8px_40px_rgba(15,23,42,0.18)] ring-1',
|
|
1333
|
+
drawMode && 'cursor-crosshair'
|
|
1334
|
+
]}
|
|
1335
|
+
style:width={`${boardW}px`}
|
|
1336
|
+
style:height={`${boardH}px`}
|
|
1316
1337
|
>
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
{
|
|
1338
|
+
<div
|
|
1339
|
+
class="left-0 top-0 absolute origin-top-left overflow-visible"
|
|
1340
|
+
style:width={`${doc.width}px`}
|
|
1341
|
+
style:height={`${doc.height}px`}
|
|
1342
|
+
style:transform={`scale(${scale})`}
|
|
1343
|
+
>
|
|
1344
|
+
<!-- Artboard surface (clipped). Layers sit above and may overhang like a compositor. -->
|
|
1345
|
+
<div class="inset-0 pointer-events-none absolute overflow-hidden" aria-hidden="true">
|
|
1346
|
+
{#if artboardTransparent}
|
|
1347
|
+
<div
|
|
1348
|
+
class="inset-0 absolute"
|
|
1349
|
+
style:background-color="#e8ebef"
|
|
1350
|
+
style:background-image="linear-gradient(45deg,#cfd5dc 25%,transparent
|
|
1351
|
+
25%),linear-gradient(-45deg,#cfd5dc 25%,transparent
|
|
1352
|
+
25%),linear-gradient(45deg,transparent 75%,#cfd5dc
|
|
1353
|
+
75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
|
|
1354
|
+
style:background-size="16px 16px"
|
|
1355
|
+
style:background-position="0 0,0 8px,8px -8px,-8px 0"
|
|
1356
|
+
></div>
|
|
1357
|
+
{/if}
|
|
1358
|
+
<div class="inset-0 absolute" style:background-color={doc.background}></div>
|
|
1359
|
+
</div>
|
|
1360
|
+
|
|
1361
|
+
{#if showGrid}
|
|
1320
1362
|
<div
|
|
1321
|
-
class="inset-0 absolute"
|
|
1322
|
-
style
|
|
1323
|
-
|
|
1324
|
-
25%),linear-gradient(-45deg,#cfd5dc 25%,transparent
|
|
1325
|
-
25%),linear-gradient(45deg,transparent 75%,#cfd5dc
|
|
1326
|
-
75%),linear-gradient(-45deg,transparent 75%,#cfd5dc 75%)"
|
|
1327
|
-
style:background-size="16px 16px"
|
|
1328
|
-
style:background-position="0 0,0 8px,8px -8px,-8px 0"
|
|
1363
|
+
class="inset-0 pointer-events-none absolute z-100 overflow-hidden"
|
|
1364
|
+
style={gridOverlayStyle}
|
|
1365
|
+
aria-hidden="true"
|
|
1329
1366
|
></div>
|
|
1330
1367
|
{/if}
|
|
1331
|
-
<div class="inset-0 absolute" style:background-color={doc.background}></div>
|
|
1332
|
-
</div>
|
|
1333
|
-
|
|
1334
|
-
{#if showGrid}
|
|
1335
|
-
<div
|
|
1336
|
-
class="inset-0 pointer-events-none absolute z-100 overflow-hidden"
|
|
1337
|
-
style={gridOverlayStyle}
|
|
1338
|
-
aria-hidden="true"
|
|
1339
|
-
></div>
|
|
1340
|
-
{/if}
|
|
1341
1368
|
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1369
|
+
<div class={['inset-0 absolute overflow-visible', drawMode && 'pointer-events-none']}>
|
|
1370
|
+
{#each sorted as layer, paintIndex (layer.id)}
|
|
1371
|
+
{#if effectivelyVisible.has(layer.id)}
|
|
1372
|
+
{@const realId = resolveSelectableId(layer.id)}
|
|
1373
|
+
{@const isSynthetic = !sceneLayerIds.has(layer.id)}
|
|
1374
|
+
{@const lockedPass = layerLocked(layer) || isSynthetic}
|
|
1375
|
+
{@const displayRect = paintAbsMap.get(layer.id) ?? layer.rect}
|
|
1376
|
+
{@const clipPath = clipPathForLayer(layer.id, displayLayers, paintAbsMap)}
|
|
1377
|
+
{@const sceneLayer = workingLayers.find((l) => l.id === realId)}
|
|
1378
|
+
{@const marqueeBg = !!sceneLayer && isMarqueePassThroughKind(sceneLayer.kind)}
|
|
1379
|
+
{@const isSelected = selectedSet.has(realId) && !isSynthetic}
|
|
1380
|
+
{@const positionLocked = isLayoutLocked(layer)}
|
|
1381
|
+
{@const sizeLocked = isSizeLocked(layer)}
|
|
1382
|
+
{@const dragOk =
|
|
1383
|
+
!lockedPass &&
|
|
1384
|
+
(!marqueeBg || (isSelected && sceneLayer?.kind !== 'canvasPanel'))}
|
|
1385
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1386
|
+
<div
|
|
1387
|
+
data-layer-item
|
|
1388
|
+
data-marquee-id={realId}
|
|
1389
|
+
class="contents"
|
|
1390
|
+
oncontextmenu={(e) => {
|
|
1391
|
+
if (lockedPass && isSynthetic) {
|
|
1392
|
+
e.preventDefault();
|
|
1393
|
+
e.stopPropagation();
|
|
1394
|
+
onselect?.([realId]);
|
|
1395
|
+
oncontextlayer?.({ id: realId, x: e.clientX, y: e.clientY });
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (lockedPass) return;
|
|
1365
1399
|
e.preventDefault();
|
|
1366
1400
|
e.stopPropagation();
|
|
1367
|
-
onselect?.([realId]);
|
|
1401
|
+
if (!selectedSet.has(realId)) onselect?.([realId]);
|
|
1368
1402
|
oncontextlayer?.({ id: realId, x: e.clientX, y: e.clientY });
|
|
1369
|
-
return;
|
|
1370
|
-
}
|
|
1371
|
-
if (lockedPass) return;
|
|
1372
|
-
e.preventDefault();
|
|
1373
|
-
e.stopPropagation();
|
|
1374
|
-
if (!selectedSet.has(realId)) onselect?.([realId]);
|
|
1375
|
-
oncontextlayer?.({ id: realId, x: e.clientX, y: e.clientY });
|
|
1376
|
-
}}
|
|
1377
|
-
>
|
|
1378
|
-
<MediaLayerItem
|
|
1379
|
-
{layer}
|
|
1380
|
-
{displayRect}
|
|
1381
|
-
{clipPath}
|
|
1382
|
-
stackIndex={paintIndex}
|
|
1383
|
-
paintTransform={paintTransformForLayer(
|
|
1384
|
-
displayLayers,
|
|
1385
|
-
layer.id,
|
|
1386
|
-
paintAbsMap,
|
|
1387
|
-
layerById
|
|
1388
|
-
)}
|
|
1389
|
-
selected={isSelected}
|
|
1390
|
-
showHandles={isSelected && selectedIds.length === 1}
|
|
1391
|
-
passthrough={lockedPass || groupedChildPassthrough(layer)}
|
|
1392
|
-
followStageRect={selectedIds.length > 1 ||
|
|
1393
|
-
!!selectedAncestorId(workingLayers, realId, selectedSet)}
|
|
1394
|
-
readOnly={isSynthetic}
|
|
1395
|
-
layoutPositionLocked={positionLocked || (marqueeBg && !dragOk)}
|
|
1396
|
-
layoutSizeLocked={sizeLocked}
|
|
1397
|
-
onclick={(e) => selectLayer(layer.id, e)}
|
|
1398
|
-
ondblclick={(e) => {
|
|
1399
|
-
if (lockedPass) return;
|
|
1400
|
-
const pt = clientToDoc(e.clientX, e.clientY);
|
|
1401
|
-
const hit = pickLayerAtDoc(pt) ?? realId;
|
|
1402
|
-
onenterlayer?.(hit);
|
|
1403
1403
|
}}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1404
|
+
>
|
|
1405
|
+
<MediaLayerItem
|
|
1406
|
+
{layer}
|
|
1407
|
+
{displayRect}
|
|
1408
|
+
{clipPath}
|
|
1409
|
+
stackIndex={paintIndex}
|
|
1410
|
+
paintTransform={paintTransformForLayer(
|
|
1411
|
+
displayLayers,
|
|
1412
|
+
layer.id,
|
|
1413
|
+
paintAbsMap,
|
|
1414
|
+
layerById
|
|
1415
|
+
)}
|
|
1416
|
+
selected={isSelected}
|
|
1417
|
+
showHandles={isSelected && selectedIds.length === 1}
|
|
1418
|
+
passthrough={lockedPass || groupedChildPassthrough(layer)}
|
|
1419
|
+
followStageRect={selectedIds.length > 1 ||
|
|
1420
|
+
!!selectedAncestorId(workingLayers, realId, selectedSet)}
|
|
1421
|
+
readOnly={isSynthetic}
|
|
1422
|
+
layoutPositionLocked={positionLocked || (marqueeBg && !dragOk)}
|
|
1423
|
+
layoutSizeLocked={sizeLocked}
|
|
1424
|
+
onclick={(e) => selectLayer(layer.id, e)}
|
|
1425
|
+
ondblclick={(e) => {
|
|
1426
|
+
if (lockedPass) return;
|
|
1427
|
+
const pt = clientToDoc(e.clientX, e.clientY);
|
|
1428
|
+
const hit = pickLayerAtDoc(pt) ?? realId;
|
|
1429
|
+
onenterlayer?.(hit);
|
|
1430
|
+
}}
|
|
1431
|
+
onchange={(rect) => handleRect(layer, rect)}
|
|
1432
|
+
onpatch={(partial) => {
|
|
1433
|
+
const source = (draftLayers ?? doc.layers).find((l) => l.id === realId);
|
|
1434
|
+
if (!source) return;
|
|
1435
|
+
const next = {
|
|
1436
|
+
...source,
|
|
1437
|
+
...partial,
|
|
1438
|
+
rect: partial.rect ? { ...source.rect, ...partial.rect } : source.rect
|
|
1439
|
+
};
|
|
1440
|
+
if (draftLayers) {
|
|
1441
|
+
draftLayers = draftLayers.map((l) => (l.id === realId ? next : l));
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
onlayerchange?.(next);
|
|
1445
|
+
}}
|
|
1446
|
+
editing={editingTextId === realId && !isSynthetic}
|
|
1447
|
+
ontextcommit={(text) => ontextcommit?.(realId, text)}
|
|
1448
|
+
oninteract={handleLayerInteract}
|
|
1449
|
+
/>
|
|
1450
|
+
</div>
|
|
1451
|
+
{/if}
|
|
1452
|
+
{/each}
|
|
1431
1453
|
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
{@const outline = paintAbsMap.get(sid)}
|
|
1454
|
+
{#each ancestorOutlineIds as pid (pid)}
|
|
1455
|
+
{@const outline = paintAbsMap.get(pid)}
|
|
1435
1456
|
{#if outline}
|
|
1436
1457
|
<div
|
|
1437
|
-
class="pointer-events-none absolute z-[
|
|
1458
|
+
class="pointer-events-none absolute z-[999980] outline outline-1 outline-[#3b82f6]/80 outline-dashed"
|
|
1438
1459
|
style:left="{outline.x}px"
|
|
1439
1460
|
style:top="{outline.y}px"
|
|
1440
1461
|
style:width="{outline.w}px"
|
|
1441
1462
|
style:height="{outline.h}px"
|
|
1463
|
+
style:transform={paintTransformForLayer(
|
|
1464
|
+
displayLayers,
|
|
1465
|
+
pid,
|
|
1466
|
+
paintAbsMap,
|
|
1467
|
+
layerById
|
|
1468
|
+
)}
|
|
1469
|
+
style:transform-origin="0 0"
|
|
1442
1470
|
aria-hidden="true"
|
|
1443
1471
|
></div>
|
|
1444
1472
|
{/if}
|
|
1445
1473
|
{/each}
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1474
|
+
|
|
1475
|
+
{#if selectedIds.length > 1}
|
|
1476
|
+
{#each selectedIds as sid (sid)}
|
|
1477
|
+
{@const outline = paintAbsMap.get(sid)}
|
|
1478
|
+
{#if outline}
|
|
1479
|
+
<div
|
|
1480
|
+
class="pointer-events-none absolute z-[999985] outline outline-2 outline-[#3b82f6]"
|
|
1481
|
+
style:left="{outline.x}px"
|
|
1482
|
+
style:top="{outline.y}px"
|
|
1483
|
+
style:width="{outline.w}px"
|
|
1484
|
+
style:height="{outline.h}px"
|
|
1485
|
+
aria-hidden="true"
|
|
1486
|
+
></div>
|
|
1487
|
+
{/if}
|
|
1488
|
+
{/each}
|
|
1489
|
+
{#if selectionFrame}
|
|
1490
|
+
<div data-marquee-ignore class="contents">
|
|
1491
|
+
<WidgetFrame
|
|
1492
|
+
freeform
|
|
1493
|
+
showChrome={false}
|
|
1494
|
+
flush
|
|
1495
|
+
handleStyle="canva"
|
|
1496
|
+
handlesVisible={true}
|
|
1497
|
+
raiseOnSelect={false}
|
|
1498
|
+
stackIndex={999999}
|
|
1499
|
+
draggable={false}
|
|
1500
|
+
resizable={true}
|
|
1501
|
+
rect={selectionFrame}
|
|
1502
|
+
minW={16}
|
|
1503
|
+
minH={16}
|
|
1504
|
+
class="pointer-events-none bg-transparent"
|
|
1505
|
+
onchange={handleSelectionRect}
|
|
1506
|
+
oninteract={handleSelectionInteract}
|
|
1507
|
+
/>
|
|
1508
|
+
</div>
|
|
1509
|
+
{/if}
|
|
1466
1510
|
{/if}
|
|
1467
|
-
{/if}
|
|
1468
1511
|
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
<div
|
|
1496
|
-
class="bottom-0 right-0 top-0 w-2.5 rounded-r-md bg-black/[0.04] dark:bg-white/[0.06] pointer-events-auto absolute"
|
|
1497
|
-
style:margin-bottom={hScroll ? '10px' : '0'}
|
|
1498
|
-
onpointerdown={(e) =>
|
|
1499
|
-
jumpScrollTrack(box.id, 'y', chrome, vScroll, hScroll, e)}
|
|
1500
|
-
>
|
|
1512
|
+
<!-- ScrollBox chrome above nested layer content -->
|
|
1513
|
+
{#each displayLayers.filter((l) => l.kind === 'scrollBox') as box (box.id + ':scroll')}
|
|
1514
|
+
{#if effectivelyVisible.has(box.id)}
|
|
1515
|
+
{@const boxRect = paintAbsMap.get(box.id) ?? box.rect}
|
|
1516
|
+
{@const scrollOver = scrollBoxOverflow(box.id, displayLayers, absMap)}
|
|
1517
|
+
{@const scrollOff = scrollOffsets.get(box.id) ?? { x: 0, y: 0 }}
|
|
1518
|
+
{@const chrome = {
|
|
1519
|
+
x: scrollOff.x,
|
|
1520
|
+
y: scrollOff.y,
|
|
1521
|
+
maxX: scrollOver.maxX,
|
|
1522
|
+
maxY: scrollOver.maxY
|
|
1523
|
+
}}
|
|
1524
|
+
{@const vScroll =
|
|
1525
|
+
chrome.maxY > 0 ? scrollBarMetrics(boxRect.h, chrome.maxY, chrome.y) : null}
|
|
1526
|
+
{@const hScroll =
|
|
1527
|
+
chrome.maxX > 0 ? scrollBarMetrics(boxRect.w, chrome.maxX, chrome.x) : null}
|
|
1528
|
+
{#if vScroll || hScroll}
|
|
1529
|
+
<div
|
|
1530
|
+
class="pointer-events-none absolute z-[999990]"
|
|
1531
|
+
style:left="{boxRect.x}px"
|
|
1532
|
+
style:top="{boxRect.y}px"
|
|
1533
|
+
style:width="{boxRect.w}px"
|
|
1534
|
+
style:height="{boxRect.h}px"
|
|
1535
|
+
>
|
|
1536
|
+
{#if vScroll}
|
|
1537
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1501
1538
|
<div
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
style:top="{vScroll.offset}px"
|
|
1505
|
-
style:height="{vScroll.thumb}px"
|
|
1539
|
+
class="bottom-0 right-0 top-0 w-2.5 rounded-r-md bg-black/[0.04] dark:bg-white/[0.06] pointer-events-auto absolute"
|
|
1540
|
+
style:margin-bottom={hScroll ? '10px' : '0'}
|
|
1506
1541
|
onpointerdown={(e) =>
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1542
|
+
jumpScrollTrack(box.id, 'y', chrome, vScroll, hScroll, e)}
|
|
1543
|
+
>
|
|
1544
|
+
<div
|
|
1545
|
+
data-scroll-thumb="y"
|
|
1546
|
+
class="left-0.5 right-0.5 bg-slate-400/75 shadow-sm dark:bg-slate-500/85 absolute cursor-grab rounded-full active:cursor-grabbing"
|
|
1547
|
+
style:top="{vScroll.offset}px"
|
|
1548
|
+
style:height="{vScroll.thumb}px"
|
|
1549
|
+
onpointerdown={(e) =>
|
|
1550
|
+
beginScrollThumbDrag(box.id, 'y', chrome, vScroll, hScroll, e)}
|
|
1551
|
+
></div>
|
|
1552
|
+
</div>
|
|
1553
|
+
{/if}
|
|
1554
|
+
{#if hScroll}
|
|
1555
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1519
1556
|
<div
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
style:left="{hScroll.offset}px"
|
|
1523
|
-
style:width="{hScroll.thumb}px"
|
|
1557
|
+
class="bottom-0 left-0 h-2.5 rounded-b-md bg-black/[0.04] dark:bg-white/[0.06] pointer-events-auto absolute"
|
|
1558
|
+
style:right={vScroll ? '10px' : '0'}
|
|
1524
1559
|
onpointerdown={(e) =>
|
|
1525
|
-
|
|
1560
|
+
jumpScrollTrack(box.id, 'x', chrome, vScroll, hScroll, e)}
|
|
1561
|
+
>
|
|
1562
|
+
<div
|
|
1563
|
+
data-scroll-thumb="x"
|
|
1564
|
+
class="top-0.5 bottom-0.5 bg-slate-400/75 shadow-sm dark:bg-slate-500/85 absolute cursor-grab rounded-full active:cursor-grabbing"
|
|
1565
|
+
style:left="{hScroll.offset}px"
|
|
1566
|
+
style:width="{hScroll.thumb}px"
|
|
1567
|
+
onpointerdown={(e) =>
|
|
1568
|
+
beginScrollThumbDrag(box.id, 'x', chrome, vScroll, hScroll, e)}
|
|
1569
|
+
></div>
|
|
1570
|
+
</div>
|
|
1571
|
+
{/if}
|
|
1572
|
+
{#if vScroll && hScroll}
|
|
1573
|
+
<div
|
|
1574
|
+
class="bottom-0 right-0 h-2.5 w-2.5 rounded-br-md bg-black/[0.06] dark:bg-white/[0.08] absolute"
|
|
1575
|
+
aria-hidden="true"
|
|
1526
1576
|
></div>
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
<div
|
|
1531
|
-
class="bottom-0 right-0 h-2.5 w-2.5 rounded-br-md bg-black/[0.06] dark:bg-white/[0.08] absolute"
|
|
1532
|
-
aria-hidden="true"
|
|
1533
|
-
></div>
|
|
1534
|
-
{/if}
|
|
1535
|
-
</div>
|
|
1577
|
+
{/if}
|
|
1578
|
+
</div>
|
|
1579
|
+
{/if}
|
|
1536
1580
|
{/if}
|
|
1537
|
-
{/
|
|
1538
|
-
|
|
1581
|
+
{/each}
|
|
1582
|
+
</div>
|
|
1539
1583
|
</div>
|
|
1540
1584
|
</div>
|
|
1541
1585
|
</div>
|
|
@@ -1545,25 +1589,32 @@
|
|
|
1545
1589
|
</div>
|
|
1546
1590
|
</div>
|
|
1547
1591
|
|
|
1548
|
-
<!-- Guides
|
|
1592
|
+
<!-- Guides stay on the artboard. Rulers stay on the workspace edges. -->
|
|
1549
1593
|
{#if showGuides}
|
|
1594
|
+
{@const originX = RULER_LEFT + tickX(0)}
|
|
1595
|
+
{@const originY = RULER_TOP + tickY(0)}
|
|
1550
1596
|
{#each guides as guide (guide.id)}
|
|
1551
1597
|
{@const locked = guidesLocked || !!guide.locked}
|
|
1552
1598
|
{@const hiding = draggingGuideId === guide.id && guidePreview}
|
|
1553
|
-
{@const screenX = RULER_LEFT + tickX(guide.position)}
|
|
1554
|
-
{@const screenY = RULER_TOP + tickY(guide.position)}
|
|
1555
1599
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1556
1600
|
<div
|
|
1557
1601
|
data-guide={guide.id}
|
|
1558
1602
|
class={[
|
|
1559
1603
|
'absolute z-40',
|
|
1560
1604
|
guide.orientation === 'vertical'
|
|
1561
|
-
? '
|
|
1562
|
-
: '
|
|
1605
|
+
? 'w-2 -translate-x-1/2 cursor-col-resize'
|
|
1606
|
+
: 'h-2 -translate-y-1/2 cursor-row-resize',
|
|
1563
1607
|
locked && 'cursor-default',
|
|
1564
1608
|
hiding && 'opacity-0'
|
|
1565
1609
|
]}
|
|
1566
|
-
style={guide.orientation === 'vertical'
|
|
1610
|
+
style:left={guide.orientation === 'vertical'
|
|
1611
|
+
? `${RULER_LEFT + tickX(guide.position)}px`
|
|
1612
|
+
: `${originX}px`}
|
|
1613
|
+
style:top={guide.orientation === 'horizontal'
|
|
1614
|
+
? `${RULER_TOP + tickY(guide.position)}px`
|
|
1615
|
+
: `${originY}px`}
|
|
1616
|
+
style:width={guide.orientation === 'horizontal' ? `${boardW}px` : undefined}
|
|
1617
|
+
style:height={guide.orientation === 'vertical' ? `${boardH}px` : undefined}
|
|
1567
1618
|
title={locked ? 'Guide locked' : 'Drag to move · Double-click to remove'}
|
|
1568
1619
|
onpointerdown={(e) => beginGuideDrag(guide, e)}
|
|
1569
1620
|
ondblclick={() => removeGuide(guide.id)}
|
|
@@ -1659,9 +1710,15 @@
|
|
|
1659
1710
|
{/each}
|
|
1660
1711
|
{/if}
|
|
1661
1712
|
|
|
1662
|
-
<!-- Full-stage guide preview while dragging (edge to edge) -->
|
|
1663
1713
|
{#if guidePreview}
|
|
1664
|
-
<div
|
|
1714
|
+
<div
|
|
1715
|
+
class="pointer-events-none absolute z-50 overflow-hidden"
|
|
1716
|
+
style:left={`${RULER_LEFT + tickX(0)}px`}
|
|
1717
|
+
style:top={`${RULER_TOP + tickY(0)}px`}
|
|
1718
|
+
style:width={`${boardW}px`}
|
|
1719
|
+
style:height={`${boardH}px`}
|
|
1720
|
+
aria-hidden="true"
|
|
1721
|
+
>
|
|
1665
1722
|
{#if guidePreview.orientation === 'vertical'}
|
|
1666
1723
|
<div
|
|
1667
1724
|
class="top-0 bottom-0 absolute w-px bg-[#00c2ff]"
|