diff --git a/.github/ISSUE_TEMPLATE/01_bug-report.yaml b/.github/ISSUE_TEMPLATE/01_bug-report.yaml
index 33d4f6b4ee7..6a2406c668b 100644
--- a/.github/ISSUE_TEMPLATE/01_bug-report.yaml
+++ b/.github/ISSUE_TEMPLATE/01_bug-report.yaml
@@ -78,7 +78,6 @@ body:
- plugins/plugin-bundle
- plugins/plugin-bust
- plugins/plugin-buttons
- - plugins/plugin-cutlist
- plugins/plugin-cutonfold
- plugins/plugin-dimension
- plugins/plugin-flip
diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml
index 0f369f044fe..451186fef79 100644
--- a/.github/boring-cyborg.yml
+++ b/.github/boring-cyborg.yml
@@ -12,7 +12,6 @@ labelPRBasedOnFilePath:
":electric_plug: plugin-annotations": [ plugins/plugin-annotations/* ]
":electric_plug: plugin-bundle": [ plugins/plugin-bundle/* ]
":electric_plug: plugin-bust": [ plugins/plugin-bust/* ]
- ":electric_plug: plugin-cutlist": [ plugins/plugin-cutlist/* ]
":electric_plug: plugin-flip": [ plugins/plugin-flip/* ]
":electric_plug: plugin-gore": [ plugins/plugin-gore/* ]
":electric_plug: plugin-i18n": [ plugins/plugin-i18n/* ]
diff --git a/config/software/plugins.json b/config/software/plugins.json
index 0969d65809e..9b320421c63 100644
--- a/config/software/plugins.json
+++ b/config/software/plugins.json
@@ -2,7 +2,6 @@
"plugin-annotations": "A FreeSewing plugin that provides pattern annotations",
"plugin-bundle": "An umbrella package of 8 essential FreeSewing build-time plugins",
"plugin-bust": "A FreeSewing plugin that helps with bust-adjusting menswear patterns",
- "plugin-cutlist": "A FreeSewing plugin to store data regarding a pattern's cutlist",
"plugin-flip": "A FreeSewing plugin to flip parts horizontally",
"plugin-gore": "A FreeSewing plugin to generate gores for a semi-sphere or dome",
"plugin-i18n": "A FreeSewing plugin for pattern translation",
diff --git a/designs/bella/src/front-side-dart.mjs b/designs/bella/src/front-side-dart.mjs
index 7cd380c5b40..3b2bc487ed5 100644
--- a/designs/bella/src/front-side-dart.mjs
+++ b/designs/bella/src/front-side-dart.mjs
@@ -1,10 +1,10 @@
import { back } from './back.mjs'
-import { pluginCutlist } from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-annotations'
export const frontSideDart = {
name: 'bella.frontSideDart',
after: back,
- plugins: [pluginCutlist],
+ plugins: [pluginAnnotations],
draft: ({
store,
sa,
diff --git a/designs/carlton/src/back.mjs b/designs/carlton/src/back.mjs
index 61f6d790c2f..b26a2a066db 100644
--- a/designs/carlton/src/back.mjs
+++ b/designs/carlton/src/back.mjs
@@ -1,7 +1,7 @@
import { back as bentBack } from '@freesewing/bent'
import { calculateRatios } from './shared.mjs'
import { hidePresets } from '@freesewing/core'
-import { pluginCutlist } from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-annotations'
function draftCarltonBack({
paperless,
@@ -250,6 +250,6 @@ export const back = {
waistEase: { pct: 14, min: 8, max: 25, menu: 'fit' },
seatEase: { pct: 14, min: 8, max: 25, menu: 'fit' },
},
- plugins: [pluginCutlist],
+ plugins: [pluginAnnotations],
draft: draftCarltonBack,
}
diff --git a/designs/carlton/src/front.mjs b/designs/carlton/src/front.mjs
index 8073c9ac16d..9b1f1ebc075 100644
--- a/designs/carlton/src/front.mjs
+++ b/designs/carlton/src/front.mjs
@@ -1,7 +1,7 @@
import { front as bentFront } from '@freesewing/bent'
import { calculateRatios } from './shared.mjs'
import { hidePresets } from '@freesewing/core'
-import { pluginCutlist } from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-annotations'
function draftCarltonFront({
paperless,
@@ -506,6 +506,6 @@ export const front = {
seatEase: { pct: 14, min: 8, max: 25, menu: 'fit' },
innerPocketWeltHeight: { pct: 3.5, min: 2.5, max: 5, menu: 'pockets' },
},
- plugins: [pluginCutlist],
+ plugins: [pluginAnnotations],
draft: draftCarltonFront,
}
diff --git a/designs/carlton/src/topsleeve.mjs b/designs/carlton/src/topsleeve.mjs
index 5c321ff24eb..b1cd7308869 100644
--- a/designs/carlton/src/topsleeve.mjs
+++ b/designs/carlton/src/topsleeve.mjs
@@ -1,6 +1,6 @@
import { topSleeve as bentTopSleeve } from '@freesewing/bent'
import { front as bentFront } from '@freesewing/bent'
-import { pluginCutlist } from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-annotations'
function draftCarltonTopSleeve({
paperless,
@@ -184,6 +184,6 @@ export const topSleeve = {
sleevecapHeight: { pct: 45, min: 40, max: 60, menu: 'advanced' },
sleevecapEase: { pct: 1, min: 0, max: 10, menu: 'advanced' },
},
- plugins: [pluginCutlist],
+ plugins: [pluginAnnotations],
draft: draftCarltonTopSleeve,
}
diff --git a/designs/carlton/src/undersleeve.mjs b/designs/carlton/src/undersleeve.mjs
index b76c0262cc2..cadfd0869ac 100644
--- a/designs/carlton/src/undersleeve.mjs
+++ b/designs/carlton/src/undersleeve.mjs
@@ -1,6 +1,6 @@
import { underSleeve as bentUnderSleeve } from '@freesewing/bent'
import { front as bentFront } from '@freesewing/bent'
-import { pluginCutlist } from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-annotations'
function draftCarltonUnderSleeve({
paperless,
@@ -163,6 +163,6 @@ export const underSleeve = {
sleevecapHeight: { pct: 45, min: 40, max: 60, menu: 'advanced' },
sleevecapEase: { pct: 1, min: 0, max: 10, menu: 'advanced' },
},
- plugins: [pluginCutlist],
+ plugins: [pluginAnnotations],
draft: draftCarltonUnderSleeve,
}
diff --git a/markdown/dev/howtos/design/cutlist/en.md b/markdown/dev/howtos/design/cutlist/en.md
index 25c2e040ab4..60bb185eb95 100644
--- a/markdown/dev/howtos/design/cutlist/en.md
+++ b/markdown/dev/howtos/design/cutlist/en.md
@@ -2,9 +2,9 @@
title: "Include Cutting Instructions"
---
-To include cutting instructions with your part, use the [cutlist plugin](/reference/plugins/cutlist) to add the [`cutlist.addCut` method](/reference/plugins/cutlist#addcut) to your part's [`store`](/reference/api/store/extend)
+To include cutting instructions with your part, use the [annotations plugin](/reference/plugins/annotations) to add the [`cutlist.addCut` method](/reference/plugins/cutlist#addcut) to your part's [`store`](/reference/api/store/extend)
-When you use the cutlist plugin, the [grainline plugin](/reference/plugins/grainline) and the [cut on fold plugin](/reference/plugins/cutonfold) will automatically add grain and fold information to the cutting instructions
+The [grainline macro](/reference/macros/grainline) and the [cutonfold macro](/reference/macros/cutonfold) will automatically add grain and fold information to the cutting instructions
These cutting instructions get used by the [title macro](/reference/macros/title), so be sure to add them before adding your part's title.
@@ -44,11 +44,11 @@ You can use any `string` you want for your material, but here are some standard
For simple cutting instructions, you can rely on the default method parameters
```js
-import {pluginCutlist} from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-cutlist'
const part = {
name: 'example.front',
- plugins: [pluginCutlist],
+ plugins: [pluginAnnotations],
draft: ({part, store}) => {
// add instructions to cut two mirrored from main fabric
store.cutlist.addCut()
@@ -64,11 +64,11 @@ For many designs, you'll want more than just "Cut 2 mirrored from Main Fabric"
You can override the default values to specify different materials, number of pieces to cut, and whether they should be mirrored or identical
```js
-import {pluginCutlist} from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-cutlist'
const part = {
name: 'example.front',
- plugins: [pluginCutlist],
+ plugins: [pluginAnnotations],
draft: ({part, store}) => {
// add instructions to cut three identical from lining
store.cutlist.addCut({cut: 3, material: 'lining', identical: true})
@@ -80,11 +80,11 @@ const part = {
You can add as many sets of instructions as you need
```js
-import {pluginCutlist} from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-cutlist'
const part = {
name: 'example.front',
- plugins: [pluginCutlist],
+ plugins: [pluginAnnotations],
draft: ({part, store}) => {
// add instructions to cut four mirrored from main fabric
store.cutlist.addCut({cut: 4})
@@ -100,12 +100,11 @@ const part = {
Sometimes you want some pieces cut on the fold and others cut as halves to seam together.
```js
-import {pluginCutlist} from '@freesewing/plugin-cutlist'
-import {pluginCutonfold} from '@freesewing/plugin-cutonfold'
+import { pluginAnnotations } from '@freesewing/plugin-cutlist'
const part = {
name: 'example.front',
- plugins: [pluginCutlist, pluginCutonfold],
+ plugins: [pluginAnnotations],
draft: ({part, points, Point, macro, store}) => {
// set the cut on fold line
points.p1 = new Point(0, 0)
@@ -127,12 +126,11 @@ const part = {
You set the grainline on a piece, but you also need some to be cut on the bias
```js
-import {pluginCutlist} from '@freesewing/plugin-cutlist'
-import {pluginGrainline} from '@freesewing/plugin-grainline'
+import { pluginAnnotations } from '@freesewing/plugin-cutlist'
const part = {
name: 'example.front',
- plugins: [pluginCutlist, pluginGrainline],
+ plugins: [pluginAnnotations],
draft: ({part, points, Point, macro, store}) => {
// set the cut on fold line
points.p1 = new Point(0, 0)
diff --git a/markdown/dev/reference/plugins/annotations/en.md b/markdown/dev/reference/plugins/annotations/en.md
index 189ba9e1f1b..aac9e1d9403 100644
--- a/markdown/dev/reference/plugins/annotations/en.md
+++ b/markdown/dev/reference/plugins/annotations/en.md
@@ -24,6 +24,7 @@ The annotations plugin provides the following macros:
- [bartackFractionAlong](/reference/macros/bartackfractionalong)
- [crossbox](/reference/macros/crossbox)
- [cutonfold](/reference/macros/cutonfold)
+- [grainline](/reference/macros/grainline)
- [hd](/reference/macros/hd)
- [ld](/reference/macros/ld)
- [rmad](/reference/macros/rmad)
@@ -35,6 +36,11 @@ The annotations plugin provides the following macros:
- [title](/reference/macros/title)
- [vd](/reference/macros/vd)
+The annotations plugin also provides [methods to the Store for adding cutting instructions](#methods)
+
+ For an in-depth look at how to add cutting instructions to your part, see our [cutlist how-to](/howtos/design/cutlist)
+
+
## Installation
```sh
@@ -54,6 +60,160 @@ import { annotationsPlugin } from '@freesewing/plugin-banner'
import { pluginAnnotations } from '@freesewing/plugin-banner'
```
+## Methods
+
+### store.cutlist.addCut
+
+The `store.cutlist.addCut()` method will add a set of cutting instructions for the part
+
+#### Signature
+```js
+store.cutlist.addCut(Object so)
+````
+
+Pass an object to the `store.cutlist.addCut` method with any of the following keys; any you don't provide will be filled with the defaults:
+
+| Key | Type | Default | Description |
+| :-- | :--- | :------ | :---------- |
+| cut | Number\|false | 2 | the number of pieces to cut from the specified material. Pass `false` to clear all cutting instructions for the material |
+| material | String | 'fabric' | the translation key of the material to cut from |
+| identical | Boolean | false | should even numbers of pieces be cut in the same direction? false for mirrored |
+| bias | Boolean | false | should the pieces in these cutting instructions be cut on the bias |
+| ignoreOnFold | Boolean | false | should these cutting instructions ignore any cutOnFold information set by the part |
+
+
+
+ You can use any `string` you want for your material, but here are some standard ones we have translation for
+
+
+| Key | Translation |
+|:--|:--|
+| fabric | Main Fabric |
+| lining | Lining |
+| canvas | Canvas |
+| lmhCanavas | Light to Medium Hair Canvas |
+| heavyCanvas | Heavyweight Hair Canvas |
+| interfacing | Interfacing |
+| plastic | Plastic |
+| ribbing | Ribbing |
+
+
+
+
+
+#### Example
+
+```js
+import {pluginCutlist} from '@freesewing/plugin-cutlist'
+
+const part = {
+ name: 'example.front',
+ plugins: [pluginCutlist],
+ draft: ({part, store}) => {
+ // add instructions to cut two from main fabric
+ store.cutlist.addCut()
+ // add instructions to cut four on the biad from lining
+ store.cutlist.addCut({cut: 4, material: 'lining', bias: true, })
+ return part
+ }
+}
+```
+
+You can also add multiple sets of cutting instructions for the same material
+```js
+import {pluginCutlist} from '@freesewing/plugin-cutlist'
+
+const part = {
+ name: 'example.front',
+ plugins: [pluginCutlist],
+ draft: ({part, store}) => {
+ // add instructions to 1 from lining
+ store.cutlist.addCut({cut: 1, material: 'lining'})
+ // add instructions to cut 1 on the bias from lining
+ store.cutlist.addCut({cut: 1, material: 'lining', bias: true, })
+ return part
+ }
+}
+```
+
+### store.cutlist.removeCut
+
+The `store.cutlist.removeCut()` method will remove cutting instructions from the part
+
+#### Signature
+
+```js
+store.cutlist.removeCut(String material)
+```
+
+#### Example
+```js
+import {pluginCutlist} from '@freesewing/plugin-cutlist'
+
+const part = {
+ name: 'example.front',
+ plugins: [pluginCutlist],
+ draft: ({part, store}) => {
+ // remove all cutting instructions for all materials
+ store.cutlist.removeCut()
+
+ // remove cutting instructions for just one material
+ store.cutlist.removeCut('fabric')
+ return part
+ }
+}
+```
+### store.cutlist.setGrain
+
+The `store.cutlist.setGrain()` method will record the angle of the grainline annotation. This method is called internally by [`plugin-grainline`](/reference/plugins/grainline) to store information for cutting layout tools. You shouldn't have to call it, but it's there if you need it.
+
+#### Signature
+
+```js
+store.cutlist.setGrain(Number grainAngle)
+```
+
+#### Example
+```js
+import {pluginCutlist} from '@freesewing/plugin-cutlist'
+
+const part = {
+ name: 'example.front',
+ plugins: [pluginCutlist],
+ draft: ({part, store}) => {
+ // set the grainline angle
+ store.cutlist.setGrain(0)
+ return part
+ }
+}
+```
+
+### store.cutlist.setCutOnFold
+The `store.cutlist.setCutOnFold()` method will record the points that make up the cut on fold line. This method is called internally by [`plugin-cutonfold`](/reference/plugins/cutonfold) to store information for cutting layout tools. You shouldn't have to call it, but it's there if you need it.
+
+#### Signature
+
+```js
+store.cutlist.setCutOnFold(Point p1, Point p2)
+```
+
+#### Example
+```js
+import {pluginCutlist} from '@freesewing/plugin-cutlist'
+
+const part = {
+ name: 'example.front',
+ plugins: [pluginCutlist],
+ draft: ({part, points, Point, store}) => {
+ // set the cut on fold line
+ points.p1 = new Point(0, 0)
+ points.p2 = new Point(0, 10)
+ store.cutlist.setCutOnFold(points.p1, points.p2)
+ return part
+ }
+}
+```
+
## Notes
The annotations plugin is part of our [plugin-bundle](/reference/plugins/bundle)
diff --git a/markdown/dev/reference/plugins/bundle/en.md b/markdown/dev/reference/plugins/bundle/en.md
index 689acee4dc8..439f719c8c9 100644
--- a/markdown/dev/reference/plugins/bundle/en.md
+++ b/markdown/dev/reference/plugins/bundle/en.md
@@ -8,20 +8,12 @@ commonly used FreeSewing time plugins in one handy package.
Specifically, loading this plugin will have the same effect as loading these
plugins individually:
-- [plugin-banner](/reference/plugins/banner) : Add repeating text to your patterns
-- [plugin-bartack](/reference/plugins/bartack) : Add bartacks to your patterns
-- [plugin-buttons](/reference/plugins/buttons) : Add buttons, buttonholes, and snaps to your patterns
-- [plugin-cutonfold](/reference/plugins/cutonfold) : Add cut-on-fold indicators to your patterns
-- [plugin-dimension](/reference/plugins/dimension) : Add dimensions to your (paperless) patterns
-- [plugin-grainline](/reference/plugins/grainline) : Add grainline indicators to your patterns
-- [plugin-logo](/reference/plugins/logo) : Add a FreeSewing logo to your patterns
+
+- [plugin-annotations](/reference/plugins/annotations)
- [plugin-measurements](/reference/plugins/measurements) : Make extra, calculated measurements available to your patterns
- [plugin-mirror](/reference/plugins/mirror) : Mirror points and paths in your patterns
-- [plugin-notches](/reference/plugins/notches) : Add notches to your patterns
-- [plugin-scalebox](/reference/plugins/scalebox) : Add scaleboxes to your pattern parts
- [plugin-round](/reference/plugins/round) : Create rounded corners in your patterns
- [plugin-sprinkle](/reference/plugins/sprinkle) : Add multiple snippets to your patterns
-- [plugin-title](/reference/plugins/title) : Add pretty titles to your pattern parts
## Installation
diff --git a/packages/new-design/templates/shared/package.json.mustache b/packages/new-design/templates/shared/package.json.mustache
index c2f472680f5..ef3c8d75f3d 100644
--- a/packages/new-design/templates/shared/package.json.mustache
+++ b/packages/new-design/templates/shared/package.json.mustache
@@ -45,7 +45,7 @@
"@freesewing/plugin-bundle": "$$ tag $$"
},
"devDependencies": {
- "@freesewing/plugin-cutlist": "$$ tag $$",
+ "@freesewing/plugin-annotations": "$$ tag $$",
"@freesewing/plugin-flip": "$$ tag $$",
"@freesewing/plugin-svgattr": "$$ tag $$",
"@freesewing/plugin-theme": "$$ tag $$",
diff --git a/plugins/plugin-cutlist/src/index.mjs b/plugins/plugin-annotations/src/cutlist.mjs
similarity index 88%
rename from plugins/plugin-cutlist/src/index.mjs
rename to plugins/plugin-annotations/src/cutlist.mjs
index e10c6e1ce72..b4068305cc1 100644
--- a/plugins/plugin-cutlist/src/index.mjs
+++ b/plugins/plugin-annotations/src/cutlist.mjs
@@ -1,17 +1,14 @@
-import { name, version } from '../data.mjs'
+export const cutlistStores = [
+ ['cutlist.addCut', addCut],
+ ['cutlist.removeCut', removeCut],
+ ['cutlist.setGrain', setGrain],
+ ['cutlist.setCutOnFold', setCutOnFold],
+ ['cutlist.getCutFabrics', getCutFabrics],
+]
-export const plugin = {
- name,
- version,
- store: [
- ['cutlist.addCut', addCut],
- ['cutlist.removeCut', removeCut],
- ['cutlist.setGrain', setGrain],
- ['cutlist.setCutOnFold', setCutOnFold],
- ['cutlist.getCutFabrics', getCutFabrics],
- ],
- hooks: {
- prePartDraft: (pattern) => {
+export const cutlistHooks = {
+ prePartDraft: [
+ function (pattern) {
const injectedPart = pattern.config.inject[pattern.activePart]
if (!injectedPart) return
@@ -19,13 +16,9 @@ export const plugin = {
const injectedCutlist = store.get(['cutlist', injectedPart], {})
store.set(['cutlist', pattern.activePart], { ...injectedCutlist })
},
- },
+ ],
}
-// More specifically named exports
-export const cutlistPlugin = plugin
-export const pluginCutlist = plugin
-
/**
* Add a set of cutting instructions for the part
* @param {Store} store the Store
diff --git a/plugins/plugin-annotations/src/cutonfold.mjs b/plugins/plugin-annotations/src/cutonfold.mjs
index ec2e12c9568..3cc29d6a1c1 100644
--- a/plugins/plugin-annotations/src/cutonfold.mjs
+++ b/plugins/plugin-annotations/src/cutonfold.mjs
@@ -24,10 +24,8 @@ export const cutonfoldMacros = {
delete points.cutonfoldVia1
delete points.cutonfoldVia2
delete paths.cutonfoldCutonfold
- // setCutOnFold relies on plugin-cutlist
- if (typeof store.cutlist?.setCutOnFold === 'function') {
- store.cutlist.setCutOnFold(false) // Restore default
- }
+
+ store.cutlist.setCutOnFold(false) // Restore default
return true
}
so = {
@@ -36,10 +34,11 @@ export const cutonfoldMacros = {
prefix: 'cutonfold',
...so,
}
- if (typeof store.cutlist?.setCutOnFold === 'function') {
- store.cutlist.setCutOnFold(so.from, so.to)
- if (so.grainline) store.cutlist.setGrain(so.from.angle(so.to))
- }
+
+ // store in cutlist
+ store.cutlist.setCutOnFold(so.from, so.to)
+ if (so.grainline) store.cutlist.setGrain(so.from.angle(so.to))
+
if (complete) {
points[so.prefix + 'From'] = so.from.shiftFractionTowards(so.to, so.margin / 100)
points[so.prefix + 'To'] = so.to.shiftFractionTowards(so.from, so.margin / 100)
diff --git a/plugins/plugin-annotations/src/grainline.mjs b/plugins/plugin-annotations/src/grainline.mjs
index d9fe7a4be6e..92c90800ecf 100644
--- a/plugins/plugin-annotations/src/grainline.mjs
+++ b/plugins/plugin-annotations/src/grainline.mjs
@@ -29,10 +29,10 @@ export const grainlineMacros = {
...dflts,
...so,
}
- // setGrain relies on plugin-cutlist
- if (typeof store.cutlist?.setGrain === 'function') {
- store.cutlist.setGrain(so.from.angle(so.to))
- }
+
+ // store in cutlist
+ store.cutlist.setGrain(so.from.angle(so.to))
+
if (complete) {
points.grainlineFrom = so.from.shiftFractionTowards(so.to, 0.05)
points.grainlineTo = so.to.shiftFractionTowards(so.from, 0.05)
diff --git a/plugins/plugin-annotations/src/index.mjs b/plugins/plugin-annotations/src/index.mjs
index 6596c99ba06..11cf575af5f 100644
--- a/plugins/plugin-annotations/src/index.mjs
+++ b/plugins/plugin-annotations/src/index.mjs
@@ -8,6 +8,7 @@ import { bannerMacros } from './banner.mjs'
import { bannerboxMacros } from './bannerbox.mjs'
import { bartackMacros } from './bartack.mjs'
import { crossboxMacros } from './crossbox.mjs'
+import { cutlistStores, cutlistHooks } from './cutlist.mjs'
import { scaleboxMacros } from './scalebox.mjs'
import { titleMacros } from './title.mjs'
// Hooks and Macros
@@ -31,6 +32,7 @@ export const plugin = {
...pleatHooks.preRender,
...sewtogetherHooks.preRender,
],
+ prePartDraft: [...cutlistHooks.prePartDraft],
},
macros: {
...bannerMacros,
@@ -45,6 +47,7 @@ export const plugin = {
...sewtogetherMacros,
...titleMacros,
},
+ store: [...cutlistStores],
}
export const annotationsPlugin = plugin
diff --git a/plugins/plugin-cutlist/tests/plugin.test.mjs b/plugins/plugin-annotations/tests/cutlist.test.mjs
similarity index 92%
rename from plugins/plugin-cutlist/tests/plugin.test.mjs
rename to plugins/plugin-annotations/tests/cutlist.test.mjs
index 03bcca6b599..6fa9fd19106 100644
--- a/plugins/plugin-cutlist/tests/plugin.test.mjs
+++ b/plugins/plugin-annotations/tests/cutlist.test.mjs
@@ -1,6 +1,6 @@
import chai from 'chai'
import { Design } from '@freesewing/core'
-import { plugin } from '../src/index.mjs'
+import { annotationsPlugin } from '../src/index.mjs'
const expect = chai.expect
@@ -14,7 +14,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -23,6 +23,7 @@ describe('Cutlist Plugin Tests', () => {
expect(methods.removeCut).to.be.a('function')
expect(methods.setGrain).to.be.a('function')
expect(methods.setCutOnFold).to.be.a('function')
+ expect(methods.getCutFabrics).to.be.a('function')
})
it('Should handle addCut() with defaults', () => {
@@ -33,7 +34,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -55,7 +56,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -79,7 +80,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -97,7 +98,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -116,7 +117,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -132,7 +133,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -149,7 +150,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -169,7 +170,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
@@ -193,7 +194,7 @@ describe('Cutlist Plugin Tests', () => {
return part
},
- plugins: [plugin],
+ plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const pattern = new Test()
diff --git a/plugins/plugin-bundle/src/index.mjs b/plugins/plugin-bundle/src/index.mjs
index 7c9adc59939..8d18d26f17f 100644
--- a/plugins/plugin-bundle/src/index.mjs
+++ b/plugins/plugin-bundle/src/index.mjs
@@ -4,7 +4,6 @@ import { measurementsPlugin } from '../../plugin-measurements/src/index.mjs'
import { mirrorPlugin } from '../../plugin-mirror/src/index.mjs'
import { roundPlugin } from '../../plugin-round/src/index.mjs'
import { sprinklePlugin } from '../../plugin-sprinkle/src/index.mjs'
-import { pluginCutlist } from '../../plugin-cutlist/src/index.mjs'
import { name, version } from '../data.mjs'
const bundledPlugins = [
@@ -13,7 +12,6 @@ const bundledPlugins = [
mirrorPlugin,
roundPlugin,
sprinklePlugin,
- pluginCutlist,
]
const hooks = {}
diff --git a/plugins/plugin-cutlist/CHANGELOG.md b/plugins/plugin-cutlist/CHANGELOG.md
deleted file mode 100644
index ab19f198610..00000000000
--- a/plugins/plugin-cutlist/CHANGELOG.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Change log for: @freesewing/plugin-cutlist
-
-
-
-This is the **initial release**, and the start of this change log.
-
-> Prior to version 2, FreeSewing was not a JavaScript project.
-> As such, that history is out of scope for this change log.
-
diff --git a/plugins/plugin-cutlist/README.md b/plugins/plugin-cutlist/README.md
deleted file mode 100644
index 182cd50584c..00000000000
--- a/plugins/plugin-cutlist/README.md
+++ /dev/null
@@ -1,301 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-# @freesewing/plugin-cutlist
-
-A FreeSewing plugin to store data regarding a pattern's cutlist
-
-
-
-
-> #### Note: Version 3 is a work in progress
->
-> We are working on a new major version (v3) but it is not ready for prime-time.
-> For production use, please refer to our v2 packages (the `latest` on NPM)
-> or [the `v2` branch in our monorepo](https://github.com/freesewing/freesewing/tree/v2).
->
-> We the `main` branch and `next` packages on NPM holds v3 code. But it's alpha for now.
-
-## What am I looking at? π€
-
-This repository is our *monorepo* holding all our NPM designs, plugins, other NPM packages, and (web)sites.
-
-This folder holds: @freesewing/plugin-cutlist
-
-If you're not entirely sure what to do or how to start, type this command:
-
-```
-npm run tips
-```
-
-> If you don't want to set up a dev environment, you can run it in your browser:
->
-> [](https://gitpod.io/#https://github.com/freesewing/freesewing)
->
-> We recommend that you fork our repository and then
-> put `gitpod.io/# to start up a browser-based dev environment of your own.
-
-## About FreeSewing π
-
-Where the world of makers and developers collide, that's where you'll find FreeSewing.
-
-If you're a maker, checkout [freesewing.org](https://freesewing.org/) where you can generate
-our sewing patterns adapted to your measurements.
-
-If you're a developer, our documentation is on [freesewing.dev](https://freesewing.dev/).
-Our [core library](https://freesewing.dev/reference/api/) is a *batteries-included* toolbox
-for parametric design of sewing patterns. But we also provide a range
-of [plugins](https://freesewing.dev/reference/plugins/) that further extend the
-functionality of the platform.
-
-If you have NodeJS installed, you can try it right now by running:
-
-```bash
-npx create-freesewing-pattern
-```
-
-Or, consult our getting started guides
-for [Linux](https://freesewing.dev/tutorials/getting-started-linux/),
-[MacOS](https://freesewing.dev/tutorials/getting-started-mac/),
-or [Windows](https://freesewing.dev/tutorials/getting-started-windows/).
-
-We also have a [pattern design tutorial](https://freesewing.dev/tutorials/pattern-design/) that
-walks you through your first parametric design,
-and [a friendly community](https://freesewing.org/community/where/) with
-people who can help you when you get stuck.
-
-## Support FreeSewing: Become a patron π₯°
-
-FreeSewing is an open source project run by a community,
-and financially supported by our patrons.
-
-If you feel what we do is worthwhile, and you can spend a few coind without
-hardship, then you should [join us and become a patron](https://freesewing.org/community/join).
-
-## Links π©βπ»
-
- - π» Makers website: [freesewing.org](https://freesewing.org)
- - π» Developers website: [freesewing.dev](https://freesewing.dev)
- - π¬ Chat: On Discord via [discord.freesewing.org](https://discord.freesewing.org/)
- - β
Todo list/Kanban board: On Github via [todo.freesewing.org](https://todo.freesewing.org/)
- - π¦ Twitter: [@freesewing_org](https://twitter.com/freesewing_org)
- - π· Instagram: [@freesewing_org](https://instagram.com/freesewing_org)
-
-## License: MIT π€
-
-Β© [Joost De Cock](https://github.com/joostdecock).
-See [the license file](https://github.com/freesewing/freesewing/blob/develop/LICENSE) for details.
-
-## Where to get help π€―
-
-Our [chatrooms on Discord](https://chat.freesewing.org/) are the best place to ask questions,
-share your feedback, or just hang out.
-
-If you want to report a problem, please [create an issue](https://github.com/freesewing/freesewing/issues/new).
-
-
-
-## Contributors β¨
-
-Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
-
-
-
-
-
-
-
-
-
-
-
-This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
-
diff --git a/plugins/plugin-cutlist/build.mjs b/plugins/plugin-cutlist/build.mjs
deleted file mode 100644
index 99ace216bc8..00000000000
--- a/plugins/plugin-cutlist/build.mjs
+++ /dev/null
@@ -1,35 +0,0 @@
-/* This script will build the package with esbuild */
-import esbuild from 'esbuild'
-import pkg from './package.json' assert { type: 'json' }
-
-// Create banner based on package info
-const banner = `/**
- * ${pkg.name} | v${pkg.version}
- * ${pkg.description}
- * (c) ${new Date().getFullYear()} ${pkg.author}
- * @license ${pkg.license}
- */`
-
-// Shared esbuild options
-const options = {
- banner: { js: banner },
- bundle: true,
- entryPoints: ['src/index.mjs'],
- format: 'esm',
- outfile: 'dist/index.mjs',
- external: ['@freesewing'],
- metafile: process.env.VERBOSE ? true : false,
- minify: process.env.NO_MINIFY ? false : true,
- sourcemap: true,
-}
-
-// Let esbuild generate the build
-const build = async () => {
- const result = await esbuild.build(options).catch(() => process.exit(1))
-
- if (process.env.VERBOSE) {
- const info = await esbuild.analyzeMetafile(result.metafile)
- console.log(info)
- }
-}
-build()
diff --git a/plugins/plugin-cutlist/data.mjs b/plugins/plugin-cutlist/data.mjs
deleted file mode 100644
index d8296ab499a..00000000000
--- a/plugins/plugin-cutlist/data.mjs
+++ /dev/null
@@ -1,4 +0,0 @@
-// This file is auto-generated | All changes you make will be overwritten.
-export const name = '@freesewing/plugin-cutlist'
-export const version = '3.0.0-alpha.9'
-export const data = { name, version }
diff --git a/plugins/plugin-cutlist/package.json b/plugins/plugin-cutlist/package.json
deleted file mode 100644
index 86f11ad3ea2..00000000000
--- a/plugins/plugin-cutlist/package.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{
- "name": "@freesewing/plugin-cutlist",
- "version": "3.0.0-alpha.9",
- "description": "A FreeSewing plugin to store data regarding a pattern's cutlist",
- "author": "Joost De Cock (https://github.com/joostdecock)",
- "homepage": "https://freesewing.org/",
- "repository": "github:freesewing/freesewing",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/freesewing/freesewing/issues"
- },
- "funding": {
- "type": "individual",
- "url": "https://freesewing.org/patrons/join"
- },
- "keywords": [
- "freesewing",
- "plugin",
- "sewing pattern",
- "sewing",
- "design",
- "parametric design",
- "made to measure",
- "diy",
- "fashion"
- ],
- "type": "module",
- "module": "dist/index.mjs",
- "exports": {
- ".": "./dist/index.mjs"
- },
- "scripts": {
- "build": "node build.mjs",
- "clean": "rimraf dist",
- "mbuild": "NO_MINIFY=1 node build.mjs",
- "symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
- "test": "npx mocha tests/*.test.mjs",
- "vbuild": "VERBOSE=1 node build.mjs",
- "lab": "cd ../../sites/lab && yarn start",
- "tips": "node ../../scripts/help.mjs",
- "lint": "npx eslint 'src/**' 'tests/*.mjs'",
- "prettier": "npx prettier --write 'src/*.mjs' 'tests/*.mjs'",
- "testci": "npx mocha tests/*.test.mjs --reporter ../../tests/reporters/terse.js",
- "cibuild_step1": "node build.mjs",
- "wbuild": "node build.mjs",
- "wcibuild_step1": "node build.mjs"
- },
- "peerDependencies": {
- "@freesewing/core": "3.0.0-alpha.9"
- },
- "dependencies": {},
- "devDependencies": {
- "mocha": "10.2.0",
- "chai": "4.3.7"
- },
- "files": [
- "dist/*",
- "README.md"
- ],
- "publishConfig": {
- "access": "public",
- "tag": "next"
- },
- "engines": {
- "node": ">=16.0.0",
- "npm": ">=8"
- }
-}
diff --git a/plugins/plugin-cutlist/tests/shared.test.mjs b/plugins/plugin-cutlist/tests/shared.test.mjs
deleted file mode 100644
index 7bf4f668398..00000000000
--- a/plugins/plugin-cutlist/tests/shared.test.mjs
+++ /dev/null
@@ -1,6 +0,0 @@
-// This file is auto-generated | Any changes you make will be overwritten.
-import { plugin } from '../src/index.mjs'
-import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
-
-// Run shared tests
-sharedPluginTests(plugin)
diff --git a/sites/shared/components/workbench/exporting/export-handler.mjs b/sites/shared/components/workbench/exporting/export-handler.mjs
index 5bfcc32500f..5b5b9dcf057 100644
--- a/sites/shared/components/workbench/exporting/export-handler.mjs
+++ b/sites/shared/components/workbench/exporting/export-handler.mjs
@@ -3,7 +3,7 @@ import fileSaver from 'file-saver'
import { themePlugin } from '@freesewing/plugin-theme'
import { pluginI18n } from '@freesewing/plugin-i18n'
import { pagesPlugin, fabricPlugin } from '../layout/plugin-layout-part.mjs'
-import { pluginCutlist } from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-annotations'
import { cutLayoutPlugin } from '../layout/cut/plugin-cut-layout.mjs'
import { fabricSettingsOrDefault } from '../layout/cut/index.mjs'
import { useFabricLength } from '../layout/cut/settings.mjs'
@@ -39,7 +39,7 @@ const themedPattern = (design, gist, overwrite, format, t) => {
// add the theme and translation to the pattern
pattern.use(themePlugin, { stripped: format !== 'svg', skipGrid: ['pages'] })
pattern.use(pluginI18n, { t })
- pattern.use(pluginCutlist)
+ pattern.use(pluginAnnotations)
return pattern
}
diff --git a/sites/shared/components/workbench/layout/cut/index.mjs b/sites/shared/components/workbench/layout/cut/index.mjs
index 484f535ca24..4a3445d2656 100644
--- a/sites/shared/components/workbench/layout/cut/index.mjs
+++ b/sites/shared/components/workbench/layout/cut/index.mjs
@@ -3,7 +3,7 @@ import { CutLayoutSettings } from './settings.mjs'
import { Draft } from '../draft/index.mjs'
import { fabricPlugin } from '../plugin-layout-part.mjs'
import { cutLayoutPlugin } from './plugin-cut-layout.mjs'
-import { pluginCutlist } from '@freesewing/plugin-cutlist'
+import { pluginAnnotations } from '@freesewing/plugin-annotations'
import { measurementAsMm } from 'shared/utils.mjs'
import { useEffect } from 'react'
import get from 'lodash.get'
@@ -43,8 +43,8 @@ const useFabricDraft = (gist, design, fabricSettings) => {
draft.use(fabricPlugin(layoutSettings))
// add the cutLayout plugin
draft.use(cutLayoutPlugin(fabricSettings.activeFabric, fabricSettings.grainDirection))
- // also, pluginCutlist and pluginFlip are needed
- draft.use(pluginCutlist)
+ // also, pluginAnnotations and pluginFlip are needed
+ draft.use(pluginAnnotations)
// draft the pattern
draft.draft()
diff --git a/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs b/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs
index 2d260922a15..71a4f725c84 100644
--- a/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs
+++ b/sites/shared/components/workbench/layout/cut/plugin-cut-layout.mjs
@@ -64,8 +64,7 @@ export const cutLayoutPlugin = function (material, grainAngle) {
part.attributes.remove('transform')
// if they shouldn't be identical, flip every other piece
- const flipped = !instruction.identical && c % 2 === 1
- if (flipped) {
+ if (!instruction.identical && c % 2 === 1) {
part.attributes.add(
'transform',
grainAngle === 90 ? 'scale(-1, 1)' : 'scale(1, -1)'
@@ -75,7 +74,6 @@ export const cutLayoutPlugin = function (material, grainAngle) {
macro('handleFoldAndGrain', {
partCutlist,
instruction,
- flipped,
})
// combine the transforms
@@ -97,7 +95,7 @@ export const cutLayoutPlugin = function (material, grainAngle) {
macros: {
...pluginMirror.macros,
// handle mirroring on the fold and rotating to sit along the grain or bias
- handleFoldAndGrain: ({ partCutlist, instruction, flipped }, { points, macro }) => {
+ handleFoldAndGrain: ({ partCutlist, instruction }, { points, macro }) => {
// get the grain angle for the part for this set of instructions
const grainSpec = partCutlist.grain
? partCutlist.grain + (instruction.bias ? 45 : 0)