@r2digisolutions/components 0.24.3 → 0.24.4
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/MediaLayerItem/MediaLayerItem.svelte +1 -0
- package/dist/components/molecules/MediaStage/MediaStage.svelte +18 -15
- package/dist/components/molecules/WidgetFrame/WidgetFrame.svelte +25 -6
- package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +31 -8
- package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte.d.ts +9 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/canvasDocument.d.ts +19 -0
- package/dist/utils/canvasDocument.js +37 -0
- package/package.json +1 -1
|
@@ -335,6 +335,7 @@
|
|
|
335
335
|
flush
|
|
336
336
|
clipContent={layer.kind === 'text' || layer.kind === 'sticky' ? !textAuto : true}
|
|
337
337
|
handleStyle="canva"
|
|
338
|
+
snapMode="live"
|
|
338
339
|
hugContent={textAuto}
|
|
339
340
|
hugMaxWidth={layer.textMaxWidth ?? 0}
|
|
340
341
|
resizeEdges={textAuto ? [...TEXT_RESIZE_EDGES] : undefined}
|
|
@@ -332,14 +332,15 @@
|
|
|
332
332
|
const gridOverlayStyle = $derived.by(() => {
|
|
333
333
|
const cell = Math.max(4, cellSize);
|
|
334
334
|
const major = cell * 5;
|
|
335
|
-
const
|
|
336
|
-
const
|
|
335
|
+
const line = 1 / Math.max(0.05, scale);
|
|
336
|
+
const fine = 'color-mix(in oklab, #0f172a 28%, transparent)';
|
|
337
|
+
const bold = 'color-mix(in oklab, #0f172a 48%, transparent)';
|
|
337
338
|
return [
|
|
338
339
|
`background-image:`,
|
|
339
|
-
`linear-gradient(to right, ${fine}
|
|
340
|
-
`linear-gradient(to bottom, ${fine}
|
|
341
|
-
`linear-gradient(to right, ${bold}
|
|
342
|
-
`linear-gradient(to bottom, ${bold}
|
|
340
|
+
`linear-gradient(to right, ${fine} ${line}px, transparent ${line}px),`,
|
|
341
|
+
`linear-gradient(to bottom, ${fine} ${line}px, transparent ${line}px),`,
|
|
342
|
+
`linear-gradient(to right, ${bold} ${line}px, transparent ${line}px),`,
|
|
343
|
+
`linear-gradient(to bottom, ${bold} ${line}px, transparent ${line}px);`,
|
|
343
344
|
`background-size:${cell}px ${cell}px, ${cell}px ${cell}px, ${major}px ${major}px, ${major}px ${major}px;`
|
|
344
345
|
].join('');
|
|
345
346
|
});
|
|
@@ -1358,14 +1359,6 @@
|
|
|
1358
1359
|
<div class="inset-0 absolute" style:background-color={doc.background}></div>
|
|
1359
1360
|
</div>
|
|
1360
1361
|
|
|
1361
|
-
{#if showGrid}
|
|
1362
|
-
<div
|
|
1363
|
-
class="inset-0 pointer-events-none absolute z-100 overflow-hidden"
|
|
1364
|
-
style={gridOverlayStyle}
|
|
1365
|
-
aria-hidden="true"
|
|
1366
|
-
></div>
|
|
1367
|
-
{/if}
|
|
1368
|
-
|
|
1369
1362
|
<div class={['inset-0 absolute overflow-visible', drawMode && 'pointer-events-none']}>
|
|
1370
1363
|
{#each sorted as layer, paintIndex (layer.id)}
|
|
1371
1364
|
{#if effectivelyVisible.has(layer.id)}
|
|
@@ -1493,6 +1486,7 @@
|
|
|
1493
1486
|
showChrome={false}
|
|
1494
1487
|
flush
|
|
1495
1488
|
handleStyle="canva"
|
|
1489
|
+
snapMode="live"
|
|
1496
1490
|
handlesVisible={true}
|
|
1497
1491
|
raiseOnSelect={false}
|
|
1498
1492
|
stackIndex={999999}
|
|
@@ -1580,6 +1574,14 @@
|
|
|
1580
1574
|
{/if}
|
|
1581
1575
|
{/each}
|
|
1582
1576
|
</div>
|
|
1577
|
+
{#if showGrid}
|
|
1578
|
+
<div
|
|
1579
|
+
class="pointer-events-none absolute inset-0 overflow-hidden"
|
|
1580
|
+
style:z-index="2000000"
|
|
1581
|
+
style={gridOverlayStyle}
|
|
1582
|
+
aria-hidden="true"
|
|
1583
|
+
></div>
|
|
1584
|
+
{/if}
|
|
1583
1585
|
</div>
|
|
1584
1586
|
</div>
|
|
1585
1587
|
</div>
|
|
@@ -1600,13 +1602,14 @@
|
|
|
1600
1602
|
<div
|
|
1601
1603
|
data-guide={guide.id}
|
|
1602
1604
|
class={[
|
|
1603
|
-
'absolute
|
|
1605
|
+
'absolute',
|
|
1604
1606
|
guide.orientation === 'vertical'
|
|
1605
1607
|
? 'w-2 -translate-x-1/2 cursor-col-resize'
|
|
1606
1608
|
: 'h-2 -translate-y-1/2 cursor-row-resize',
|
|
1607
1609
|
locked && 'cursor-default',
|
|
1608
1610
|
hiding && 'opacity-0'
|
|
1609
1611
|
]}
|
|
1612
|
+
style:z-index="2100000"
|
|
1610
1613
|
style:left={guide.orientation === 'vertical'
|
|
1611
1614
|
? `${RULER_LEFT + tickX(guide.position)}px`
|
|
1612
1615
|
: `${originX}px`}
|
|
@@ -161,6 +161,8 @@
|
|
|
161
161
|
}: WidgetFrameProps = $props();
|
|
162
162
|
|
|
163
163
|
const canvas = getContext<WidgetCanvasContext | undefined>(WIDGET_CANVAS_CONTEXT);
|
|
164
|
+
/** Document pixels per screen pixel, so chrome stays the same size when the artboard is zoomed. */
|
|
165
|
+
const ui = $derived(1 / Math.max(0.05, canvas?.scale || 1));
|
|
164
166
|
|
|
165
167
|
let mode = $state<'move' | 'resize' | null>(null);
|
|
166
168
|
let rotating = $state(false);
|
|
@@ -647,7 +649,7 @@
|
|
|
647
649
|
!isCanva && showChrome && 'rounded-xl border-border bg-surface-elevated overflow-hidden border',
|
|
648
650
|
!isCanva && !showChrome && 'bg-transparent',
|
|
649
651
|
isCanva && 'bg-transparent',
|
|
650
|
-
canvaBorder && 'outline outline-
|
|
652
|
+
canvaBorder && 'outline outline-[#3b82f6]',
|
|
651
653
|
freeform ? 'shadow-md absolute' : 'relative',
|
|
652
654
|
isCanva && 'shadow-none',
|
|
653
655
|
mode === 'move' && 'cursor-grabbing opacity-95',
|
|
@@ -656,6 +658,7 @@
|
|
|
656
658
|
frameClassName
|
|
657
659
|
]}
|
|
658
660
|
style={rootStyle}
|
|
661
|
+
style:outline-width={canvaBorder ? `${2 * ui}px` : undefined}
|
|
659
662
|
onpointerdown={(e) => {
|
|
660
663
|
bringToFront();
|
|
661
664
|
if (!showChrome && freeform && draggable && e.button === 0) {
|
|
@@ -814,14 +817,21 @@
|
|
|
814
817
|
|
|
815
818
|
{#if isCanva && mode === 'resize'}
|
|
816
819
|
<div
|
|
817
|
-
class="rounded-md bg-neutral-900
|
|
820
|
+
class="rounded-md bg-neutral-900 font-medium text-white top-0 shadow-md pointer-events-none absolute left-1/2 z-30 whitespace-nowrap"
|
|
821
|
+
style:padding="{4 * ui}px {8 * ui}px"
|
|
822
|
+
style:font-size="{11 * ui}px"
|
|
823
|
+
style:transform="translate(-50%, calc(-100% - {8 * ui}px))"
|
|
818
824
|
>
|
|
819
825
|
{Math.round(rect.w)} × {Math.round(hugContent && hugLiveH > 0 ? hugLiveH : rect.h)}
|
|
820
826
|
</div>
|
|
821
827
|
{/if}
|
|
822
828
|
{#if isCanva && rotating}
|
|
823
829
|
<div
|
|
824
|
-
class="rounded-md bg-neutral-900
|
|
830
|
+
class="rounded-md bg-neutral-900 font-medium text-white shadow-md pointer-events-none absolute top-full left-1/2 z-30 whitespace-nowrap"
|
|
831
|
+
style:margin-top="{32 * ui}px"
|
|
832
|
+
style:padding="{4 * ui}px {8 * ui}px"
|
|
833
|
+
style:font-size="{11 * ui}px"
|
|
834
|
+
style:transform="translateX(-50%)"
|
|
825
835
|
>
|
|
826
836
|
{Math.round(rotation)}°
|
|
827
837
|
</div>
|
|
@@ -832,6 +842,9 @@
|
|
|
832
842
|
<div
|
|
833
843
|
data-resize-handle
|
|
834
844
|
class={[edgeAccent, h.class]}
|
|
845
|
+
style:width={isCanva ? `${12 * ui}px` : undefined}
|
|
846
|
+
style:height={isCanva ? `${12 * ui}px` : undefined}
|
|
847
|
+
style:border-width={isCanva ? `${2 * ui}px` : undefined}
|
|
835
848
|
role="separator"
|
|
836
849
|
aria-orientation={h.edge === 'e' || h.edge === 'w' ? 'vertical' : 'horizontal'}
|
|
837
850
|
aria-label={`Resize ${title ?? 'widget'} (${h.edge})`}
|
|
@@ -841,13 +854,19 @@
|
|
|
841
854
|
|
|
842
855
|
{#if isCanva && onrotation}
|
|
843
856
|
<div
|
|
844
|
-
class="
|
|
857
|
+
class="pointer-events-none absolute top-full left-1/2 z-20 -translate-x-1/2 bg-[#3b82f6]"
|
|
858
|
+
style:width="{Math.max(1, ui)}px"
|
|
859
|
+
style:height="{12 * ui}px"
|
|
845
860
|
></div>
|
|
846
861
|
<div
|
|
847
862
|
class={[
|
|
848
863
|
edgeAccent,
|
|
849
|
-
'
|
|
864
|
+
'top-full left-1/2 z-20 flex -translate-x-1/2 cursor-grab items-center justify-center active:cursor-grabbing'
|
|
850
865
|
]}
|
|
866
|
+
style:width="{24 * ui}px"
|
|
867
|
+
style:height="{24 * ui}px"
|
|
868
|
+
style:margin-top="{12 * ui}px"
|
|
869
|
+
style:border-width="{2 * ui}px"
|
|
851
870
|
role="slider"
|
|
852
871
|
tabindex="0"
|
|
853
872
|
aria-label="Rotar"
|
|
@@ -870,7 +889,7 @@
|
|
|
870
889
|
}
|
|
871
890
|
}}
|
|
872
891
|
>
|
|
873
|
-
<RotateCw class="
|
|
892
|
+
<RotateCw width={12 * ui} height={12 * ui} class="text-[#3b82f6]" />
|
|
874
893
|
</div>
|
|
875
894
|
{/if}
|
|
876
895
|
{#if !isCanva}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
} from '../../molecules/DropdownMenu/DropdownMenu.svelte';
|
|
23
23
|
import {
|
|
24
24
|
CANVAS_PRESETS,
|
|
25
|
+
INSTAGRAM_GRID_PRESET_ID,
|
|
25
26
|
alignLayerRect,
|
|
26
27
|
applyTextAutoSize,
|
|
27
28
|
createCanvasGuide,
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
createPathFromDocPoints,
|
|
30
31
|
defaultSlotFromRect,
|
|
31
32
|
emptyCanvasDocument,
|
|
33
|
+
instagramGridGuides,
|
|
32
34
|
migrateCanvasDocument,
|
|
33
35
|
presetIdForSize,
|
|
34
36
|
type CanvasAlign,
|
|
@@ -135,6 +137,14 @@
|
|
|
135
137
|
* `edit` is the full canvas: panels, menu and component search.
|
|
136
138
|
*/
|
|
137
139
|
mode?: 'edit' | 'frame';
|
|
140
|
+
/** Hide the built-in menu when the host already has one. */
|
|
141
|
+
showMenu?: boolean;
|
|
142
|
+
showGrid?: boolean;
|
|
143
|
+
showGuides?: boolean;
|
|
144
|
+
snap?: boolean;
|
|
145
|
+
showSidebar?: boolean;
|
|
146
|
+
showInspector?: boolean;
|
|
147
|
+
stageFrame?: 'edit' | 'desktop' | 'tablet' | 'mobile';
|
|
138
148
|
class?: string;
|
|
139
149
|
onchange?: (doc: CanvasDocument) => void;
|
|
140
150
|
onassetschange?: (assets: MediaAsset[]) => void;
|
|
@@ -150,6 +160,13 @@
|
|
|
150
160
|
assets = $bindable<MediaAsset[]>([]),
|
|
151
161
|
zoom = $bindable(1),
|
|
152
162
|
mode = 'edit',
|
|
163
|
+
showMenu = true,
|
|
164
|
+
showGrid = $bindable(false),
|
|
165
|
+
showGuides = $bindable(true),
|
|
166
|
+
snap = $bindable(true),
|
|
167
|
+
showSidebar = $bindable(true),
|
|
168
|
+
showInspector = $bindable(true),
|
|
169
|
+
stageFrame = $bindable<'edit' | 'desktop' | 'tablet' | 'mobile'>('edit'),
|
|
153
170
|
class: className = '',
|
|
154
171
|
onchange,
|
|
155
172
|
onassetschange,
|
|
@@ -166,14 +183,8 @@
|
|
|
166
183
|
let selectedIds = $state<string[]>([]);
|
|
167
184
|
let editingTextId = $state<string | null>(null);
|
|
168
185
|
let frameBoot = false;
|
|
169
|
-
let showSidebar = $state(true);
|
|
170
|
-
let showInspector = $state(true);
|
|
171
186
|
let assetsSize = $state(58);
|
|
172
187
|
let sidebarTab = $state<'elements' | 'uploads' | 'widgets'>('elements');
|
|
173
|
-
let showGrid = $state(false);
|
|
174
|
-
let stageFrame = $state<'edit' | 'desktop' | 'tablet' | 'mobile'>('edit');
|
|
175
|
-
let showGuides = $state(true);
|
|
176
|
-
let snap = $state(true);
|
|
177
188
|
let cellSize = $state(8);
|
|
178
189
|
let drawMode = $state(false);
|
|
179
190
|
let ctxOpen = $state(false);
|
|
@@ -731,6 +742,17 @@
|
|
|
731
742
|
if (editingWidgetId) return;
|
|
732
743
|
const preset = CANVAS_PRESETS.find((p) => p.id === id);
|
|
733
744
|
if (!preset) return;
|
|
745
|
+
if (id === INSTAGRAM_GRID_PRESET_ID) {
|
|
746
|
+
emit({
|
|
747
|
+
...value,
|
|
748
|
+
width: preset.width,
|
|
749
|
+
height: preset.height,
|
|
750
|
+
guides: instagramGridGuides(),
|
|
751
|
+
guidesLocked: true
|
|
752
|
+
});
|
|
753
|
+
zoom = 0.25;
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
734
756
|
emit({ ...value, width: preset.width, height: preset.height });
|
|
735
757
|
zoom = 1;
|
|
736
758
|
}
|
|
@@ -1213,7 +1235,7 @@
|
|
|
1213
1235
|
<svelte:window onkeydowncapture={handleKeydown} />
|
|
1214
1236
|
|
|
1215
1237
|
<div class={['min-h-0 relative flex h-full flex-col', className]}>
|
|
1216
|
-
{#if mode !== 'frame'}
|
|
1238
|
+
{#if mode !== 'frame' && showMenu}
|
|
1217
1239
|
<Menubar items={menuItems} onselect={onMenu} />
|
|
1218
1240
|
{/if}
|
|
1219
1241
|
<header
|
|
@@ -1238,7 +1260,8 @@
|
|
|
1238
1260
|
<span class="text-sm font-semibold text-primary sm:inline hidden">Canvas</span>
|
|
1239
1261
|
<Select
|
|
1240
1262
|
size="sm"
|
|
1241
|
-
class="w-
|
|
1263
|
+
class="min-w-72"
|
|
1264
|
+
listboxMinWidth={320}
|
|
1242
1265
|
options={presetOptions}
|
|
1243
1266
|
value={presetValue}
|
|
1244
1267
|
onchange={(id) => {
|
|
@@ -10,6 +10,14 @@ interface CanvasEditorProps {
|
|
|
10
10
|
* `edit` is the full canvas: panels, menu and component search.
|
|
11
11
|
*/
|
|
12
12
|
mode?: 'edit' | 'frame';
|
|
13
|
+
/** Hide the built-in menu when the host already has one. */
|
|
14
|
+
showMenu?: boolean;
|
|
15
|
+
showGrid?: boolean;
|
|
16
|
+
showGuides?: boolean;
|
|
17
|
+
snap?: boolean;
|
|
18
|
+
showSidebar?: boolean;
|
|
19
|
+
showInspector?: boolean;
|
|
20
|
+
stageFrame?: 'edit' | 'desktop' | 'tablet' | 'mobile';
|
|
13
21
|
class?: string;
|
|
14
22
|
onchange?: (doc: CanvasDocument) => void;
|
|
15
23
|
onassetschange?: (assets: MediaAsset[]) => void;
|
|
@@ -19,6 +27,6 @@ interface CanvasEditorProps {
|
|
|
19
27
|
blob?: Blob;
|
|
20
28
|
}) => void;
|
|
21
29
|
}
|
|
22
|
-
declare const CanvasEditor: import("svelte").Component<CanvasEditorProps, {}, "value" | "zoom" | "assets">;
|
|
30
|
+
declare const CanvasEditor: import("svelte").Component<CanvasEditorProps, {}, "value" | "zoom" | "showGrid" | "snap" | "assets" | "showGuides" | "showSidebar" | "showInspector" | "stageFrame">;
|
|
23
31
|
type CanvasEditor = ReturnType<typeof CanvasEditor>;
|
|
24
32
|
export default CanvasEditor;
|
package/dist/index.d.ts
CHANGED
|
@@ -874,7 +874,7 @@ export { msToPx, pxToMs, pxPerMsFromZoom, snapMs, clampMs, formatTimecode, ticks
|
|
|
874
874
|
export type { TimeTick, TimeTickLevel } from './utils/mediaTime.js';
|
|
875
875
|
export type { MediaAsset, MediaAssetKind, MediaClip, MediaClipAlign, MediaClipRect, MediaClipResettableField, MediaClipRectAxis, MediaTransitionPlayback, MediaTrack, MediaTrackKind } from './utils/mediaTracks.js';
|
|
876
876
|
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';
|
|
877
|
-
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';
|
|
877
|
+
export { emptyCanvasDocument, createCanvasLayer, createCanvasGuide, createPathFromDocPoints, rebakePathLayer, pathPointsToDoc, reorderCanvasLayers, updateCanvasLayer, updateCanvasLayers, alignLayerRect, snapLayerRect, snapRectToGuides, migrateCanvasDocument, defaultSlotFromRect, rectFromSlot, ensureLayerSlot, canvasLayerFieldDefault, isCanvasFieldModified, resetCanvasField, applyTextAutoSize, CANVAS_PRESETS, INSTAGRAM_GRID_PRESET_ID, INSTAGRAM_GRID, instagramGridGuides, emptyInstagramGridDocument, COVER_ARTBOARD, coverDocumentFromImage, persistCoverDocument, hydrateCoverDocument, canvasLayerFilter, mediaContentBox, presetIdForSize } from './utils/canvasDocument.js';
|
|
878
878
|
export type { CanvasDocument, CanvasLayer, CanvasLayerKind, CanvasLayerRect, CanvasPoint, CanvasObjectFit, CanvasTextAlign, CanvasResettableField, CanvasAlign, CanvasFontStyle, CanvasTextDecoration, CanvasGuide, CanvasGuideOrientation, CanvasAnchors, CanvasSlot, CanvasExposedProp, CanvasWidgetDefinition } from './utils/canvasDocument.js';
|
|
879
879
|
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';
|
|
880
880
|
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
|
@@ -593,7 +593,7 @@ export { queryStringToGroup, groupToQueryString, groupToFilterItems, removeRuleF
|
|
|
593
593
|
export { emptyBlogDocument, createBlock, createComponentBlock, serializeBlogDocument, parseBlogDocument, registerBlogComponent, unregisterBlogComponent, getBlogComponent, listBlogComponents, clearBlogComponentRegistry, NATIVE_BLOCK_TYPES, defaultDataForType, blogWidthClass, blogAlignClass, blogAspectPadding } from './utils/blogDocument.js';
|
|
594
594
|
export { msToPx, pxToMs, pxPerMsFromZoom, snapMs, clampMs, formatTimecode, ticksForDuration, snapStepForZoom } from './utils/mediaTime.js';
|
|
595
595
|
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';
|
|
596
|
-
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';
|
|
596
|
+
export { emptyCanvasDocument, createCanvasLayer, createCanvasGuide, createPathFromDocPoints, rebakePathLayer, pathPointsToDoc, reorderCanvasLayers, updateCanvasLayer, updateCanvasLayers, alignLayerRect, snapLayerRect, snapRectToGuides, migrateCanvasDocument, defaultSlotFromRect, rectFromSlot, ensureLayerSlot, canvasLayerFieldDefault, isCanvasFieldModified, resetCanvasField, applyTextAutoSize, CANVAS_PRESETS, INSTAGRAM_GRID_PRESET_ID, INSTAGRAM_GRID, instagramGridGuides, emptyInstagramGridDocument, COVER_ARTBOARD, coverDocumentFromImage, persistCoverDocument, hydrateCoverDocument, canvasLayerFilter, mediaContentBox, presetIdForSize } from './utils/canvasDocument.js';
|
|
597
597
|
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';
|
|
598
598
|
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';
|
|
599
599
|
export { createCanvasHistory, pushCanvasHistory, undoCanvasHistory, redoCanvasHistory, serializeCanvasDoc, parseCanvasDoc } from './utils/canvasHistory.js';
|
|
@@ -236,6 +236,17 @@ export declare function canvasLayerFilter(layer: {
|
|
|
236
236
|
contrast?: number;
|
|
237
237
|
saturate?: number;
|
|
238
238
|
}): string | undefined;
|
|
239
|
+
/** Instagram puzzle feed: 3 columns × 1080 and 3 rows × 1350 (4:5 tiles). */
|
|
240
|
+
export declare const INSTAGRAM_GRID_PRESET_ID = "ig-grid-3x3";
|
|
241
|
+
export declare const INSTAGRAM_GRID: {
|
|
242
|
+
readonly id: "ig-grid-3x3";
|
|
243
|
+
readonly cols: 3;
|
|
244
|
+
readonly rows: 3;
|
|
245
|
+
readonly cellWidth: 1080;
|
|
246
|
+
readonly cellHeight: 1350;
|
|
247
|
+
readonly width: 3240;
|
|
248
|
+
readonly height: 4050;
|
|
249
|
+
};
|
|
239
250
|
export declare const CANVAS_PRESETS: readonly [{
|
|
240
251
|
readonly id: "cover";
|
|
241
252
|
readonly label: "Cover · 1800×600";
|
|
@@ -261,6 +272,11 @@ export declare const CANVAS_PRESETS: readonly [{
|
|
|
261
272
|
readonly label: "Story · 1080×1920";
|
|
262
273
|
readonly width: 1080;
|
|
263
274
|
readonly height: 1920;
|
|
275
|
+
}, {
|
|
276
|
+
readonly id: "ig-grid-3x3";
|
|
277
|
+
readonly label: "Instagram 3×3 · 3240×4050";
|
|
278
|
+
readonly width: 3240;
|
|
279
|
+
readonly height: 4050;
|
|
264
280
|
}, {
|
|
265
281
|
readonly id: "landscape";
|
|
266
282
|
readonly label: "Landscape · 1600×900";
|
|
@@ -282,6 +298,9 @@ export declare const CANVAS_PRESETS: readonly [{
|
|
|
282
298
|
readonly width: 1600;
|
|
283
299
|
readonly height: 900;
|
|
284
300
|
}];
|
|
301
|
+
/** Locked cut lines between the nine Instagram tiles. */
|
|
302
|
+
export declare function instagramGridGuides(): CanvasGuide[];
|
|
303
|
+
export declare function emptyInstagramGridDocument(): CanvasDocument;
|
|
285
304
|
export declare function presetIdForSize(width: number, height: number): string;
|
|
286
305
|
/** Build a path layer from absolute document points. */
|
|
287
306
|
export declare function createPathFromDocPoints(docPoints: {
|
|
@@ -498,17 +498,54 @@ export function canvasLayerFilter(layer) {
|
|
|
498
498
|
parts.push(`saturate(${layer.saturate}%)`);
|
|
499
499
|
return parts.length ? parts.join(' ') : undefined;
|
|
500
500
|
}
|
|
501
|
+
/** Instagram puzzle feed: 3 columns × 1080 and 3 rows × 1350 (4:5 tiles). */
|
|
502
|
+
export const INSTAGRAM_GRID_PRESET_ID = 'ig-grid-3x3';
|
|
503
|
+
export const INSTAGRAM_GRID = {
|
|
504
|
+
id: INSTAGRAM_GRID_PRESET_ID,
|
|
505
|
+
cols: 3,
|
|
506
|
+
rows: 3,
|
|
507
|
+
cellWidth: 1080,
|
|
508
|
+
cellHeight: 1350,
|
|
509
|
+
width: 3240,
|
|
510
|
+
height: 4050
|
|
511
|
+
};
|
|
501
512
|
export const CANVAS_PRESETS = [
|
|
502
513
|
{ id: 'cover', label: 'Cover · 1800×600', width: 1800, height: 600 },
|
|
503
514
|
{ id: 'hd', label: 'HD · 1280×720', width: 1280, height: 720 },
|
|
504
515
|
{ id: 'fhd', label: 'Full HD · 1920×1080', width: 1920, height: 1080 },
|
|
505
516
|
{ id: 'square', label: 'Instagram · 1080×1080', width: 1080, height: 1080 },
|
|
506
517
|
{ id: 'story', label: 'Story · 1080×1920', width: 1080, height: 1920 },
|
|
518
|
+
{
|
|
519
|
+
id: INSTAGRAM_GRID_PRESET_ID,
|
|
520
|
+
label: 'Instagram 3×3 · 3240×4050',
|
|
521
|
+
width: INSTAGRAM_GRID.width,
|
|
522
|
+
height: INSTAGRAM_GRID.height
|
|
523
|
+
},
|
|
507
524
|
{ id: 'landscape', label: 'Landscape · 1600×900', width: 1600, height: 900 },
|
|
508
525
|
{ id: 'presentation', label: 'Presentation · 1920×1080', width: 1920, height: 1080 },
|
|
509
526
|
{ id: 'a4', label: 'A4 · 794×1123', width: 794, height: 1123 },
|
|
510
527
|
{ id: 'twitter', label: 'X Post · 1600×900', width: 1600, height: 900 }
|
|
511
528
|
];
|
|
529
|
+
/** Locked cut lines between the nine Instagram tiles. */
|
|
530
|
+
export function instagramGridGuides() {
|
|
531
|
+
const guides = [];
|
|
532
|
+
for (let col = 1; col < INSTAGRAM_GRID.cols; col++) {
|
|
533
|
+
guides.push(createCanvasGuide('vertical', col * INSTAGRAM_GRID.cellWidth, { locked: true }));
|
|
534
|
+
}
|
|
535
|
+
for (let row = 1; row < INSTAGRAM_GRID.rows; row++) {
|
|
536
|
+
guides.push(createCanvasGuide('horizontal', row * INSTAGRAM_GRID.cellHeight, { locked: true }));
|
|
537
|
+
}
|
|
538
|
+
return guides;
|
|
539
|
+
}
|
|
540
|
+
export function emptyInstagramGridDocument() {
|
|
541
|
+
return emptyCanvasDocument({
|
|
542
|
+
width: INSTAGRAM_GRID.width,
|
|
543
|
+
height: INSTAGRAM_GRID.height,
|
|
544
|
+
background: '#0b1f3a',
|
|
545
|
+
guides: instagramGridGuides(),
|
|
546
|
+
guidesLocked: true
|
|
547
|
+
});
|
|
548
|
+
}
|
|
512
549
|
export function presetIdForSize(width, height) {
|
|
513
550
|
const match = CANVAS_PRESETS.find((p) => p.width === width && p.height === height);
|
|
514
551
|
return match?.id ?? 'custom';
|