@r2digisolutions/components 0.24.5 → 0.24.7
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/molecules/MediaStage/MediaStage.svelte +118 -28
- package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +9 -2
- package/dist/components/organisms/CommandPalette/CommandPalette.svelte +4 -4
- package/dist/components/organisms/Footer/Footer.svelte +16 -17
- package/dist/utils/canvasDocument.js +2 -2
- package/package.json +4 -4
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
} from '../../../utils/marqueeSelect.js';
|
|
20
20
|
import {
|
|
21
21
|
createCanvasGuide,
|
|
22
|
+
INSTAGRAM_GRID,
|
|
22
23
|
pathPointsToDoc,
|
|
23
24
|
rebakePathLayer,
|
|
24
25
|
snapLayerRect,
|
|
@@ -235,6 +236,26 @@
|
|
|
235
236
|
guides.map((g) => ({ orientation: g.orientation, position: g.position }))
|
|
236
237
|
);
|
|
237
238
|
|
|
239
|
+
/** 3×3 Instagram tiles: the cut lines need to read above the alignment grid. */
|
|
240
|
+
const instagramCuts = $derived(
|
|
241
|
+
doc.width === INSTAGRAM_GRID.width && doc.height === INSTAGRAM_GRID.height
|
|
242
|
+
);
|
|
243
|
+
const instagramCells = $derived.by(() => {
|
|
244
|
+
if (!instagramCuts) return [];
|
|
245
|
+
const cells: { n: number; x: number; y: number }[] = [];
|
|
246
|
+
const total = INSTAGRAM_GRID.rows * INSTAGRAM_GRID.cols;
|
|
247
|
+
for (let row = 0; row < INSTAGRAM_GRID.rows; row++) {
|
|
248
|
+
for (let col = 0; col < INSTAGRAM_GRID.cols; col++) {
|
|
249
|
+
cells.push({
|
|
250
|
+
n: total - (row * INSTAGRAM_GRID.cols + col),
|
|
251
|
+
x: col * INSTAGRAM_GRID.cellWidth,
|
|
252
|
+
y: row * INSTAGRAM_GRID.cellHeight
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return cells;
|
|
257
|
+
});
|
|
258
|
+
|
|
238
259
|
type RulerTick = { pos: number; level: 'major' | 'mid' | 'minor' };
|
|
239
260
|
|
|
240
261
|
/** Nice major step so labels sit ~56–80px apart on screen. */
|
|
@@ -990,7 +1011,6 @@
|
|
|
990
1011
|
|
|
991
1012
|
/** Drag from ruler: live full-stage preview, commit guide on release. */
|
|
992
1013
|
function beginRulerDrag(orientation: CanvasGuideOrientation, e: PointerEvent) {
|
|
993
|
-
if (guidesLocked) return;
|
|
994
1014
|
e.preventDefault();
|
|
995
1015
|
e.stopPropagation();
|
|
996
1016
|
setGuidePreview(orientation, e.clientX, e.clientY);
|
|
@@ -1001,7 +1021,7 @@
|
|
|
1001
1021
|
const onUp = (ev: PointerEvent) => {
|
|
1002
1022
|
const pt = clientToDoc(ev.clientX, ev.clientY);
|
|
1003
1023
|
const pos = clampGuidePos(orientation, orientation === 'vertical' ? pt.x : pt.y);
|
|
1004
|
-
patchGuides([...guides, createCanvasGuide(orientation, pos)]);
|
|
1024
|
+
patchGuides([...guides, createCanvasGuide(orientation, pos)], false);
|
|
1005
1025
|
guidePreview = null;
|
|
1006
1026
|
window.removeEventListener('pointermove', onMove);
|
|
1007
1027
|
window.removeEventListener('pointerup', onUp);
|
|
@@ -1011,7 +1031,8 @@
|
|
|
1011
1031
|
}
|
|
1012
1032
|
|
|
1013
1033
|
function removeGuide(id: string) {
|
|
1014
|
-
|
|
1034
|
+
const guide = guides.find((g) => g.id === id);
|
|
1035
|
+
if (!guide || guidesLocked || guide.locked) return;
|
|
1015
1036
|
patchGuides(guides.filter((g) => g.id !== id));
|
|
1016
1037
|
}
|
|
1017
1038
|
|
|
@@ -1587,8 +1608,6 @@
|
|
|
1587
1608
|
|
|
1588
1609
|
<!-- Guides stay on the artboard. Rulers stay on the workspace edges. -->
|
|
1589
1610
|
{#if showGuides}
|
|
1590
|
-
{@const originX = RULER_LEFT + tickX(0)}
|
|
1591
|
-
{@const originY = RULER_TOP + tickY(0)}
|
|
1592
1611
|
{#each guides as guide (guide.id)}
|
|
1593
1612
|
{@const locked = guidesLocked || !!guide.locked}
|
|
1594
1613
|
{@const hiding = draggingGuideId === guide.id && guidePreview}
|
|
@@ -1606,29 +1625,78 @@
|
|
|
1606
1625
|
style:z-index="2100000"
|
|
1607
1626
|
style:left={guide.orientation === 'vertical'
|
|
1608
1627
|
? `${RULER_LEFT + tickX(guide.position)}px`
|
|
1609
|
-
:
|
|
1628
|
+
: '0px'}
|
|
1610
1629
|
style:top={guide.orientation === 'horizontal'
|
|
1611
1630
|
? `${RULER_TOP + tickY(guide.position)}px`
|
|
1612
|
-
:
|
|
1613
|
-
style:width={guide.orientation === 'horizontal'
|
|
1614
|
-
|
|
1631
|
+
: '0px'}
|
|
1632
|
+
style:width={guide.orientation === 'horizontal'
|
|
1633
|
+
? `${RULER_LEFT + tickX(0) + boardW}px`
|
|
1634
|
+
: undefined}
|
|
1635
|
+
style:height={guide.orientation === 'vertical'
|
|
1636
|
+
? `${RULER_TOP + tickY(0) + boardH}px`
|
|
1637
|
+
: undefined}
|
|
1615
1638
|
title={locked ? 'Guide locked' : 'Drag to move · Double-click to remove'}
|
|
1616
1639
|
onpointerdown={(e) => beginGuideDrag(guide, e)}
|
|
1617
1640
|
ondblclick={() => removeGuide(guide.id)}
|
|
1618
1641
|
>
|
|
1642
|
+
<span
|
|
1643
|
+
class="pointer-events-none absolute left-1/2 w-px -translate-x-1/2 bg-white"
|
|
1644
|
+
style:top="0px"
|
|
1645
|
+
style:height="{Math.max(0, RULER_TOP + tickY(0))}px"
|
|
1646
|
+
style:display={guide.orientation === 'vertical' ? undefined : 'none'}
|
|
1647
|
+
aria-hidden="true"
|
|
1648
|
+
></span>
|
|
1649
|
+
<span
|
|
1650
|
+
class="pointer-events-none absolute top-1/2 h-px w-full -translate-y-1/2 bg-white"
|
|
1651
|
+
style:left="0px"
|
|
1652
|
+
style:width={guide.orientation === 'horizontal'
|
|
1653
|
+
? `${Math.max(0, RULER_LEFT + tickX(0))}px`
|
|
1654
|
+
: undefined}
|
|
1655
|
+
style:display={guide.orientation === 'horizontal' ? undefined : 'none'}
|
|
1656
|
+
aria-hidden="true"
|
|
1657
|
+
></span>
|
|
1619
1658
|
<span
|
|
1620
1659
|
class={[
|
|
1621
|
-
'pointer-events-none absolute bg-
|
|
1660
|
+
'pointer-events-none absolute bg-neutral-950',
|
|
1622
1661
|
guide.orientation === 'vertical'
|
|
1623
|
-
? '
|
|
1624
|
-
: '
|
|
1625
|
-
locked && 'opacity-60'
|
|
1662
|
+
? 'left-1/2 w-px -translate-x-1/2'
|
|
1663
|
+
: 'h-px -translate-y-1/2'
|
|
1626
1664
|
]}
|
|
1627
|
-
style:
|
|
1665
|
+
style:top={guide.orientation === 'vertical'
|
|
1666
|
+
? `${Math.max(0, RULER_TOP + tickY(0))}px`
|
|
1667
|
+
: '50%'}
|
|
1668
|
+
style:left={guide.orientation === 'horizontal'
|
|
1669
|
+
? `${Math.max(0, RULER_LEFT + tickX(0))}px`
|
|
1670
|
+
: undefined}
|
|
1671
|
+
style:height={guide.orientation === 'vertical' ? `${boardH}px` : undefined}
|
|
1672
|
+
style:width={guide.orientation === 'horizontal' ? `${boardW}px` : undefined}
|
|
1628
1673
|
aria-hidden="true"
|
|
1629
1674
|
></span>
|
|
1675
|
+
<span
|
|
1676
|
+
class="pointer-events-none absolute rounded bg-white px-1 py-px text-[10px] leading-none font-medium text-neutral-950"
|
|
1677
|
+
style:left={guide.orientation === 'vertical'
|
|
1678
|
+
? '10px'
|
|
1679
|
+
: `${Math.max(0, RULER_LEFT + tickX(0)) + 6}px`}
|
|
1680
|
+
style:top={guide.orientation === 'vertical'
|
|
1681
|
+
? `${Math.max(0, RULER_TOP + tickY(0)) + 6}px`
|
|
1682
|
+
: '10px'}
|
|
1683
|
+
>
|
|
1684
|
+
{Math.round(guide.position)}
|
|
1685
|
+
</span>
|
|
1630
1686
|
</div>
|
|
1631
1687
|
{/each}
|
|
1688
|
+
{#if instagramCuts}
|
|
1689
|
+
{#each instagramCells as cell (cell.n)}
|
|
1690
|
+
<span
|
|
1691
|
+
class="pointer-events-none absolute z-[2100001] text-[11px] font-medium leading-none text-white"
|
|
1692
|
+
style:left="{RULER_LEFT + tickX(cell.x) + 6}px"
|
|
1693
|
+
style:top="{RULER_TOP + tickY(cell.y) + 6}px"
|
|
1694
|
+
style:text-shadow="0 0 2px #000, 0 1px 2px #000"
|
|
1695
|
+
>
|
|
1696
|
+
{cell.n}
|
|
1697
|
+
</span>
|
|
1698
|
+
{/each}
|
|
1699
|
+
{/if}
|
|
1632
1700
|
{/if}
|
|
1633
1701
|
|
|
1634
1702
|
<!-- Pen draft preview -->
|
|
@@ -1708,26 +1776,48 @@
|
|
|
1708
1776
|
{/if}
|
|
1709
1777
|
|
|
1710
1778
|
{#if guidePreview}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
style:width={`${boardW}px`}
|
|
1716
|
-
style:height={`${boardH}px`}
|
|
1717
|
-
aria-hidden="true"
|
|
1718
|
-
>
|
|
1779
|
+
{@const previewPos = Math.round(
|
|
1780
|
+
(guidePreview.orientation === 'vertical' ? guidePreview.x : guidePreview.y) / scale
|
|
1781
|
+
)}
|
|
1782
|
+
<div class="pointer-events-none absolute inset-0 z-50 overflow-hidden" aria-hidden="true">
|
|
1719
1783
|
{#if guidePreview.orientation === 'vertical'}
|
|
1720
1784
|
<div
|
|
1721
|
-
class="top-0
|
|
1722
|
-
style:left={`${guidePreview.x}px`}
|
|
1723
|
-
style:
|
|
1785
|
+
class="absolute top-0 w-px bg-white"
|
|
1786
|
+
style:left={`${RULER_LEFT + tickX(0) + guidePreview.x}px`}
|
|
1787
|
+
style:height={`${Math.max(0, RULER_TOP + tickY(0))}px`}
|
|
1788
|
+
></div>
|
|
1789
|
+
<div
|
|
1790
|
+
class="absolute w-px bg-neutral-950"
|
|
1791
|
+
style:left={`${RULER_LEFT + tickX(0) + guidePreview.x}px`}
|
|
1792
|
+
style:top={`${Math.max(0, RULER_TOP + tickY(0))}px`}
|
|
1793
|
+
style:height={`${boardH}px`}
|
|
1724
1794
|
></div>
|
|
1795
|
+
<span
|
|
1796
|
+
class="absolute rounded bg-white px-1 py-px text-[10px] leading-none font-medium text-neutral-950"
|
|
1797
|
+
style:left={`${RULER_LEFT + tickX(0) + guidePreview.x + 10}px`}
|
|
1798
|
+
style:top={`${Math.max(0, RULER_TOP + tickY(0)) + 6}px`}
|
|
1799
|
+
>
|
|
1800
|
+
{previewPos}
|
|
1801
|
+
</span>
|
|
1725
1802
|
{:else}
|
|
1726
1803
|
<div
|
|
1727
|
-
class="left-0
|
|
1728
|
-
style:top={`${guidePreview.y}px`}
|
|
1729
|
-
style:
|
|
1804
|
+
class="absolute left-0 h-px bg-white"
|
|
1805
|
+
style:top={`${RULER_TOP + tickY(0) + guidePreview.y}px`}
|
|
1806
|
+
style:width={`${Math.max(0, RULER_LEFT + tickX(0))}px`}
|
|
1807
|
+
></div>
|
|
1808
|
+
<div
|
|
1809
|
+
class="absolute h-px bg-neutral-950"
|
|
1810
|
+
style:top={`${RULER_TOP + tickY(0) + guidePreview.y}px`}
|
|
1811
|
+
style:left={`${Math.max(0, RULER_LEFT + tickX(0))}px`}
|
|
1812
|
+
style:width={`${boardW}px`}
|
|
1730
1813
|
></div>
|
|
1814
|
+
<span
|
|
1815
|
+
class="absolute rounded bg-white px-1 py-px text-[10px] leading-none font-medium text-neutral-950"
|
|
1816
|
+
style:left={`${Math.max(0, RULER_LEFT + tickX(0)) + 6}px`}
|
|
1817
|
+
style:top={`${RULER_TOP + tickY(0) + guidePreview.y + 10}px`}
|
|
1818
|
+
>
|
|
1819
|
+
{previewPos}
|
|
1820
|
+
</span>
|
|
1731
1821
|
{/if}
|
|
1732
1822
|
</div>
|
|
1733
1823
|
{/if}
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
defaultSlotFromRect,
|
|
36
36
|
documentWithPages,
|
|
37
37
|
emptyCanvasDocument,
|
|
38
|
+
INSTAGRAM_GRID,
|
|
38
39
|
instagramGridGuides,
|
|
39
40
|
migrateCanvasDocument,
|
|
40
41
|
pagesOf,
|
|
@@ -644,7 +645,13 @@
|
|
|
644
645
|
}
|
|
645
646
|
|
|
646
647
|
function addPage() {
|
|
647
|
-
const
|
|
648
|
+
const instagram =
|
|
649
|
+
value.width === INSTAGRAM_GRID.width && value.height === INSTAGRAM_GRID.height;
|
|
650
|
+
const page = blankCanvasPage({
|
|
651
|
+
name: `Hoja ${designPages.length + 1}`,
|
|
652
|
+
background: '#ffffff',
|
|
653
|
+
guides: instagram ? instagramGridGuides() : []
|
|
654
|
+
});
|
|
648
655
|
showPage(page.id, [...designPages, page]);
|
|
649
656
|
}
|
|
650
657
|
|
|
@@ -929,7 +936,7 @@
|
|
|
929
936
|
width: preset.width,
|
|
930
937
|
height: preset.height,
|
|
931
938
|
guides: instagramGridGuides(),
|
|
932
|
-
guidesLocked:
|
|
939
|
+
guidesLocked: false
|
|
933
940
|
});
|
|
934
941
|
zoom = 0.25;
|
|
935
942
|
return;
|
|
@@ -305,8 +305,8 @@
|
|
|
305
305
|
class={[
|
|
306
306
|
'gap-3 rounded-xl px-3 py-2 text-sm flex w-full items-center justify-between text-left transition-colors',
|
|
307
307
|
active
|
|
308
|
-
? 'bg-
|
|
309
|
-
: 'text-primary hover:bg-
|
|
308
|
+
? 'bg-neutral-200 text-neutral-950 dark:bg-neutral-800 dark:text-neutral-50'
|
|
309
|
+
: 'text-primary hover:bg-neutral-100 dark:hover:bg-neutral-800',
|
|
310
310
|
item.disabled && 'cursor-not-allowed opacity-40'
|
|
311
311
|
]}
|
|
312
312
|
>
|
|
@@ -316,8 +316,8 @@
|
|
|
316
316
|
class={[
|
|
317
317
|
'h-8 w-8 rounded-lg flex shrink-0 items-center justify-center',
|
|
318
318
|
active
|
|
319
|
-
? 'bg-
|
|
320
|
-
: 'bg-
|
|
319
|
+
? 'bg-neutral-300 text-neutral-950 dark:bg-neutral-700 dark:text-neutral-50'
|
|
320
|
+
: 'bg-neutral-100 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300'
|
|
321
321
|
]}
|
|
322
322
|
aria-hidden="true"
|
|
323
323
|
>
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
variant === 'compact' ? 'py-6' : variant === 'mega' ? 'py-12' : 'py-10'
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
-
const maxW = $derived(variant === 'mega' ? 'max-w-
|
|
79
|
+
const maxW = $derived(variant === 'mega' ? 'max-w-screen-2xl' : 'max-w-6xl');
|
|
80
80
|
|
|
81
81
|
function handleLink(link: FooterLink, event: MouseEvent) {
|
|
82
82
|
link.onclick?.(event);
|
|
@@ -330,22 +330,21 @@
|
|
|
330
330
|
</div>
|
|
331
331
|
</div>
|
|
332
332
|
|
|
333
|
-
<div
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
{
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
{/if}
|
|
333
|
+
<div class={['mx-auto w-full px-4 sm:px-6', maxW]}>
|
|
334
|
+
<div
|
|
335
|
+
class="flex w-full flex-col gap-2 border-t border-border py-4 text-xs text-muted sm:flex-row sm:items-center sm:justify-between"
|
|
336
|
+
>
|
|
337
|
+
<span>{resolvedCopyright}</span>
|
|
338
|
+
<div class="flex flex-wrap items-center gap-x-4 gap-y-1">
|
|
339
|
+
{#if bottomLinks.length}
|
|
340
|
+
{#each bottomLinks as link (link.id)}
|
|
341
|
+
{@render linkItem(link, 'transition-colors hover:text-primary')}
|
|
342
|
+
{/each}
|
|
343
|
+
{/if}
|
|
344
|
+
{#if legal}
|
|
345
|
+
{@render legal()}
|
|
346
|
+
{/if}
|
|
347
|
+
</div>
|
|
349
348
|
</div>
|
|
350
349
|
</div>
|
|
351
350
|
{/if}
|
|
@@ -638,9 +638,9 @@ export function emptyInstagramGridDocument() {
|
|
|
638
638
|
return emptyCanvasDocument({
|
|
639
639
|
width: INSTAGRAM_GRID.width,
|
|
640
640
|
height: INSTAGRAM_GRID.height,
|
|
641
|
-
background: '#
|
|
641
|
+
background: '#ffffff',
|
|
642
642
|
guides: instagramGridGuides(),
|
|
643
|
-
guidesLocked:
|
|
643
|
+
guidesLocked: false
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
646
|
export function presetIdForSize(width, height) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r2digisolutions/components",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@eslint/js": "^10.0.1",
|
|
69
|
-
"@lucide/svelte": "^1.
|
|
69
|
+
"@lucide/svelte": "^1.48.0",
|
|
70
70
|
"@playwright/test": "^1.63.0",
|
|
71
71
|
"@storybook/addon-a11y": "^10.6.0",
|
|
72
72
|
"@storybook/addon-docs": "^10.6.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"tailwindcss": "^4.3.3",
|
|
101
101
|
"typescript": "6.0.3",
|
|
102
102
|
"typescript-eslint": "^8.70.1",
|
|
103
|
-
"vite": "^8.3.
|
|
103
|
+
"vite": "^8.3.1",
|
|
104
104
|
"vitest": "^5.0.1",
|
|
105
105
|
"vitest-browser-svelte": "^3.1.0"
|
|
106
106
|
},
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"atomic-design"
|
|
114
114
|
],
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@xyflow/svelte": "^1.
|
|
116
|
+
"@xyflow/svelte": "^1.7.0",
|
|
117
117
|
"leaflet": "^1.9.4",
|
|
118
118
|
"leaflet.markercluster": "^1.5.3"
|
|
119
119
|
}
|