@r2digisolutions/components 0.19.18 → 0.19.20
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.
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
interface CanvasEditorProps {
|
|
116
116
|
value?: CanvasDocument;
|
|
117
117
|
assets?: MediaAsset[];
|
|
118
|
+
zoom?: number;
|
|
118
119
|
class?: string;
|
|
119
120
|
onchange?: (doc: CanvasDocument) => void;
|
|
120
121
|
onassetschange?: (assets: MediaAsset[]) => void;
|
|
@@ -128,6 +129,7 @@
|
|
|
128
129
|
let {
|
|
129
130
|
value = $bindable(emptyCanvasDocument()),
|
|
130
131
|
assets = $bindable<MediaAsset[]>([]),
|
|
132
|
+
zoom = $bindable(1),
|
|
131
133
|
class: className = '',
|
|
132
134
|
onchange,
|
|
133
135
|
onassetschange,
|
|
@@ -146,7 +148,6 @@
|
|
|
146
148
|
let showInspector = $state(true);
|
|
147
149
|
let assetsSize = $state(58);
|
|
148
150
|
let sidebarTab = $state<'elements' | 'uploads' | 'widgets'>('elements');
|
|
149
|
-
let zoom = $state(1);
|
|
150
151
|
let showGrid = $state(false);
|
|
151
152
|
let showGuides = $state(true);
|
|
152
153
|
let snap = $state(true);
|
|
@@ -1132,31 +1133,42 @@
|
|
|
1132
1133
|
</IconButton>
|
|
1133
1134
|
</div>
|
|
1134
1135
|
|
|
1135
|
-
<div class="flex items-center
|
|
1136
|
+
<div class="flex items-center rounded-lg border border-border bg-surface p-0.5">
|
|
1136
1137
|
<Tooltip content="Toggle grid">
|
|
1137
1138
|
<IconButton
|
|
1138
1139
|
label="Toggle grid"
|
|
1139
1140
|
size="sm"
|
|
1140
|
-
|
|
1141
|
+
aria-pressed={showGrid}
|
|
1142
|
+
onclick={(e) => {
|
|
1143
|
+
showGrid = !showGrid;
|
|
1144
|
+
(e.currentTarget as HTMLButtonElement).blur();
|
|
1145
|
+
}}
|
|
1141
1146
|
class={showGrid ? 'bg-brand-500/10 text-brand-600' : undefined}
|
|
1142
1147
|
>
|
|
1143
1148
|
<Grid3x3 class="h-3.5 w-3.5" />
|
|
1144
1149
|
</IconButton>
|
|
1145
1150
|
</Tooltip>
|
|
1146
1151
|
{#if showGrid}
|
|
1147
|
-
<
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
options={gridSizeOptions}
|
|
1152
|
+
<select
|
|
1153
|
+
class="h-8 min-w-0 shrink-0 rounded-md border-0 bg-transparent px-1 font-mono text-[11px] tabular-nums text-secondary outline-none hover:bg-surface-overlay focus-visible:bg-surface-overlay"
|
|
1154
|
+
aria-label="Grid cell size"
|
|
1151
1155
|
value={String(cellSize)}
|
|
1152
|
-
onchange={(
|
|
1153
|
-
|
|
1156
|
+
onchange={(e) => (cellSize = Number(e.currentTarget.value))}
|
|
1157
|
+
>
|
|
1158
|
+
{#each gridSizeOptions as opt (opt.value)}
|
|
1159
|
+
<option value={opt.value}>{opt.label}</option>
|
|
1160
|
+
{/each}
|
|
1161
|
+
</select>
|
|
1154
1162
|
{/if}
|
|
1155
1163
|
<Tooltip content="Snap to grid & guides">
|
|
1156
1164
|
<IconButton
|
|
1157
1165
|
label="Toggle snap"
|
|
1158
1166
|
size="sm"
|
|
1159
|
-
|
|
1167
|
+
aria-pressed={snap}
|
|
1168
|
+
onclick={(e) => {
|
|
1169
|
+
snap = !snap;
|
|
1170
|
+
(e.currentTarget as HTMLButtonElement).blur();
|
|
1171
|
+
}}
|
|
1160
1172
|
class={snap ? 'bg-brand-500/10 text-brand-600' : undefined}
|
|
1161
1173
|
>
|
|
1162
1174
|
<Magnet class="h-3.5 w-3.5" />
|
|
@@ -4,6 +4,7 @@ import type { MediaAsset } from '../../../utils/mediaTracks.js';
|
|
|
4
4
|
interface CanvasEditorProps {
|
|
5
5
|
value?: CanvasDocument;
|
|
6
6
|
assets?: MediaAsset[];
|
|
7
|
+
zoom?: number;
|
|
7
8
|
class?: string;
|
|
8
9
|
onchange?: (doc: CanvasDocument) => void;
|
|
9
10
|
onassetschange?: (assets: MediaAsset[]) => void;
|
|
@@ -13,6 +14,6 @@ interface CanvasEditorProps {
|
|
|
13
14
|
blob?: Blob;
|
|
14
15
|
}) => void;
|
|
15
16
|
}
|
|
16
|
-
declare const CanvasEditor: import("svelte").Component<CanvasEditorProps, {}, "value" | "assets">;
|
|
17
|
+
declare const CanvasEditor: import("svelte").Component<CanvasEditorProps, {}, "value" | "zoom" | "assets">;
|
|
17
18
|
type CanvasEditor = ReturnType<typeof CanvasEditor>;
|
|
18
19
|
export default CanvasEditor;
|