@pixerate/editor-svelte 0.32.0 → 0.34.0
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/canvas/createCanvasAnimation.svelte.d.ts.map +1 -1
- package/dist/canvas/createCanvasArrange.svelte.d.ts.map +1 -1
- package/dist/canvas/createCanvasAutoLayout.svelte.d.ts.map +1 -1
- package/dist/canvas/createCanvasComponents.svelte.d.ts.map +1 -1
- package/dist/vector/VectorCanvas.svelte +22 -0
- package/dist/vector/VectorCanvas.svelte.d.ts.map +1 -1
- package/dist/vector/VectorSceneNodes.svelte +44 -0
- package/dist/vector/VectorSceneNodes.svelte.d.ts.map +1 -1
- package/dist/vector/VectorStylePanel.svelte +142 -4
- package/dist/vector/VectorStylePanel.svelte.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCanvasAnimation.svelte.d.ts","sourceRoot":"","sources":["../../src/canvas/createCanvasAnimation.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,KAAK,EACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,4BAA4B,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU;IAClF,QAAQ,EAAE,MAAM,KAAK,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IACnC,mDAAmD;IACnD,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;IAChC,+FAA+F;IAC/F,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAA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CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EAAE,OAAO,EAAE,6BAA6B,CAAC,KAAK,CAAC;IAazH,gCAAgC;;;;;
|
|
1
|
+
{"version":3,"file":"createCanvasComponents.svelte.d.ts","sourceRoot":"","sources":["../../src/canvas/createCanvasComponents.svelte.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,iCAAiC,EACtC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,KAAK,WAAW,GAAG,iCAAiC,CAAC,GAAG,CAAC,CAAC;AAE1D,MAAM,WAAW,6BAA6B,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,CACnF,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;IAC/D,QAAQ,EAAE,MAAM,KAAK,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IACnC,oFAAoF;IACpF,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EAAE,OAAO,EAAE,6BAA6B,CAAC,KAAK,CAAC;IAazH,gCAAgC;;;;;4BASoooI,CAAC;;UAAmM,CAAC;YAAsB,CAAC;eAAyB,CAAC;;8BAA8E,CAAC;;;;;;;;;;6BAA4nC,CAAC;;;;;;;;eAA6yB,CAAC;;;;;;;oBAAi7B,CAAC;;;;;;;;;;;;;;gBAA07C,CAAC;;EAHlwxI;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
isVectorTextTarget,
|
|
13
13
|
toVectorKeyInput,
|
|
14
14
|
toVectorPointerInput,
|
|
15
|
+
vectorDiamondPath,
|
|
15
16
|
type VectorEditorController
|
|
16
17
|
} from '@pixerate/editor/vector';
|
|
17
18
|
import VectorGradientDefs from './VectorGradientDefs.svelte';
|
|
@@ -218,6 +219,27 @@
|
|
|
218
219
|
<circle data-vector-anchor={a.ref.index} cx={a.x} cy={a.y} r={size / 2} fill={a.selected ? accentColor : THEME.handleFill} stroke={accentColor} />
|
|
219
220
|
{/if}
|
|
220
221
|
{/each}
|
|
222
|
+
{#each overlay.cornerWidgets as w (`corner:${anchorKey(w)}`)}
|
|
223
|
+
<g data-vector-corner-widget={w.ref.index} data-corner-kind={w.kind}>
|
|
224
|
+
<circle cx={w.x} cy={w.y} r={THEME.cornerWidgetRadius + (w.hovered ? 1 : 0)} fill={THEME.handleFill} stroke={accentColor} />
|
|
225
|
+
<circle cx={w.x} cy={w.y} r={1.5} fill={accentColor} />
|
|
226
|
+
</g>
|
|
227
|
+
{/each}
|
|
228
|
+
{#if overlay.widthSpot}
|
|
229
|
+
<g data-vector-width-spot="">
|
|
230
|
+
<line x1={overlay.widthSpot.left.x} y1={overlay.widthSpot.left.y} x2={overlay.widthSpot.right.x} y2={overlay.widthSpot.right.y} stroke={accentColor} stroke-dasharray="3 2" />
|
|
231
|
+
<path d={vectorDiamondPath(overlay.widthSpot.x, overlay.widthSpot.y)} fill="none" stroke={accentColor} />
|
|
232
|
+
</g>
|
|
233
|
+
{/if}
|
|
234
|
+
{#each overlay.widthPoints as w (`width:${w.ref.nodeId}:${w.ref.subpath}:${w.ref.index}`)}
|
|
235
|
+
<g data-vector-width-point={w.ref.index} data-selected={w.selected || undefined}>
|
|
236
|
+
<line x1={w.left.x} y1={w.left.y} x2={w.right.x} y2={w.right.y} stroke={accentColor} />
|
|
237
|
+
<path d={vectorDiamondPath(w.x, w.y)} fill={w.selected || w.active ? accentColor : THEME.handleFill} stroke={accentColor} stroke-width={w.hovered === 'center' ? 2 : 1} />
|
|
238
|
+
{#each ['left', 'right'] as const as side (side)}
|
|
239
|
+
<circle data-vector-width-side={side} cx={w[side].x} cy={w[side].y} r={THEME.handleRadius + (w.hovered === side ? 1 : 0)} fill={THEME.handleFill} stroke={accentColor} />
|
|
240
|
+
{/each}
|
|
241
|
+
</g>
|
|
242
|
+
{/each}
|
|
221
243
|
{#if closing}
|
|
222
244
|
<circle cx={closing.x} cy={closing.y} r={as} stroke={accentColor} />
|
|
223
245
|
{/if}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorCanvas.svelte.d.ts","sourceRoot":"","sources":["../../src/vector/VectorCanvas.svelte.ts"],"names":[],"mappings":"AAQA,OAAO,
|
|
1
|
+
{"version":3,"file":"VectorCanvas.svelte.d.ts","sourceRoot":"","sources":["../../src/vector/VectorCanvas.svelte.ts"],"names":[],"mappings":"AAQA,OAAO,EAQH,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAMjC,UAAU,KAAK;IACb,UAAU,EAAE,sBAAsB,CAAC;IACnC,mFAAmF;IACnF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAoNH,QAAA,MAAM,YAAY,2CAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -14,6 +14,50 @@
|
|
|
14
14
|
<g data-vector-id={node.id} transform={node.transform} opacity={node.opacity < 1 ? node.opacity : undefined}>
|
|
15
15
|
<Self nodes={node.children} />
|
|
16
16
|
</g>
|
|
17
|
+
{:else if node.strokeParts}
|
|
18
|
+
{@const sp = node.strokeParts}
|
|
19
|
+
<!-- An aligned stroke (double width, clipped or masked by the shape) or one with arrowheads. -->
|
|
20
|
+
<g data-vector-id={node.id} data-vector-stroke-align={sp.align} transform={node.transform} opacity={node.opacity < 1 ? node.opacity : undefined}>
|
|
21
|
+
{#if sp.clip}
|
|
22
|
+
<defs>
|
|
23
|
+
{#if sp.clip.kind === 'clip'}
|
|
24
|
+
<clipPath id={sp.clip.id}><path d={node.d} clip-rule={node.fillRule} /></clipPath>
|
|
25
|
+
{:else}
|
|
26
|
+
<mask id={sp.clip.id} maskUnits="userSpaceOnUse" x={sp.clip.bounds.x} y={sp.clip.bounds.y} width={sp.clip.bounds.width} height={sp.clip.bounds.height}>
|
|
27
|
+
<rect x={sp.clip.bounds.x} y={sp.clip.bounds.y} width={sp.clip.bounds.width} height={sp.clip.bounds.height} fill="#fff" />
|
|
28
|
+
<path d={node.d} fill="#000" fill-rule={node.fillRule} />
|
|
29
|
+
</mask>
|
|
30
|
+
{/if}
|
|
31
|
+
</defs>
|
|
32
|
+
{/if}
|
|
33
|
+
<path data-vector-part="fill" d={node.d} fill={node.fill} fill-rule={node.fillRule} stroke="none" />
|
|
34
|
+
{#if sp.outline !== undefined}
|
|
35
|
+
<!-- A variable-width stroke: its outline, filled. -->
|
|
36
|
+
<path
|
|
37
|
+
data-vector-part="stroke-outline"
|
|
38
|
+
d={sp.outline}
|
|
39
|
+
fill={node.stroke}
|
|
40
|
+
clip-path={sp.clip?.kind === 'clip' ? `url(#${sp.clip.id})` : undefined}
|
|
41
|
+
mask={sp.clip?.kind === 'mask' ? `url(#${sp.clip.id})` : undefined}
|
|
42
|
+
/>
|
|
43
|
+
{:else}
|
|
44
|
+
<path
|
|
45
|
+
data-vector-part="stroke"
|
|
46
|
+
d={sp.d}
|
|
47
|
+
fill="none"
|
|
48
|
+
stroke={node.stroke}
|
|
49
|
+
stroke-width={sp.width}
|
|
50
|
+
stroke-linecap={node.strokeLinecap as any}
|
|
51
|
+
stroke-linejoin={node.strokeLinejoin as any}
|
|
52
|
+
stroke-dasharray={node.strokeDasharray}
|
|
53
|
+
clip-path={sp.clip?.kind === 'clip' ? `url(#${sp.clip.id})` : undefined}
|
|
54
|
+
mask={sp.clip?.kind === 'mask' ? `url(#${sp.clip.id})` : undefined}
|
|
55
|
+
/>
|
|
56
|
+
{/if}
|
|
57
|
+
{#each sp.heads as head, i (i)}
|
|
58
|
+
<path data-vector-part="head" d={head} fill={node.stroke} />
|
|
59
|
+
{/each}
|
|
60
|
+
</g>
|
|
17
61
|
{:else}
|
|
18
62
|
<path
|
|
19
63
|
data-vector-id={node.id}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorSceneNodes.svelte.d.ts","sourceRoot":"","sources":["../../src/vector/VectorSceneNodes.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI9D,UAAU,KAAK;IACb,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACpC;
|
|
1
|
+
{"version":3,"file":"VectorSceneNodes.svelte.d.ts","sourceRoot":"","sources":["../../src/vector/VectorSceneNodes.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI9D,UAAU,KAAK;IACb,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACpC;AAgDH,QAAA,MAAM,gBAAgB,2CAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
VECTOR_ARROWHEADS,
|
|
4
|
+
VECTOR_ARROWHEAD_LABELS,
|
|
5
|
+
VECTOR_CORNER_KINDS,
|
|
6
|
+
VECTOR_CORNER_KIND_LABELS,
|
|
7
|
+
VECTOR_STROKE_ALIGN_LABELS,
|
|
8
|
+
VECTOR_WIDTH_PRESETS,
|
|
9
|
+
getVectorSelectionStyle,
|
|
10
|
+
vectorPaintToHex,
|
|
11
|
+
widthProfilePreset,
|
|
12
|
+
widthProfilePresetId,
|
|
13
|
+
type VectorCornerKind,
|
|
14
|
+
type VectorEditorController,
|
|
15
|
+
type VectorStrokeAlign,
|
|
16
|
+
type VectorWidthPreset
|
|
17
|
+
} from '@pixerate/editor/vector';
|
|
3
18
|
import { vectorStateOf } from './subscribe.svelte.js';
|
|
19
|
+
import { vectorButtonClass } from './styles.js';
|
|
4
20
|
|
|
5
21
|
interface Props {
|
|
6
22
|
controller: VectorEditorController;
|
|
@@ -12,9 +28,45 @@
|
|
|
12
28
|
const store = vectorStateOf(() => controller);
|
|
13
29
|
const view = $derived(store.current);
|
|
14
30
|
const style = $derived(getVectorSelectionStyle(view));
|
|
15
|
-
const source = $derived(
|
|
16
|
-
style
|
|
17
|
-
|
|
31
|
+
const source = $derived.by(() => {
|
|
32
|
+
if (style) return style;
|
|
33
|
+
const d = view.defaults;
|
|
34
|
+
return {
|
|
35
|
+
fill: d.fill ?? null,
|
|
36
|
+
stroke: d.stroke ?? null,
|
|
37
|
+
strokeWidth: d.strokeWidth ?? 1,
|
|
38
|
+
opacity: 1,
|
|
39
|
+
strokeAlign: d.strokeAlign ?? 'center',
|
|
40
|
+
startArrow: d.startArrow ?? null,
|
|
41
|
+
endArrow: d.endArrow ?? null,
|
|
42
|
+
arrowAlign: d.arrowAlign ?? 'extend',
|
|
43
|
+
startArrowScale: d.startArrowScale ?? 1,
|
|
44
|
+
endArrowScale: d.endArrowScale ?? 1,
|
|
45
|
+
widthProfile: widthProfilePresetId(d.strokeWidthProfile),
|
|
46
|
+
cornerRadius: d.cornerRadius,
|
|
47
|
+
cornerKind: d.cornerKind ?? 'round',
|
|
48
|
+
corners: 1,
|
|
49
|
+
hasOpenPath: true
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
const aligns = Object.keys(VECTOR_STROKE_ALIGN_LABELS) as VectorStrokeAlign[];
|
|
53
|
+
const ends = [
|
|
54
|
+
{ end: 'start', key: 'startArrow', scaleKey: 'startArrowScale', label: 'Start' },
|
|
55
|
+
{ end: 'end', key: 'endArrow', scaleKey: 'endArrowScale', label: 'End' }
|
|
56
|
+
] as const;
|
|
57
|
+
const selectClass = 'h-7 min-w-0 flex-1 rounded border border-border bg-background px-1 text-xs';
|
|
58
|
+
const numberClass = 'h-7 w-16 rounded border border-border bg-background px-1.5 text-xs';
|
|
59
|
+
|
|
60
|
+
function setCorners(patch: { radius?: number; kind?: VectorCornerKind }) {
|
|
61
|
+
if (!style) controller.setDefaults({ ...(patch.radius !== undefined ? { cornerRadius: patch.radius } : {}), ...(patch.kind ? { cornerKind: patch.kind } : {}) });
|
|
62
|
+
else if (patch.radius !== undefined) controller.setCornerRadius(patch.radius);
|
|
63
|
+
else if (patch.kind) controller.setCornerKind(patch.kind);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function setProfile(id: VectorWidthPreset) {
|
|
67
|
+
if (style) controller.setWidthProfile(id);
|
|
68
|
+
else controller.setDefaults({ strokeWidthProfile: widthProfilePreset(id)?.length ? widthProfilePreset(id) : null });
|
|
69
|
+
}
|
|
18
70
|
|
|
19
71
|
function apply(patch: Record<string, unknown>) {
|
|
20
72
|
if (style) controller.setStyle(patch);
|
|
@@ -65,6 +117,92 @@
|
|
|
65
117
|
}}
|
|
66
118
|
/>
|
|
67
119
|
</label>
|
|
120
|
+
<label class="flex items-center gap-2 text-xs text-foreground" data-vector-style="strokeAlign">
|
|
121
|
+
<span class="w-16">Align</span>
|
|
122
|
+
<select aria-label="Stroke alignment" class={selectClass} value={source.strokeAlign} onchange={(e) => apply({ strokeAlign: e.currentTarget.value })}>
|
|
123
|
+
{#each aligns as a (a)}<option value={a}>{VECTOR_STROKE_ALIGN_LABELS[a]}</option>{/each}
|
|
124
|
+
</select>
|
|
125
|
+
{#if style?.mixed.strokeAlign}<span class="text-[11px] text-muted-foreground">Mixed</span>{/if}
|
|
126
|
+
</label>
|
|
127
|
+
<div class="flex items-center gap-2 text-xs text-foreground" data-vector-style="widthProfile">
|
|
128
|
+
<span class="w-16">Profile</span>
|
|
129
|
+
<select
|
|
130
|
+
aria-label="Width profile"
|
|
131
|
+
class={selectClass}
|
|
132
|
+
value={source.widthProfile}
|
|
133
|
+
onchange={(e) => {
|
|
134
|
+
if (e.currentTarget.value !== 'custom') setProfile(e.currentTarget.value as VectorWidthPreset);
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
{#each VECTOR_WIDTH_PRESETS as p (p.id)}<option value={p.id}>{p.label}</option>{/each}
|
|
138
|
+
{#if source.widthProfile === 'custom'}<option value="custom" disabled>Custom</option>{/if}
|
|
139
|
+
</select>
|
|
140
|
+
<button
|
|
141
|
+
type="button"
|
|
142
|
+
class={vectorButtonClass}
|
|
143
|
+
title="Reset to uniform width"
|
|
144
|
+
aria-label="Reset to uniform width"
|
|
145
|
+
disabled={source.widthProfile === 'uniform' && !style?.mixed.widthProfile}
|
|
146
|
+
onclick={() => setProfile('uniform')}
|
|
147
|
+
>
|
|
148
|
+
═
|
|
149
|
+
</button>
|
|
150
|
+
{#if style?.mixed.widthProfile}<span class="text-[11px] text-muted-foreground">Mixed</span>{/if}
|
|
151
|
+
</div>
|
|
152
|
+
{#if source.hasOpenPath}
|
|
153
|
+
{#each ends as { key, scaleKey, label } (key)}
|
|
154
|
+
<div class="flex items-center gap-2" data-vector-style={key}>
|
|
155
|
+
<span class="w-16 text-xs text-foreground">{label}</span>
|
|
156
|
+
<select aria-label="{label} arrowhead" class={selectClass} value={source[key] ?? ''} onchange={(e) => apply({ [key]: e.currentTarget.value || null })}>
|
|
157
|
+
<option value="">None</option>
|
|
158
|
+
{#each VECTOR_ARROWHEADS as h (h)}<option value={h}>{VECTOR_ARROWHEAD_LABELS[h]}</option>{/each}
|
|
159
|
+
</select>
|
|
160
|
+
<input
|
|
161
|
+
type="number"
|
|
162
|
+
min="0.1"
|
|
163
|
+
step="0.25"
|
|
164
|
+
aria-label="{label} arrowhead scale"
|
|
165
|
+
title="Scale (× stroke width)"
|
|
166
|
+
class={numberClass}
|
|
167
|
+
value={source[scaleKey]}
|
|
168
|
+
oninput={(e) => {
|
|
169
|
+
const n = parseFloat(e.currentTarget.value);
|
|
170
|
+
if (Number.isFinite(n) && n > 0) apply({ [scaleKey]: n });
|
|
171
|
+
}}
|
|
172
|
+
/>
|
|
173
|
+
</div>
|
|
174
|
+
{/each}
|
|
175
|
+
{#if source.startArrow || source.endArrow}
|
|
176
|
+
<label class="flex items-center gap-2 text-xs text-foreground" data-vector-style="arrowAlign">
|
|
177
|
+
<span class="w-16">Heads</span>
|
|
178
|
+
<select aria-label="Arrowhead alignment" class={selectClass} value={source.arrowAlign} onchange={(e) => apply({ arrowAlign: e.currentTarget.value })}>
|
|
179
|
+
<option value="extend">Tip past end</option>
|
|
180
|
+
<option value="tip">Tip at end</option>
|
|
181
|
+
</select>
|
|
182
|
+
</label>
|
|
183
|
+
{/if}
|
|
184
|
+
{/if}
|
|
185
|
+
{#if source.corners > 0}
|
|
186
|
+
<div class="flex items-center gap-2" data-vector-style="corners">
|
|
187
|
+
<span class="w-16 text-xs text-foreground">Corners</span>
|
|
188
|
+
<input
|
|
189
|
+
type="number"
|
|
190
|
+
min="0"
|
|
191
|
+
step="1"
|
|
192
|
+
aria-label="Corner radius"
|
|
193
|
+
class={numberClass}
|
|
194
|
+
value={Math.round(source.cornerRadius * 100) / 100}
|
|
195
|
+
oninput={(e) => {
|
|
196
|
+
const n = parseFloat(e.currentTarget.value);
|
|
197
|
+
if (Number.isFinite(n) && n >= 0) setCorners({ radius: n });
|
|
198
|
+
}}
|
|
199
|
+
/>
|
|
200
|
+
<select aria-label="Corner kind" class={selectClass} value={source.cornerKind} onchange={(e) => setCorners({ kind: e.currentTarget.value as VectorCornerKind })}>
|
|
201
|
+
{#each VECTOR_CORNER_KINDS as k (k)}<option value={k}>{VECTOR_CORNER_KIND_LABELS[k]}</option>{/each}
|
|
202
|
+
</select>
|
|
203
|
+
{#if style?.mixed.cornerRadius}<span class="text-[11px] text-muted-foreground">Mixed</span>{/if}
|
|
204
|
+
</div>
|
|
205
|
+
{/if}
|
|
68
206
|
{#if style}
|
|
69
207
|
<label class="flex items-center gap-2 text-xs text-foreground">
|
|
70
208
|
<span class="w-16">Opacity</span>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorStylePanel.svelte.d.ts","sourceRoot":"","sources":["../../src/vector/VectorStylePanel.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"VectorStylePanel.svelte.d.ts","sourceRoot":"","sources":["../../src/vector/VectorStylePanel.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAYH,KAAK,sBAAsB,EAG5B,MAAM,yBAAyB,CAAC;AAKjC,UAAU,KAAK;IACb,UAAU,EAAE,sBAAsB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAyJH,QAAA,MAAM,gBAAgB,2CAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@tiptap/extension-bubble-menu": "^2.11.5",
|
|
108
108
|
"@tiptap/extension-placeholder": "^2.11.5",
|
|
109
109
|
"@tiptap/starter-kit": "^2.11.5",
|
|
110
|
-
"@pixerate/editor": "0.
|
|
110
|
+
"@pixerate/editor": "0.37.0"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
113
|
"@dagrejs/dagre": "^1.1.4",
|