1
0
Fork 0
freesewing/markdown/dev/reference/api/design/en.md
2022-09-20 18:09:28 +02:00

1.2 KiB

title order
Design 10

The Design named export in FreeSewing's core library serves a single purpose: To create new pattern designs.

Design constructor

import { Design } from "@freesewing/core"

const Sorcha = new Design({ 
  // design configuration here
})

This constructor creates a new pattern design. It takes a single argument, an object holding the design's configuration.

Design configuration

Since a design's configuration is managed at the part level, the Design constructor only expects a parts attribute that should hold an array of parts to include in the Design.

const Sorcha = new Design({ 
  parts: [ front, back, sleeve ],
})

A Design in FreeSewing is little more than a container for various Parts

Optionally, you can also pass it a data attrbute to hold any custom data you'd like to add to your Design.

Any data you add to the Design constructor will be added to the Store.

const Sorcha = new Design({ 
  parts: [ front, back, sleeve ],
  data: {
    // Your custom data here
  }
})

This Design constructor is a super-constructor. It will return a constructor method that will a pattern based on your design.