Skip to content

AI-native design editor. Open-source Figma alternative.

feat(scene-graph)!: make a stroke a paint (#864)

Danila Poyarkovf55b887d2bdb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d0db256fa..25be7d7a3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
### Breaking changes
+- `Stroke` from `@open-pencil/scene-graph` extends `Fill`, so every stroke states a paint `type` that code constructing one must set to `'SOLID'`, and `copyStroke` deep-copies the paint fields a fill already copied. Rendering, `.fig` round-trips, and the stroke panel still handle solid strokes only.
- The editor state's `remoteCursors` is now `presenceCursors`, typed `PresenceCursor[]` from `@open-pencil/core/canvas`, and each cursor has a `kind` of `'person'` or `'agent'`.
- `VariableBinding` and the `colorVariableBinding` paint field are gone from `@open-pencil/core`, `@open-pencil/core/kiwi`, and the Kiwi `Paint` type. `fig.kiwi` never defined the field, so only `.fig` files OpenPencil itself wrote before `colorVar` contain one; reopening such a file leaves the paint's colour unbound, and binding it again records it the way Figma does.
- `encodeNodeChangeWithVariables`, `encodePaintWithVariableBinding`, and `encodeVarint` are removed from `@open-pencil/core` and `@open-pencil/core/kiwi`. They spliced a colour-variable binding into encoded bytes because the field had no schema entry; exports now write `colorVar`, which `fig.kiwi` defines, so nothing needs them. `parseVariableId` is unchanged.
diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts
index 5edc8891f..96d689660 100644
--- a/packages/core/src/constants.ts
+++ b/packages/core/src/constants.ts
@@ -488,6 +488,7 @@ export const SECTION_DEFAULT_FILL: Fill = {
}
export const SECTION_DEFAULT_STROKE: Stroke = {
+ type: 'SOLID',
color: { r: 0.55, g: 0.55, b: 0.55, a: 1 },
weight: 1,
opacity: 1,
diff --git a/packages/core/src/editor/shapes/pen.ts b/packages/core/src/editor/shapes/pen.ts
index 929e92569..0ea026a2b 100644
--- a/packages/core/src/editor/shapes/pen.ts
+++ b/packages/core/src/editor/shapes/pen.ts
@@ -26,6 +26,7 @@ type CreateShape = (
) => string
const PEN_DEFAULT_STROKE: SceneNode['strokes'][number] = {
+ type: 'SOLID',
color: BLACK,
weight: 2,
opacity: 1,
diff --git a/packages/core/src/icons/path-style.ts b/packages/core/src/icons/path-style.ts
index caf072386..4954ee74e 100644
--- a/packages/core/src/icons/path-style.ts
+++ b/packages/core/src/icons/path-style.ts
@@ -20,6 +20,7 @@ export function createPathStroke(
strokeJoin: string
): Stroke {
return {
+ type: 'SOLID',
color,
weight,
opacity: 1,
diff --git a/packages/core/src/tools/create/vector.ts b/packages/core/src/tools/create/vector.ts
index 0b0107390..db30c1c27 100644
--- a/packages/core/src/tools/create/vector.ts
+++ b/packages/core/src/tools/create/vector.ts
@@ -98,6 +98,7 @@ export const createVector = defineTool({
figma.graph.updateNode(node.id, {
strokes: [
{
+ type: 'SOLID',
color: parseColor(args.stroke),
weight: args.stroke_weight ?? 1,
opacity: 1,
diff --git a/packages/core/src/tools/modify/paint.ts b/packages/core/src/tools/modify/paint.ts
index 53cd8353c..5a3b480c1 100644
--- a/packages/core/src/tools/modify/paint.ts
+++ b/packages/core/src/tools/modify/paint.ts
@@ -86,6 +86,7 @@ export const setStroke = defineTool({
const c = parseColor(color)
node.strokes = [
{
+ type: 'SOLID',
color: c,
weight: weight,
opacity: 1,
diff --git a/packages/core/tests/editor/structure/flatten.test.ts b/packages/core/tests/editor/structure/flatten.test.ts
index 588398fea..c399d4e1e 100644
--- a/packages/core/tests/editor/structure/flatten.test.ts
+++ b/packages/core/tests/editor/structure/flatten.test.ts
@@ -80,7 +80,7 @@ describe('flattenSelected', () => {
width: 40,
height: 30,
fills: [{ type: 'SOLID', color: TRANSPARENT, opacity: 1, visible: true }],
- strokes: [{ color: BLACK, weight: 8, opacity: 1, visible: true, align: 'CENTER' }]
+ strokes: [{ type: 'SOLID', color: BLACK, weight: 8, opacity: 1, visible: true, align: 'CENTER' }]
})
editor.select([rect.id])
@@ -108,7 +108,7 @@ describe('flattenSelected', () => {
width: 40,
height: 30,
fills: [{ type: 'SOLID', color: TRANSPARENT, opacity: 1, visible: true }],
- strokes: [{ color: BLACK, weight: 8, opacity: 1, visible: true, align: 'CENTER' }]
+ strokes: [{ type: 'SOLID', color: BLACK, weight: 8, opacity: 1, visible: true, align: 'CENTER' }]
})
editor.select([rect.id])
editor.groupSelected()
@@ -366,7 +366,7 @@ describe('flattenSelected', () => {
width: 50,
height: 40,
fills: [],
- strokes: [{ color: BLACK, opacity: 1, visible: true, weight: 8, align: 'CENTER' }]
+ strokes: [{ type: 'SOLID', color: BLACK, opacity: 1, visible: true, weight: 8, align: 'CENTER' }]
})
editor.select([rect.id])
diff --git a/packages/core/tests/helpers/property-cases.ts b/packages/core/tests/helpers/property-cases.ts
index bab8fcbd8..1b7293f8b 100644
--- a/packages/core/tests/helpers/property-cases.ts
+++ b/packages/core/tests/helpers/property-cases.ts
@@ -12,7 +12,7 @@ function solidFill(color = RED, fields: Partial<Fill> = {}): Fill {
}
function stroke(fields: Partial<Stroke> = {}): Stroke {
- return { color: BLUE, weight: 1, opacity: 1, visible: true, align: 'INSIDE', ...fields }
+ return { type: 'SOLID', color: BLUE, weight: 1, opacity: 1, visible: true, align: 'INSIDE', ...fields }
}
export interface RoundTripCase {
@@ -137,7 +137,7 @@ export const PROPERTY_CASES: RoundTripCase[] = [
}),
leafCase('single stroke with every option', 'RECTANGLE', {
strokes: [
- stroke({ weight: 3, align: 'OUTSIDE', dashPattern: [4, 2], cap: 'ROUND', join: 'BEVEL' })
+ stroke({ type: 'SOLID', weight: 3, align: 'OUTSIDE', dashPattern: [4, 2], cap: 'ROUND', join: 'BEVEL' })
]
}),
leafCase('node-level stroke cap and join under a stroke without its own', 'RECTANGLE', {
diff --git a/packages/core/tests/io/formats/fig/export/color-variable-binding.test.ts b/packages/core/tests/io/formats/fig/export/color-variable-binding.test.ts
index 2e5bb5cfd..0e24e7fe2 100644
--- a/packages/core/tests/io/formats/fig/export/color-variable-binding.test.ts
+++ b/packages/core/tests/io/formats/fig/export/color-variable-binding.test.ts
@@ -60,6 +60,7 @@ describe('Figma export colour variable bindings', () => {
fills: [{ type: 'SOLID', color, opacity: 1, visible: true }],
strokes: [
{
+ type: 'SOLID',
color,
weight: 1,
opacity: 1,
diff --git a/packages/core/tests/io/formats/fig/roundtrip/variables.test.ts b/packages/core/tests/io/formats/fig/roundtrip/variables.test.ts
index 1770f2881..1323b8524 100644
--- a/packages/core/tests/io/formats/fig/roundtrip/variables.test.ts
+++ b/packages/core/tests/io/formats/fig/roundtrip/variables.test.ts
@@ -153,6 +153,7 @@ describe('variable roundtrip', () => {
],
strokes: [
{
+ type: 'SOLID',
color: { r: 0.1, g: 0.2, b: 0.3, a: 1 },
weight: 1,
opacity: 1,
diff --git a/packages/design-jsx/src/overrides/strokes.ts b/packages/design-jsx/src/overrides/strokes.ts
index da12b4171..0b1b05da0 100644
--- a/packages/design-jsx/src/overrides/strokes.ts
+++ b/packages/design-jsx/src/overrides/strokes.ts
@@ -57,6 +57,7 @@ function dashValue(value: unknown): number[] | undefined {
function toStroke(value: StrokeValue): Stroke {
const color = typeof value.color === 'string' ? parseColor(value.color) : value.color
const stroke: Stroke = {
+ type: 'SOLID',
color,
opacity: typeof value.opacity === 'number' ? value.opacity : color.a,
visible: value.visible ?? true,
diff --git a/packages/design-jsx/tests/export.test.ts b/packages/design-jsx/tests/export.test.ts
index e5da27394..631048a12 100644
--- a/packages/design-jsx/tests/export.test.ts
+++ b/packages/design-jsx/tests/export.test.ts
@@ -208,6 +208,7 @@ describe('sceneNodeToJSX', () => {
height: 100,
strokes: [
{
+ type: 'SOLID',
color: { r: 1, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
@@ -449,6 +450,7 @@ describe('sceneNodeAttributes', () => {
height: 50,
strokes: [
{
+ type: 'SOLID',
color: { r: 1, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
@@ -456,6 +458,7 @@ describe('sceneNodeAttributes', () => {
align: 'OUTSIDE'
},
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 1, a: 1 },
weight: 1,
opacity: 1,
diff --git a/packages/dom-css/src/import/css-values.ts b/packages/dom-css/src/import/css-values.ts
index 129344b64..5de8b988a 100644
--- a/packages/dom-css/src/import/css-values.ts
+++ b/packages/dom-css/src/import/css-values.ts
@@ -37,7 +37,7 @@ export function colorToStrokeFromCSS(
const color = parseCSSColor(colorValue)
const weight = parseCSSNumber(weightValue)
if (!color || weight === null || weight <= 0) return []
- return [{ color, weight, opacity: color.a, visible: true, align: 'INSIDE' }]
+ return [{ type: 'SOLID', color, weight, opacity: color.a, visible: true, align: 'INSIDE' }]
}
function firstShadowLayerNodes(value: string): ParsedNode[] {
diff --git a/packages/dom-css/tests/export/tailwind-jsx/appearance.test.ts b/packages/dom-css/tests/export/tailwind-jsx/appearance.test.ts
index 7d6f78bbb..e9da489f7 100644
--- a/packages/dom-css/tests/export/tailwind-jsx/appearance.test.ts
+++ b/packages/dom-css/tests/export/tailwind-jsx/appearance.test.ts
@@ -11,6 +11,7 @@ describe('Tailwind JSX appearance classes', () => {
fills: [{ type: 'SOLID', color: { r: 1, g: 1, b: 1, a: 1 }, opacity: 1, visible: true }],
strokes: [
{
+ type: 'SOLID',
color: { r: 1, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
diff --git a/packages/fig/src/node-change/paint.ts b/packages/fig/src/node-change/paint.ts
index 71e636d23..4336f1761 100644
--- a/packages/fig/src/node-change/paint.ts
+++ b/packages/fig/src/node-change/paint.ts
@@ -170,6 +170,7 @@ export function convertStrokes(
return paints.map((p) => {
const { color, opacity } = resolvedPaintColor(p)
return {
+ type: 'SOLID',
color,
weight: weight ?? 1,
opacity,
diff --git a/packages/pen/src/convert.ts b/packages/pen/src/convert.ts
index b228c927b..8d47b0334 100644
--- a/packages/pen/src/convert.ts
+++ b/packages/pen/src/convert.ts
@@ -313,6 +313,7 @@ export function convertStroke(
else if (stroke.align === 'outside') align = 'OUTSIDE'
const result: Stroke = {
+ type: 'SOLID',
visible: true,
color,
opacity: color.a,
diff --git a/packages/scene-graph/AGENTS.md b/packages/scene-graph/AGENTS.md
index 24ee69189..c94bdafe8 100644
--- a/packages/scene-graph/AGENTS.md
+++ b/packages/scene-graph/AGENTS.md
@@ -14,3 +14,4 @@ Framework-neutral document model. Owns node types, primitives, geometry, matrice
- Vector network types live here; the reverse-engineered `vectorNetworkBlob` codecs live in `packages/core/src/vector/`.
- `packages/scene-graph/src/checkpoint.ts` owns transaction checkpoint recovery, including hierarchy and indexes; Core's atomic tool execution relies on it.
- Export named types and primitives (`Color`, `Vector`, `Rect`, `SceneNode`, `Effect`, `Fill`, `Stroke`) from the public entry; downstream packages reuse them instead of respelling shapes.
+- `Stroke` extends `Fill`, so a stroke is a paint plus its geometry; add a paint field to `Fill` and both get it, and copy it in `copyFill`, which `copyStroke` reuses (`packages/scene-graph/src/copy.ts`).
diff --git a/packages/scene-graph/src/copy.ts b/packages/scene-graph/src/copy.ts
index 30ed782e4..b849d863f 100644
--- a/packages/scene-graph/src/copy.ts
+++ b/packages/scene-graph/src/copy.ts
@@ -28,8 +28,9 @@ import { cloneVectorNetwork } from './vector-network'
// --- Individual copy functions ---
-export function copyFill(f: Fill): Fill {
- const copy: Fill = { ...f, color: { ...f.color } }
+/** Generic over the paint shape so a stroke keeps its own fields while the paint deep-copies. */
+export function copyFill<T extends Fill>(f: T): T {
+ const copy: T = { ...f, color: { ...f.color } }
if (f.gradientStops) copy.gradientStops = f.gradientStops.map(copyGradientStop)
if (f.gradientTransform) copy.gradientTransform = { ...f.gradientTransform }
if (f.imageTransform) copy.imageTransform = { ...f.imageTransform }
@@ -39,7 +40,7 @@ export function copyFill(f: Fill): Fill {
}
export function copyStroke(s: Stroke): Stroke {
- const copy: Stroke = { ...s, color: { ...s.color } }
+ const copy = copyFill(s)
if (s.dashPattern) {
copy.dashPattern = [...s.dashPattern]
}
diff --git a/packages/scene-graph/src/types.ts b/packages/scene-graph/src/types.ts
index 69971b6bc..37f990880 100644
--- a/packages/scene-graph/src/types.ts
+++ b/packages/scene-graph/src/types.ts
@@ -206,11 +206,9 @@ export interface SharedStyle {
type: SharedStyleType
}
-export interface Stroke {
- color: Color
+/** A stroke is a paint with the geometry that decides where it is drawn. */
+export interface Stroke extends Fill {
weight: number
- opacity: number
- visible: boolean
align: 'INSIDE' | 'CENTER' | 'OUTSIDE'
cap?: StrokeCap
join?: StrokeJoin
diff --git a/packages/scene-graph/tests/copy.test.ts b/packages/scene-graph/tests/copy.test.ts
index 760fcfe02..77b190eea 100644
--- a/packages/scene-graph/tests/copy.test.ts
+++ b/packages/scene-graph/tests/copy.test.ts
@@ -47,20 +47,29 @@ describe('copy helpers — mutation isolation', () => {
expect(expectDefined(original.gradientTransform, 'original gradient transform').m00).toBe(1)
})
- test('copyStroke: dash pattern is independent', () => {
+ /** A stroke is a paint, so its nested paint data copies as deeply as a fill's does. */
+ test('copyStroke: dash pattern and nested paint data are independent', () => {
const original: Stroke = {
+ type: 'GRADIENT_LINEAR',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 1,
opacity: 1,
visible: true,
align: 'CENTER',
- dashPattern: [5, 3]
+ dashPattern: [5, 3],
+ gradientStops: [{ color: { r: 1, g: 0, b: 0, a: 1 }, position: 0 }],
+ gradientTransform: { m00: 1, m01: 0, m02: 0, m10: 0, m11: 1, m12: 0 }
}
const copy = copyStroke(original)
expectDefined(copy.dashPattern, 'copied dash pattern').push(99)
copy.color.g = 1
+ expectDefined(copy.gradientStops?.[0], 'copied gradient stop').color.r = 0
+ expectDefined(copy.gradientTransform, 'copied gradient transform').m00 = 99
+
expect(original.dashPattern).toEqual([5, 3])
expect(original.color.g).toBe(0)
+ expect(expectDefined(original.gradientStops?.[0], 'original gradient stop').color.r).toBe(1)
+ expect(expectDefined(original.gradientTransform, 'original gradient transform').m00).toBe(1)
})
test('copyEffect: offset and color are independent', () => {
diff --git a/packages/vue/src/controls/shared-style/model.ts b/packages/vue/src/controls/shared-style/model.ts
index 2442ec482..93227126c 100644
--- a/packages/vue/src/controls/shared-style/model.ts
+++ b/packages/vue/src/controls/shared-style/model.ts
@@ -12,6 +12,7 @@ function strokePaintsFromStyle(target: SceneNode, style: SceneNode): SceneNode['
const fills = style.fills.filter((fill) => fill.type === 'SOLID')
if (fills.length === 0) return target.strokes
const fallback = target.strokes[0] ?? {
+ type: 'SOLID' as const,
color: BLACK,
weight: 1,
opacity: 1,
diff --git a/packages/vue/src/controls/stroke/helpers.ts b/packages/vue/src/controls/stroke/helpers.ts
index 277d5e904..07aa08b07 100644
--- a/packages/vue/src/controls/stroke/helpers.ts
+++ b/packages/vue/src/controls/stroke/helpers.ts
@@ -33,6 +33,7 @@ export function isStrokeCapValue(value: string): value is StrokeCap {
return (STROKE_CAP_VALUES as string[]).includes(value)
}
export const DEFAULT_STROKE: Stroke = {
+ type: 'SOLID',
color: BLACK,
weight: 1,
opacity: 1,
diff --git a/src/app/demo/colors.ts b/src/app/demo/colors.ts
index 10c91fbb1..d8654a765 100644
--- a/src/app/demo/colors.ts
+++ b/src/app/demo/colors.ts
@@ -33,5 +33,5 @@ export function gradient(stops: GradientStop[]): Fill {
}
export function thinStroke(color: Color): Stroke[] {
- return [{ color, weight: 1, opacity: 1, visible: true, align: 'INSIDE' as const }]
+ return [{ type: 'SOLID', color, weight: 1, opacity: 1, visible: true, align: 'INSIDE' as const }]
}
diff --git a/tests/e2e/canvas/boolean-visual.spec.ts b/tests/e2e/canvas/boolean-visual.spec.ts
index a6ae22ead..7b14df9b0 100644
--- a/tests/e2e/canvas/boolean-visual.spec.ts
+++ b/tests/e2e/canvas/boolean-visual.spec.ts
@@ -32,6 +32,7 @@ test('boolean operations', async () => {
fills: [{ type: 'SOLID', color: colors[index], visible: true, opacity: 1 }],
strokes: [
{
+ type: 'SOLID',
color: { r: 0.08, g: 0.1, b: 0.18, a: 0.32 },
weight: 2,
visible: true,
diff --git a/tests/e2e/canvas/distance-measurement-edge-cases.spec.ts b/tests/e2e/canvas/distance-measurement-edge-cases.spec.ts
index 526c5dfd2..75db178ea 100644
--- a/tests/e2e/canvas/distance-measurement-edge-cases.spec.ts
+++ b/tests/e2e/canvas/distance-measurement-edge-cases.spec.ts
@@ -33,6 +33,7 @@ test('renders containment, multi-selection, rotation, and overlap edge cases', a
fills: fill(1, 1, 1),
strokes: [
{
+ type: 'SOLID',
color: { r: 0.7, g: 0.7, b: 0.7, a: 1 },
weight: 1,
opacity: 1,
diff --git a/tests/e2e/canvas/fill-modes-visual.spec.ts b/tests/e2e/canvas/fill-modes-visual.spec.ts
index 2491d98f9..d47ffb379 100644
--- a/tests/e2e/canvas/fill-modes-visual.spec.ts
+++ b/tests/e2e/canvas/fill-modes-visual.spec.ts
@@ -180,6 +180,7 @@ test('gradients and image fill modes', async () => {
],
strokes: [
{
+ type: 'SOLID',
color: { r: 1, g: 1, b: 1, a: 0.9 },
weight: 2,
visible: true,
diff --git a/tests/e2e/canvas/label-anatomy.spec.ts b/tests/e2e/canvas/label-anatomy.spec.ts
index 1ba461320..7d10e2c74 100644
--- a/tests/e2e/canvas/label-anatomy.spec.ts
+++ b/tests/e2e/canvas/label-anatomy.spec.ts
@@ -53,6 +53,7 @@ test('reused Unicode section labels match fresh paragraphs across zoom reversals
fills: [{ type: 'SOLID', color: { r: 1, g: 1, b: 1, a: 1 }, opacity: 1, visible: true }],
strokes: [
{
+ type: 'SOLID',
color: { r: 0.7, g: 0.7, b: 0.7, a: 1 },
weight: 1,
opacity: 1,
@@ -164,6 +165,7 @@ for (const zoom of [0.5, 1, 2]) {
fills: [{ type: 'SOLID', color: { r: 1, g: 1, b: 1, a: 1 }, opacity: 1, visible: true }],
strokes: [
{
+ type: 'SOLID',
color: { r: 0.7, g: 0.7, b: 0.7, a: 1 },
weight: 1,
opacity: 1,
diff --git a/tests/e2e/canvas/pattern-mask-visual.spec.ts b/tests/e2e/canvas/pattern-mask-visual.spec.ts
index 152afbe89..9cabf8cb2 100644
--- a/tests/e2e/canvas/pattern-mask-visual.spec.ts
+++ b/tests/e2e/canvas/pattern-mask-visual.spec.ts
@@ -49,6 +49,7 @@ test('pattern fills from source nodes', async () => {
],
strokes: [
{
+ type: 'SOLID',
color: { r: 0.08, g: 0.1, b: 0.18, a: 0.18 },
weight: 2,
visible: true,
@@ -115,6 +116,7 @@ test('luminance masks and transformed tile fills', async () => {
],
strokes: [
{
+ type: 'SOLID',
color: { r: 1, g: 1, b: 1, a: 0.85 },
weight: 2,
visible: true,
diff --git a/tests/e2e/canvas/stroke-geometry-visual.spec.ts b/tests/e2e/canvas/stroke-geometry-visual.spec.ts
index 83d5c29bf..16a8a13b0 100644
--- a/tests/e2e/canvas/stroke-geometry-visual.spec.ts
+++ b/tests/e2e/canvas/stroke-geometry-visual.spec.ts
@@ -29,6 +29,7 @@ test('stroke caps joins and miter limits', async () => {
strokeCap: cap,
strokes: [
{
+ type: 'SOLID',
color,
weight: 20,
visible: true,
@@ -59,6 +60,7 @@ test('stroke caps joins and miter limits', async () => {
strokeMiterLimit: limit,
strokes: [
{
+ type: 'SOLID',
color: { r: 0.96, g: 0.35, b: 0.12, a: 1 },
weight: 10,
visible: true,
diff --git a/tests/e2e/canvas/vector/winding.spec.ts b/tests/e2e/canvas/vector/winding.spec.ts
index 3ed6ee1fc..9bc1680db 100644
--- a/tests/e2e/canvas/vector/winding.spec.ts
+++ b/tests/e2e/canvas/vector/winding.spec.ts
@@ -22,6 +22,7 @@ test('mixed vector regions keep open stroke segments', async () => {
],
strokes: [
{
+ type: 'SOLID',
color: { r: 0.95, g: 0.25, b: 0.15, a: 1 },
weight: 8,
opacity: 1,
diff --git a/tests/e2e/properties/effects.spec.ts b/tests/e2e/properties/effects.spec.ts
index 98a8566e0..59352ca00 100644
--- a/tests/e2e/properties/effects.spec.ts
+++ b/tests/e2e/properties/effects.spec.ts
@@ -342,6 +342,7 @@ test('smoothed corners with blended shadow', async () => {
],
strokes: [
{
+ type: 'SOLID',
color: { r: 1, g: 1, b: 1, a: 0.8 },
weight: 2,
visible: true,
diff --git a/tests/e2e/properties/stroke-settings.spec.ts b/tests/e2e/properties/stroke-settings.spec.ts
index 5b2b84109..46d66da01 100644
--- a/tests/e2e/properties/stroke-settings.spec.ts
+++ b/tests/e2e/properties/stroke-settings.spec.ts
@@ -18,6 +18,7 @@ for (const theme of ['light', 'dark']) {
editor.updateNode(target, {
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
diff --git a/tests/e2e/properties/unresolved-binding.spec.ts b/tests/e2e/properties/unresolved-binding.spec.ts
index 790b74385..73b261790 100644
--- a/tests/e2e/properties/unresolved-binding.spec.ts
+++ b/tests/e2e/properties/unresolved-binding.spec.ts
@@ -52,6 +52,7 @@ for (const theme of ['light', 'dark']) {
editor.updateNode(id, {
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 1,
opacity: 1,
diff --git a/tests/e2e/stroke-picker/basic.spec.ts b/tests/e2e/stroke-picker/basic.spec.ts
index 6d7f52396..91b6ec59e 100644
--- a/tests/e2e/stroke-picker/basic.spec.ts
+++ b/tests/e2e/stroke-picker/basic.spec.ts
@@ -102,6 +102,7 @@ test('stroke picker hsb saturation and brightness sliders update stroke color on
}
if (owner && owner.id !== store.state.currentPageId) await store.switchPage(owner.id)
const stroke = {
+ type: 'SOLID',
color: { r: 0.9, g: 0.9, b: 0.92, a: 1 },
weight: 1,
opacity: 1,
diff --git a/tests/engine/color/okhcl/basic.test.ts b/tests/engine/color/okhcl/basic.test.ts
index 2663d8b45..97d35ff51 100644
--- a/tests/engine/color/okhcl/basic.test.ts
+++ b/tests/engine/color/okhcl/basic.test.ts
@@ -38,7 +38,14 @@ describe('OkHCL metadata', () => {
const api = new FigmaAPI(graph)
const frame = api.createFrame()
frame.strokes = [
- { color: { r: 0, g: 0, b: 0, a: 1 }, weight: 1, opacity: 1, visible: true, align: 'INSIDE' }
+ {
+ type: 'SOLID',
+ color: { r: 0, g: 0, b: 0, a: 1 },
+ weight: 1,
+ opacity: 1,
+ visible: true,
+ align: 'INSIDE'
+ }
]
frame.setStrokeOkHCL({ h: 20, c: 0.08, l: 0.6 })
@@ -70,7 +77,14 @@ describe('OkHCL metadata', () => {
frame.name = 'OKHCL frame'
frame.fills = [{ type: 'SOLID', visible: true, opacity: 1, color: { r: 0, g: 0, b: 0, a: 1 } }]
frame.strokes = [
- { color: { r: 0, g: 0, b: 0, a: 1 }, weight: 1, opacity: 1, visible: true, align: 'INSIDE' }
+ {
+ type: 'SOLID',
+ color: { r: 0, g: 0, b: 0, a: 1 },
+ weight: 1,
+ opacity: 1,
+ visible: true,
+ align: 'INSIDE'
+ }
]
frame.setFillOkHCL({ h: 210, c: 0.1, l: 0.65 })
frame.setStrokeOkHCL({ h: 320, c: 0.09, l: 0.55, a: 0.9 })
diff --git a/tests/engine/color/okhcl/document-color-space.test.ts b/tests/engine/color/okhcl/document-color-space.test.ts
index 38be6d977..1e81c1233 100644
--- a/tests/engine/color/okhcl/document-color-space.test.ts
+++ b/tests/engine/color/okhcl/document-color-space.test.ts
@@ -18,7 +18,14 @@ function createNode() {
return graph.createNode('RECTANGLE', page.id, {
fills: [{ type: 'SOLID', color: { r: 0, g: 0, b: 0, a: 1 }, opacity: 1, visible: true }],
strokes: [
- { color: { r: 0, g: 0, b: 0, a: 1 }, weight: 1, opacity: 1, visible: true, align: 'INSIDE' }
+ {
+ type: 'SOLID',
+ color: { r: 0, g: 0, b: 0, a: 1 },
+ weight: 1,
+ opacity: 1,
+ visible: true,
+ align: 'INSIDE'
+ }
]
})
}
diff --git a/tests/engine/color/okhcl/ui-logic.test.ts b/tests/engine/color/okhcl/ui-logic.test.ts
index 1dd26878e..881a735d9 100644
--- a/tests/engine/color/okhcl/ui-logic.test.ts
+++ b/tests/engine/color/okhcl/ui-logic.test.ts
@@ -32,7 +32,14 @@ describe('OkHCL metadata toggling', () => {
const page = graph.getPages()[0]
const node = graph.createNode('FRAME', page.id, {
strokes: [
- { color: { r: 0, g: 0, b: 1, a: 1 }, weight: 1, opacity: 1, visible: true, align: 'INSIDE' }
+ {
+ type: 'SOLID',
+ color: { r: 0, g: 0, b: 1, a: 1 },
+ weight: 1,
+ opacity: 1,
+ visible: true,
+ align: 'INSIDE'
+ }
]
})
diff --git a/tests/engine/figma/api/layout/plugin-compat.test.ts b/tests/engine/figma/api/layout/plugin-compat.test.ts
index a6da4aa54..222363450 100644
--- a/tests/engine/figma/api/layout/plugin-compat.test.ts
+++ b/tests/engine/figma/api/layout/plugin-compat.test.ts
@@ -23,6 +23,7 @@ describe('Figma Plugin API layout compatibility', () => {
frame.cornerRadius = 7
frame.strokes = [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 3,
opacity: 1,
@@ -154,6 +155,7 @@ describe('Figma Plugin API layout compatibility', () => {
rect.resize(10, 20)
rect.strokes = [
{
+ type: 'SOLID',
color: { r: 1, g: 0, b: 0, a: 1 },
weight: 4,
opacity: 1,
diff --git a/tests/engine/figma/api/stroke/details.test.ts b/tests/engine/figma/api/stroke/details.test.ts
index e204dcc83..ab3b6ab80 100644
--- a/tests/engine/figma/api/stroke/details.test.ts
+++ b/tests/engine/figma/api/stroke/details.test.ts
@@ -7,7 +7,14 @@ describe('stroke details', () => {
const api = createAPI()
const rect = api.createRectangle()
rect.strokes = [
- { color: { r: 0, g: 0, b: 0, a: 1 }, weight: 2, opacity: 1, visible: true, align: 'CENTER' }
+ {
+ type: 'SOLID',
+ color: { r: 0, g: 0, b: 0, a: 1 },
+ weight: 2,
+ opacity: 1,
+ visible: true,
+ align: 'CENTER'
+ }
]
expect(rect.strokeWeight).toBe(2)
expect(rect.strokeAlign).toBe('CENTER')
@@ -19,7 +26,14 @@ describe('stroke details', () => {
const api = createAPI()
const line = api.createLine()
line.strokes = [
- { color: { r: 0, g: 0, b: 0, a: 1 }, weight: 2, opacity: 1, visible: true, align: 'CENTER' }
+ {
+ type: 'SOLID',
+ color: { r: 0, g: 0, b: 0, a: 1 },
+ weight: 2,
+ opacity: 1,
+ visible: true,
+ align: 'CENTER'
+ }
]
expect(line.strokeCap).toBe('NONE')
expect(line.strokeJoin).toBe('MITER')
diff --git a/tests/engine/figma/api/stroke/individual-strokes.test.ts b/tests/engine/figma/api/stroke/individual-strokes.test.ts
index 8c2c6b523..be4d00faf 100644
--- a/tests/engine/figma/api/stroke/individual-strokes.test.ts
+++ b/tests/engine/figma/api/stroke/individual-strokes.test.ts
@@ -10,6 +10,7 @@ function pageId(graph: SceneGraph) {
function rectWithStroke(graph: SceneGraph, name: string, strokeOverrides: Partial<Stroke> = {}) {
const stroke: Stroke = {
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
@@ -48,7 +49,11 @@ describe('Stroke align', () => {
test('updating stroke align preserves other stroke properties', () => {
const graph = new SceneGraph()
- const node = rectWithStroke(graph, 'R', { weight: 5, align: 'CENTER' })
+ const node = rectWithStroke(graph, 'R', {
+ type: 'SOLID',
+ weight: 5,
+ align: 'CENTER'
+ })
const strokes = [...node.strokes]
strokes[0] = { ...strokes[0], align: 'INSIDE' }
graph.updateNode(node.id, { strokes })
@@ -157,6 +162,7 @@ describe('Instance sync with stroke weights', () => {
name: 'Comp',
strokes: [
{
+ type: 'SOLID',
color: { r: 1, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
@@ -276,6 +282,7 @@ describe('FigmaAPI stroke properties', () => {
const rect = api.createRectangle()
rect.strokes = [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
@@ -302,6 +309,7 @@ describe('FigmaAPI stroke properties', () => {
const rect = api.createRectangle()
rect.strokes = [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
@@ -317,6 +325,7 @@ describe('FigmaAPI stroke properties', () => {
const rect = api.createRectangle()
rect.strokes = [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
diff --git a/tests/engine/geometry/arrow-caps.test.ts b/tests/engine/geometry/arrow-caps.test.ts
index 1399b7d72..0125aa6a9 100644
--- a/tests/engine/geometry/arrow-caps.test.ts
+++ b/tests/engine/geometry/arrow-caps.test.ts
@@ -222,6 +222,7 @@ describe('lineArrowEndpoints', () => {
function stroke(overrides: Partial<Stroke> = {}): Stroke {
return {
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 4,
opacity: 1,
diff --git a/tests/engine/geometry/visual-bounds.test.ts b/tests/engine/geometry/visual-bounds.test.ts
index af1f5e682..750cd2c49 100644
--- a/tests/engine/geometry/visual-bounds.test.ts
+++ b/tests/engine/geometry/visual-bounds.test.ts
@@ -74,6 +74,7 @@ describe('computeVisualBounds', () => {
height: 60,
strokes: [
{
+ type: 'SOLID',
weight: 10,
visible: true,
align: 'OUTSIDE' as const,
@@ -100,6 +101,7 @@ describe('computeVisualBounds', () => {
height: 60,
strokes: [
{
+ type: 'SOLID',
weight: 100,
visible: false,
align: 'OUTSIDE' as const,
@@ -125,6 +127,7 @@ describe('computeVisualBounds', () => {
height: 60,
strokes: [
{
+ type: 'SOLID',
weight: 10,
visible: true,
align: 'CENTER' as const,
@@ -151,6 +154,7 @@ describe('computeVisualBounds', () => {
height: 60,
strokes: [
{
+ type: 'SOLID',
weight: 10,
visible: true,
align: 'INSIDE' as const,
@@ -262,6 +266,7 @@ describe('computeVisualBounds', () => {
height: 60,
strokes: [
{
+ type: 'SOLID',
weight: 5,
visible: true,
align: 'OUTSIDE' as const,
@@ -309,6 +314,7 @@ describe('computeVisualBounds', () => {
height: 60,
strokes: [
{
+ type: 'SOLID',
weight: 2,
visible: true,
align: 'OUTSIDE' as const,
@@ -316,6 +322,7 @@ describe('computeVisualBounds', () => {
opacity: 1
},
{
+ type: 'SOLID',
weight: 8,
visible: true,
align: 'CENTER' as const,
@@ -323,6 +330,7 @@ describe('computeVisualBounds', () => {
opacity: 1
},
{
+ type: 'SOLID',
weight: 4,
visible: true,
align: 'INSIDE' as const,
@@ -357,6 +365,7 @@ describe('computeVisualBounds', () => {
visible: true,
strokes: [
{
+ type: 'SOLID',
weight: 1,
visible: true,
align: 'INSIDE' as const,
@@ -375,6 +384,7 @@ describe('computeVisualBounds', () => {
visible: true,
strokes: [
{
+ type: 'SOLID',
weight: 1,
visible: true,
align: 'OUTSIDE' as const,
@@ -419,7 +429,7 @@ describe('computeVisualBounds', () => {
height: 0,
visible: true,
strokeCap: 'ARROW_EQUILATERAL' as const,
- strokes: [{ weight: 4, visible: true, align: 'CENTER' as const }],
+ strokes: [{ type: 'SOLID', weight: 4, visible: true, align: 'CENTER' as const }],
childIds: []
}
}
diff --git a/tests/engine/io/fig/import/field-protection.test.ts b/tests/engine/io/fig/import/field-protection.test.ts
index a137d6e10..979fbd13a 100644
--- a/tests/engine/io/fig/import/field-protection.test.ts
+++ b/tests/engine/io/fig/import/field-protection.test.ts
@@ -26,6 +26,7 @@ const blueFill: Fill = {
}
const redStroke: Stroke = {
+ type: 'SOLID',
color: { r: 1, g: 0, b: 0, a: 1 },
weight: 1,
opacity: 1,
@@ -37,6 +38,7 @@ const redStroke: Stroke = {
}
const blueStroke: Stroke = {
+ type: 'SOLID',
color: { r: 0, g: 0, b: 1, a: 1 },
weight: 1,
opacity: 1,
diff --git a/tests/engine/io/pptx/export/helpers.ts b/tests/engine/io/pptx/export/helpers.ts
index 39d6332aa..4cf268630 100644
--- a/tests/engine/io/pptx/export/helpers.ts
+++ b/tests/engine/io/pptx/export/helpers.ts
@@ -22,7 +22,14 @@ export function solidFill(r: number, g: number, b: number, a = 1): Fill {
}
export function solidStroke(r: number, g: number, b: number, a = 1, weight = 2): Stroke {
- return { color: { r, g, b, a }, weight, opacity: 1, visible: true, align: 'CENTER' }
+ return {
+ type: 'SOLID',
+ color: { r, g, b, a },
+ weight,
+ opacity: 1,
+ visible: true,
+ align: 'CENTER'
+ }
}
export function pageId(graph: SceneGraph): string {
diff --git a/tests/engine/io/svg/export/render.test.ts b/tests/engine/io/svg/export/render.test.ts
index ef7d45adf..2fa3d5f23 100644
--- a/tests/engine/io/svg/export/render.test.ts
+++ b/tests/engine/io/svg/export/render.test.ts
@@ -75,6 +75,7 @@ describe('renderNodesToSVG()', () => {
height: 0,
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
@@ -232,6 +233,7 @@ describe('renderNodesToSVG()', () => {
height: 100,
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 2,
opacity: 1,
@@ -252,6 +254,7 @@ describe('renderNodesToSVG()', () => {
height: 100,
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 3,
opacity: 1,
@@ -521,6 +524,7 @@ describe('renderNodesToSVG()', () => {
height: 100,
strokes: [
{
+ type: 'SOLID',
color: { r: 1, g: 0, b: 0, a: 1 },
weight: 1,
opacity: 0.5,
diff --git a/tests/engine/layout/auto-layout/layout/imported-derived.test.ts b/tests/engine/layout/auto-layout/layout/imported-derived.test.ts
index 0787193fd..6a1c34647 100644
--- a/tests/engine/layout/auto-layout/layout/imported-derived.test.ts
+++ b/tests/engine/layout/auto-layout/layout/imported-derived.test.ts
@@ -52,6 +52,7 @@ describe('imported auto-layout bounds', () => {
],
strokes: [
{
+ type: 'SOLID',
color: { r: 0.58, g: 0.64, b: 0.72, a: 1 },
weight: 2,
opacity: 1,
@@ -91,6 +92,7 @@ describe('imported auto-layout bounds', () => {
],
strokes: [
{
+ type: 'SOLID',
color: { r: 0.8, g: 0.84, b: 0.88, a: 1 },
weight: 1,
opacity: 1,
@@ -116,6 +118,7 @@ describe('imported auto-layout bounds', () => {
rotation: 90,
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 1,
opacity: 1,
@@ -150,6 +153,7 @@ describe('imported auto-layout bounds', () => {
paddingBottom: 4,
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 1,
opacity: 1,
diff --git a/tests/engine/render/canvas/line.test.ts b/tests/engine/render/canvas/line.test.ts
index 4dd02a1dc..7cd51ea24 100644
--- a/tests/engine/render/canvas/line.test.ts
+++ b/tests/engine/render/canvas/line.test.ts
@@ -28,6 +28,7 @@ describe('line rendering', () => {
rotation: 90,
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 1,
opacity: 1,
diff --git a/tests/engine/tools/analyze/overlaps/bounds.test.ts b/tests/engine/tools/analyze/overlaps/bounds.test.ts
index 5a753513a..65332c652 100644
--- a/tests/engine/tools/analyze/overlaps/bounds.test.ts
+++ b/tests/engine/tools/analyze/overlaps/bounds.test.ts
@@ -198,6 +198,7 @@ describe('analyze overlaps visible bounds', () => {
rotation: 45,
strokes: [
{
+ type: 'SOLID',
color: { r: 0, g: 0, b: 0, a: 1 },
weight: 20,
opacity: 1,
diff --git a/tests/engine/tools/describe.test.ts b/tests/engine/tools/describe.test.ts
index 89c369849..6345c3edc 100644
--- a/tests/engine/tools/describe.test.ts
+++ b/tests/engine/tools/describe.test.ts
@@ -8,6 +8,7 @@ import { getTool, setupToolTest, type ToolResult } from '#tests/helpers/tools'
const NAVY: Color = { r: 2 / 255, g: 26 / 255, b: 59 / 255, a: 1 }
const HIDDEN_STROKE: Stroke = {
+ type: 'SOLID',
color: { r: 1, g: 0, b: 0, a: 1 },
weight: 4,
opacity: 1,
@@ -18,6 +19,7 @@ const HIDDEN_STROKE: Stroke = {
}
const VISIBLE_STROKE: Stroke = {
+ type: 'SOLID',
color: NAVY,
weight: 10.126,
opacity: 1,
diff --git a/tests/engine/vue/input/resize/path-text/basic.test.ts b/tests/engine/vue/input/resize/path-text/basic.test.ts
index 666281392..f9384c9a7 100644
--- a/tests/engine/vue/input/resize/path-text/basic.test.ts
+++ b/tests/engine/vue/input/resize/path-text/basic.test.ts
@@ -21,6 +21,7 @@ const BLACK: Fill = {
}
const WHITE_STROKE: Stroke = {
+ type: 'SOLID',
color: { r: 1, g: 1, b: 1, a: 1 },
weight: 4,
opacity: 1,
diff --git a/tests/engine/vue/input/resize/path-text/reflow.test.ts b/tests/engine/vue/input/resize/path-text/reflow.test.ts
index 871bf893d..11e263d28 100644
--- a/tests/engine/vue/input/resize/path-text/reflow.test.ts
+++ b/tests/engine/vue/input/resize/path-text/reflow.test.ts
@@ -22,6 +22,7 @@ const BLACK: Fill = {
}
const WHITE_STROKE: Stroke = {
+ type: 'SOLID',
color: { r: 1, g: 1, b: 1, a: 1 },
weight: 4,
opacity: 1,