@pixerate/editor-svelte 0.97.0 → 0.98.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.
@@ -9,7 +9,8 @@
9
9
  type VectorEditorController,
10
10
  type VectorFilterType,
11
11
  type VectorFiltersPanelItem,
12
- type VectorStrokeAlign
12
+ type VectorStrokeAlign,
13
+ vectorBrushstrokeBrushes
13
14
  } from '@pixerate/editor/vector';
14
15
  import { vectorStateOf } from './subscribe.svelte.js';
15
16
 
@@ -63,7 +64,23 @@
63
64
 
64
65
  {#snippet layerRow(l: VectorAppearancePanelLayer, count: number, ids: string[])}
65
66
  {@const name = nameOf(l)}
66
- {#if l.unknownKind}
67
+ {#if l.brushstroke}
68
+ {@const bs = l.brushstroke}
69
+ <div class="space-y-1 rounded border border-border p-1" data-vector-layer="{l.kind}-{l.index}" data-vector-brushstroke="">
70
+ <div class="flex items-center gap-1">
71
+ <input type="checkbox" aria-label="{name} visible" title="Show" checked={l.visible} onchange={(e) => update(l, { visible: e.currentTarget.checked })} />
72
+ <input type="color" aria-label="{name} colour" class="h-7 w-10 cursor-pointer rounded border border-border bg-background" value={l.color ?? '#000000'} oninput={(e) => controller.setBrushstroke(l.index, { color: e.currentTarget.value }, { ids, merge: true })} onblur={() => controller.endMergedEdit()} />
73
+ <select aria-label="{name} brush" class={selectClass} value={bs.brushId} onchange={(e) => controller.setBrushstroke(l.index, { brushId: e.currentTarget.value }, { ids })}>
74
+ {#each vectorBrushstrokeBrushes() as b (b.id)}<option value={b.id}>{b.name}</option>{/each}
75
+ </select>
76
+ <input type="number" min="0.5" step="0.5" aria-label="{name} brush size" title="Brush size" class={numberClass} value={bs.size} oninput={(e) => {
77
+ const n = parseFloat(e.currentTarget.value);
78
+ if (Number.isFinite(n) && n > 0) controller.setBrushstroke(l.index, { size: Math.min(500, n) }, { ids, merge: true });
79
+ }} onblur={() => controller.endMergedEdit()} />
80
+ <button type="button" class={buttonClass} title="Remove" aria-label="Remove {name}" onclick={() => controller.removePaintLayer('stroke', l.index, { ids })}>×</button>
81
+ </div>
82
+ </div>
83
+ {:else if l.unknownKind}
67
84
  <div class="text-[11px] text-muted-foreground" data-vector-layer="{l.kind}-{l.index}">{name}: {l.unknownKind} (not drawn by this version)</div>
68
85
  {:else}
69
86
  <div class="space-y-1 rounded border border-border p-1" data-vector-layer="{l.kind}-{l.index}" data-vector-layer-editing={l.editing ? '' : undefined}>
@@ -146,6 +163,9 @@
146
163
  disabled={!ids.length}
147
164
  onclick={() => controller.addPaintLayer(kind, {}, { ids })}>+</button
148
165
  >
166
+ {#if kind === 'stroke'}
167
+ <button type="button" class={buttonClass} title="Add a brushstroke (a natural-media brush along the path)" aria-label="Add brushstroke" data-vector-add-brushstroke="" disabled={!ids.length} onclick={() => controller.addBrushstroke({ brushId: vectorBrushstrokeBrushes()[0].id }, { ids })}>✎+</button>
168
+ {/if}
149
169
  </div>
150
170
  <!-- Top layer first, as it draws. -->
151
171
  {#each [...layers].reverse() as l (`${l.kind}-${l.index}`)}{@render layerRow(l, layers.length, ids)}{/each}
@@ -1 +1 @@
1
- {"version":3,"file":"VectorAppearancePanel.svelte.d.ts","sourceRoot":"","sources":["../../src/vector/VectorAppearancePanel.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAOH,KAAK,sBAAsB,EAI5B,MAAM,yBAAyB,CAAC;AAIjC;;;;;;GAMG;AACH,UAAU,KAAK;IACb,UAAU,EAAE,sBAAsB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA4JH,QAAA,MAAM,qBAAqB,2CAAwC,CAAC;AACpE,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACtE,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"VectorAppearancePanel.svelte.d.ts","sourceRoot":"","sources":["../../src/vector/VectorAppearancePanel.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAOH,KAAK,sBAAsB,EAK5B,MAAM,yBAAyB,CAAC;AAIjC;;;;;;GAMG;AACH,UAAU,KAAK;IACb,UAAU,EAAE,sBAAsB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA+KH,QAAA,MAAM,qBAAqB,2CAAwC,CAAC;AACpE,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACtE,eAAe,qBAAqB,CAAC"}
@@ -35,7 +35,14 @@
35
35
  <!-- Fill and stroke stacks: each layer in order, bottom to top. -->
36
36
  <g data-vector-id={node.id} transform={node.transform} opacity={node.opacity < 1 ? node.opacity : undefined} filter={node.filter} style={blend(node.blendMode)}>
37
37
  {#each node.layers as layer (`${layer.kind}-${layer.index}`)}
38
- <VectorPaintPath paint={layer} d={node.d} fillRule={node.fillRule} layer={`${layer.kind}-${layer.index}`} />
38
+ {#if layer.kind === 'brushstroke'}
39
+ <!-- A brushstroke: its rendered brush images over their boxes. -->
40
+ <g data-vector-layer={`brushstroke-${layer.index}`} opacity={layer.opacity < 1 ? layer.opacity : undefined} style={blend(layer.blendMode)}>
41
+ {#each layer.images ?? [] as im, i (i)}<image href={im.href} x={im.x} y={im.y} width={im.width} height={im.height} preserveAspectRatio="none" />{/each}
42
+ </g>
43
+ {:else}
44
+ <VectorPaintPath paint={layer} d={node.d} fillRule={node.fillRule} layer={`${layer.kind}-${layer.index}`} />
45
+ {/if}
39
46
  {/each}
40
47
  </g>
41
48
  {:else}
@@ -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;AAO9D,UAAU,KAAK;IACb,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACpC;AAsCH,QAAA,MAAM,gBAAgB,2CAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
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;AAO9D,UAAU,KAAK;IACb,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACpC;AA6CH,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.97.0",
3
+ "version": "0.98.0",
4
4
  "description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -144,7 +144,7 @@
144
144
  "@tiptap/extension-bubble-menu": "^2.11.5",
145
145
  "@tiptap/extension-placeholder": "^2.11.5",
146
146
  "@tiptap/starter-kit": "^2.11.5",
147
- "@pixerate/editor": "0.136.0"
147
+ "@pixerate/editor": "0.137.0"
148
148
  },
149
149
  "peerDependencies": {
150
150
  "@dagrejs/dagre": "^1.1.4",