feat: Initial commit of Teagan, a T-shirt pattern
This commit is contained in:
parent
85822eb388
commit
6fc80e75d4
33 changed files with 1306 additions and 4 deletions
32
.github/workflows/tests.teagan.yml
vendored
Normal file
32
.github/workflows/tests.teagan.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Unit tests - Teagan
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Install dependencies
|
||||
run: cd packages/teagan && npm install
|
||||
env:
|
||||
CI: true
|
||||
- name: Install peer & test dependencies
|
||||
run: "cd packages/teagan && npm install @freesewing/core@^2.8.1 @freesewing/plugin-bundle@^2.8.1 @freesewing/models@2.8.1 @freesewing/pattern-info@2.8.1 mocha chai"
|
||||
env:
|
||||
CI: true
|
||||
- name: Build pattern
|
||||
run: cd packages/teagan && npm run build
|
||||
- name: Run pattern unit tests
|
||||
run: cd packages/teagan && npm run testci
|
|
@ -1,5 +1,7 @@
|
|||
Unreleased:
|
||||
date:
|
||||
Added:
|
||||
teagan: Teagan is a T-shirt pattern
|
||||
Fixed:
|
||||
benjamin:
|
||||
- Fixed issue with (length of) band
|
||||
|
|
|
@ -58,6 +58,7 @@ simone: 'A FreeSewing pattern for a button down shirt (Simone = Simon for people
|
|||
sven: 'A FreeSewing pattern for a straightforward sweater'
|
||||
tamiko: 'A FreeSewing pattern for a zero-waste top'
|
||||
theo: 'A FreeSewing pattern for classic trousers'
|
||||
teagan: 'A FreeSewing pattern for a T-shirt'
|
||||
titan: 'A FreeSewing block for trousers'
|
||||
trayvon: 'A FreeSewing pattern for a tie'
|
||||
tutorial: "A FreeSewing pattern for a baby bib that's used in our tutorial"
|
||||
|
|
|
@ -136,7 +136,7 @@ function draftSleevecap(part, run) {
|
|||
}
|
||||
|
||||
export default (part) => {
|
||||
let { store, units, options, Point, points, paths } = part.shorthand()
|
||||
let { store, units, options, Point, points, paths, raise } = part.shorthand()
|
||||
|
||||
store.set('sleeveFactor', 1)
|
||||
let run = 0
|
||||
|
@ -146,7 +146,8 @@ export default (part) => {
|
|||
delta = sleevecapDelta(store)
|
||||
sleevecapAdjust(store)
|
||||
run++
|
||||
} while (options.brianFitSleeve === true && run < 30 && Math.abs(sleevecapDelta(store)) > 2)
|
||||
raise.debug(`Fitting Brian sleevecap. Run ${run}: delta is ${units(delta)}`)
|
||||
} while (options.brianFitSleeve === true && run < 50 && Math.abs(sleevecapDelta(store)) > 2)
|
||||
|
||||
// Paths
|
||||
paths.sleevecap.attr('class', 'fabric')
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "^v4.0.0-alpha.56",
|
||||
"pattern": "link:..",
|
||||
"prismjs": "1.21.0",
|
||||
"prismjs": "1.20.0",
|
||||
"react": "^16.13",
|
||||
"react-dom": "^16.13",
|
||||
"react-scripts": "^3.4.1",
|
||||
|
|
|
@ -14,6 +14,7 @@ import holmes from './holmes.yml'
|
|||
import huey from './huey.yml'
|
||||
import hugo from './hugo.yml'
|
||||
import tamiko from './tamiko.yml'
|
||||
import teagan from './teagan.yml'
|
||||
import trayvon from './trayvon.yml'
|
||||
import jaeger from './jaeger.yml'
|
||||
import carlton from './carlton.yml'
|
||||
|
@ -59,7 +60,8 @@ let patterns = {
|
|||
waralee,
|
||||
holmes,
|
||||
titan,
|
||||
paco
|
||||
paco,
|
||||
teagan
|
||||
}
|
||||
|
||||
let options = {}
|
||||
|
|
7
packages/i18n/src/locales/en/options/teagan.yml
Normal file
7
packages/i18n/src/locales/en/options/teagan.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
necklineDepth:
|
||||
title: Neckline depth
|
||||
description: Controls how deep the neck opening plunges down.
|
||||
|
||||
necklineWidth:
|
||||
title: Neckline width
|
||||
description: Controls the width of the neck opening.
|
|
@ -70,6 +70,9 @@ sven:
|
|||
tamiko:
|
||||
description: Tamiko is a zero-waste top.
|
||||
title: Tamiko top
|
||||
teagan:
|
||||
description: Teagan is a fitted T-shirt pattern
|
||||
title: Teagan T-shirt
|
||||
theo:
|
||||
description: Theo is a classic trouser pattern.
|
||||
title: Theo trousers
|
||||
|
|
|
@ -142,6 +142,10 @@ sven:
|
|||
dflt: brian
|
||||
tamiko:
|
||||
dflt: brian
|
||||
teagan:
|
||||
dflt: brian
|
||||
other:
|
||||
hipsEase: aaron
|
||||
theo:
|
||||
dflt: bruce
|
||||
other:
|
||||
|
|
|
@ -24,6 +24,7 @@ const simon = require('@freesewing/simon').config
|
|||
const simone = require('@freesewing/simone').config
|
||||
const sven = require('@freesewing/sven').config
|
||||
const tamiko = require('@freesewing/tamiko').config
|
||||
const teagan = require('@freesewing/teagan').config
|
||||
const theo = require('@freesewing/theo').config
|
||||
const titan = require('@freesewing/titan').config
|
||||
const trayvon = require('@freesewing/trayvon').config
|
||||
|
@ -55,6 +56,7 @@ const patterns = {
|
|||
simone,
|
||||
sven,
|
||||
tamiko,
|
||||
teagan,
|
||||
theo,
|
||||
titan,
|
||||
trayvon,
|
||||
|
|
1
packages/teagan/.prettierignore
Normal file
1
packages/teagan/.prettierignore
Normal file
|
@ -0,0 +1 @@
|
|||
config/config.js
|
9
packages/teagan/CHANGELOG.md
Normal file
9
packages/teagan/CHANGELOG.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Change log for: @freesewing/teagan
|
||||
|
||||
|
||||
|
||||
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.
|
||||
|
100
packages/teagan/README.md
Normal file
100
packages/teagan/README.md
Normal file
|
@ -0,0 +1,100 @@
|
|||

|
||||
<p align='center'><a
|
||||
href="https://www.npmjs.com/package/@freesewing/teagan"
|
||||
title="@freesewing/teagan on NPM"
|
||||
><img src="https://img.shields.io/npm/v/@freesewing/teagan.svg"
|
||||
alt="@freesewing/teagan on NPM"/>
|
||||
</a><a
|
||||
href="https://opensource.org/licenses/MIT"
|
||||
title="License: MIT"
|
||||
><img src="https://img.shields.io/npm/l/@freesewing/teagan.svg?label=License"
|
||||
alt="License: MIT"/>
|
||||
</a><a
|
||||
href="https://deepscan.io/dashboard#view=project&tid=2114&pid=2993&bid=23256"
|
||||
title="Code quality on DeepScan"
|
||||
><img src="https://deepscan.io/api/teams/2114/projects/2993/branches/23256/badge/grade.svg"
|
||||
alt="Code quality on DeepScan"/>
|
||||
</a><a
|
||||
href="https://github.com/freesewing/freesewing/issues?q=is%3Aissue+is%3Aopen+label%3Apkg%3Ateagan"
|
||||
title="Open issues tagged pkg:teagan"
|
||||
><img src="https://img.shields.io/github/issues/freesewing/freesewing/pkg:teagan.svg?label=Issues"
|
||||
alt="Open issues tagged pkg:teagan"/>
|
||||
</a></p><p align='center'><a
|
||||
href="https://twitter.com/freesewing_org"
|
||||
title="Follow @freesewing_org on Twitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-blue.svg?logo=twitter&logoColor=white&logoWidth=15"
|
||||
alt="Follow @freesewing_org on Twitter"/>
|
||||
</a><a
|
||||
href="https://gitter.im/freesewing/chat"
|
||||
title="Chat with us on Gitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Chat%20with%20us-CA0547.svg?logo=gitter&logoColor=white&logoWidth=15"
|
||||
alt="Chat with us on Gitter"/>
|
||||
</a><a
|
||||
href="https://freesewing.org/patrons/join"
|
||||
title="Become a FreeSewing Patron"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Support%20us-blueviolet.svg?logo=cash-app&logoColor=white&logoWidth=15"
|
||||
alt="Become a FreeSewing Patron"/>
|
||||
</a><a
|
||||
href="https://instagram.com/freesewing_org"
|
||||
title="Follow @freesewing_org on Twitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-E4405F.svg?logo=instagram&logoColor=white&logoWidth=15"
|
||||
alt="Follow @freesewing_org on Twitter"/>
|
||||
</a></p>
|
||||
|
||||
## What am I looking at? 🤔
|
||||
|
||||
This repository is our *monorepo* holding [all our NPM packages](https://www.npmjs.com/search?q=keywords:freesewing).
|
||||
This folder holds **@freesewing/teagan**
|
||||
|
||||
A FreeSewing pattern for a T-shirt
|
||||
|
||||
|
||||
|
||||
## About FreeSewing 💀
|
||||
|
||||
Where the world of makers and developers collide, that's where you'll find FreeSewing.
|
||||
|
||||
Our [core library](https://freesewing.dev/reference/api/) is a *batteries-included* toolbox
|
||||
for parametric design of sewing patterns. It's a modular system (check our list
|
||||
of [plugins](https://freesewing.dev/reference/plugins/) and getting started is as simple as:
|
||||
|
||||
```bash
|
||||
npm init freesewing-pattern
|
||||
```
|
||||
|
||||
The [getting started](https://freesewing.dev/guides/getting-started/) section on [freesewing.dev](https://freesewing.dev/) is a good
|
||||
entrypoint to our documentation, but you'll find a lot more there, including
|
||||
our [API reference](https://freesewing.dev/reference/api/),
|
||||
as well as [our turorial](https://freesewing.dev/tutorials/pattern-design/),
|
||||
and [howtos](https://freesewing.dev/howtos/).
|
||||
|
||||
If you're a maker, checkout [freesewing.org](https://freesewing/) where you can generate
|
||||
our sewing patterns adapted to your measurements.
|
||||
|
||||
## 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, you too
|
||||
should [become a patron](https://freesewing.org/patrons/join).
|
||||
|
||||
## Links 👩💻
|
||||
|
||||
- 💻 Makers website: [freesewing.org](https://freesewing.org)
|
||||
- 💻 Developers website: [freesewing.dev](https://freesewing.dev)
|
||||
- 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/chat)
|
||||
- 🐦 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 [chatroom on Gitter](https://gitter.im/freesewing/chat) is 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).
|
113
packages/teagan/]
Normal file
113
packages/teagan/]
Normal file
|
@ -0,0 +1,113 @@
|
|||
import { version } from '../package.json'
|
||||
|
||||
export default {
|
||||
name: 'teagan',
|
||||
version,
|
||||
design: 'Joost De Cock',
|
||||
code: 'Joost De Cock',
|
||||
department: 'unisex',
|
||||
type: 'pattern',
|
||||
difficulty: 3,
|
||||
tags: ['top', 'basics'],
|
||||
optionGroups: {
|
||||
fit: ['chestEase', 'hipsEase', 'sleeveEase'],
|
||||
style: ['necklineWidth', 'necklineDepth', 'lengthBonus'],
|
||||
advanced: [
|
||||
'acrossBackFactor',
|
||||
'armholeDepthFactor',
|
||||
'backNeckCutout',
|
||||
'frontArmholeDeeper',
|
||||
'sleeveWidthGuarantee',
|
||||
{
|
||||
sleevecap: [
|
||||
'sleevecapEase',
|
||||
'sleevecapTopFactorX',
|
||||
'sleevecapTopFactorY',
|
||||
'sleevecapBackFactorX',
|
||||
'sleevecapBackFactorY',
|
||||
'sleevecapFrontFactorX',
|
||||
'sleevecapFrontFactorY',
|
||||
'sleevecapQ1Offset',
|
||||
'sleevecapQ2Offset',
|
||||
'sleevecapQ3Offset',
|
||||
'sleevecapQ4Offset',
|
||||
'sleevecapQ1Spread1',
|
||||
'sleevecapQ1Spread2',
|
||||
'sleevecapQ2Spread1',
|
||||
'sleevecapQ2Spread2',
|
||||
'sleevecapQ3Spread1',
|
||||
'sleevecapQ3Spread2',
|
||||
'sleevecapQ4Spread1',
|
||||
'sleevecapQ4Spread2'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
measurements: [
|
||||
'biceps',
|
||||
'chest',
|
||||
'hpsToWaistBack',
|
||||
'waistToHips',
|
||||
'neck',
|
||||
'shoulderSlope',
|
||||
'shoulderToShoulder',
|
||||
'hips'
|
||||
],
|
||||
dependencies: {
|
||||
front: 'base',
|
||||
back: 'front',
|
||||
sleevecap: 'back',
|
||||
sleeve: 'sleevecap'
|
||||
},
|
||||
inject: {
|
||||
front: 'base',
|
||||
back: 'front',
|
||||
sleeve: 'sleevecap'
|
||||
},
|
||||
hide: ['base', 'sleevecap'],
|
||||
options: {
|
||||
// Constants
|
||||
brianFitCollar: false,
|
||||
brianFitSleeve: true,
|
||||
bicepsEase: 0.05,
|
||||
collarFactor: 4.8,
|
||||
shoulderEase: 0,
|
||||
collarEase: 0,
|
||||
frontArmholeDeeper: 0,
|
||||
shoulderSlopeReduction: 0,
|
||||
|
||||
// Percentages
|
||||
chestEase: { pct: 12, min: 5, max: 25 },
|
||||
hipsEase: { pct: 18, min: 8, max: 30 },
|
||||
sleeveEase: { pct: 15, min: 5, max: 35 },
|
||||
necklineDepth: { pct: 25, min: 15, max: 40 },
|
||||
necklineWidth: { pct: 30, min: 10, max: 50 },
|
||||
lengthBonus: { pct: 5, min: -20, max: 60 },
|
||||
acrossBackFactor: { pct: 97, min: 93, max: 100 },
|
||||
armholeDepthFactor: { pct: 65, min: 60, max: 70 },
|
||||
backNeckCutout: { pct: 5, min: 2, max: 8 },
|
||||
frontArmholeDeeper: { pct: 0.5, min: 0, max: 1.5 },
|
||||
|
||||
// Sleevecap (from brian)
|
||||
sleevecapEase: { pct: 0, min: 0, max: 5 },
|
||||
sleevecapTopFactorX: { pct: 50, min: 25, max: 75 },
|
||||
sleevecapTopFactorY: { pct: 35, min: 30, max: 40 },
|
||||
sleevecapBackFactorX: { pct: 60, min: 35, max: 65 },
|
||||
sleevecapBackFactorY: { pct: 33, min: 30, max: 65 },
|
||||
sleevecapFrontFactorX: { pct: 53, min: 35, max: 65 },
|
||||
sleevecapFrontFactorY: { pct: 33, min: 30, max: 65 },
|
||||
sleevecapQ1Offset: { pct: 2, min: 0, max: 7 },
|
||||
sleevecapQ2Offset: { pct: 3.5, min: 0, max: 7 },
|
||||
sleevecapQ3Offset: { pct: 3, min: 0, max: 7 },
|
||||
sleevecapQ4Offset: { pct: 1, min: 0, max: 7 },
|
||||
sleevecapQ1Spread1: { pct: 6, min: 4, max: 20 },
|
||||
sleevecapQ1Spread2: { pct: 15, min: 4, max: 20 },
|
||||
sleevecapQ2Spread1: { pct: 15, min: 4, max: 20 },
|
||||
sleevecapQ2Spread2: { pct: 10, min: 4, max: 20 },
|
||||
sleevecapQ3Spread1: { pct: 10, min: 4, max: 20 },
|
||||
sleevecapQ3Spread2: { pct: 8, min: 4, max: 20 },
|
||||
sleevecapQ4Spread1: { pct: 7, min: 4, max: 20 },
|
||||
sleevecapQ4Spread2: { pct: 7, min: 4, max: 20 },
|
||||
sleeveWidthGuarantee: { pct: 85, min: 25, max: 100 },
|
||||
}
|
||||
}
|
114
packages/teagan/config/index.js
Normal file
114
packages/teagan/config/index.js
Normal file
|
@ -0,0 +1,114 @@
|
|||
import { version } from '../package.json'
|
||||
|
||||
export default {
|
||||
name: 'teagan',
|
||||
version,
|
||||
design: 'Joost De Cock',
|
||||
code: 'Joost De Cock',
|
||||
department: 'unisex',
|
||||
type: 'pattern',
|
||||
difficulty: 3,
|
||||
tags: ['top', 'basics'],
|
||||
optionGroups: {
|
||||
fit: ['chestEase', 'hipsEase', 'sleeveEase'],
|
||||
style: ['necklineWidth', 'necklineDepth', 'necklineBend', 'lengthBonus', 'sleeveLength'],
|
||||
advanced: [
|
||||
'acrossBackFactor',
|
||||
'armholeDepthFactor',
|
||||
'backNeckCutout',
|
||||
{
|
||||
sleevecap: [
|
||||
'sleevecapEase',
|
||||
'sleevecapTopFactorX',
|
||||
'sleevecapTopFactorY',
|
||||
'sleevecapBackFactorX',
|
||||
'sleevecapBackFactorY',
|
||||
'sleevecapFrontFactorX',
|
||||
'sleevecapFrontFactorY',
|
||||
'sleevecapQ1Offset',
|
||||
'sleevecapQ2Offset',
|
||||
'sleevecapQ3Offset',
|
||||
'sleevecapQ4Offset',
|
||||
'sleevecapQ1Spread1',
|
||||
'sleevecapQ1Spread2',
|
||||
'sleevecapQ2Spread1',
|
||||
'sleevecapQ2Spread2',
|
||||
'sleevecapQ3Spread1',
|
||||
'sleevecapQ3Spread2',
|
||||
'sleevecapQ4Spread1',
|
||||
'sleevecapQ4Spread2'
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
measurements: [
|
||||
'biceps',
|
||||
'chest',
|
||||
'hpsToWaistBack',
|
||||
'waistToHips',
|
||||
'neck',
|
||||
'shoulderSlope',
|
||||
'shoulderToShoulder',
|
||||
'hips'
|
||||
],
|
||||
dependencies: {
|
||||
front: 'base',
|
||||
back: 'front',
|
||||
sleevecap: 'back',
|
||||
sleeve: 'sleevecap'
|
||||
},
|
||||
inject: {
|
||||
front: 'base',
|
||||
back: 'front',
|
||||
sleeve: 'sleevecap'
|
||||
},
|
||||
hide: ['base', 'sleevecap'],
|
||||
options: {
|
||||
// Constants
|
||||
brianFitCollar: false,
|
||||
brianFitSleeve: true,
|
||||
bicepsEase: 0.05,
|
||||
collarFactor: 4.8,
|
||||
shoulderEase: 0,
|
||||
collarEase: 0,
|
||||
frontArmholeDeeper: 0.05,
|
||||
shoulderSlopeReduction: 0,
|
||||
backNeckCutout: 0.05,
|
||||
sleeveWidthGuarantee: 0.85,
|
||||
|
||||
// Percentages
|
||||
chestEase: { pct: 12, min: 5, max: 25 },
|
||||
hipsEase: { pct: 18, min: 8, max: 30 },
|
||||
sleeveEase: { pct: 15, min: 5, max: 35 },
|
||||
sleeveLength: { pct: 30, min: 20, max: 100 },
|
||||
necklineDepth: { pct: 25, min: 20, max: 40 },
|
||||
necklineWidth: { pct: 30, min: 10, max: 50 },
|
||||
necklineBend: { pct: 30, min: 0, max: 70 },
|
||||
lengthBonus: { pct: 5, min: -20, max: 60 },
|
||||
acrossBackFactor: { pct: 97, min: 93, max: 100 },
|
||||
armholeDepthFactor: { pct: 65, min: 60, max: 70 },
|
||||
frontArmholeDeeper: { pct: 0.5, min: 0, max: 1.5 },
|
||||
backNeckCutout: { pct: 5, min: 2, max: 8 },
|
||||
|
||||
// Sleevecap (from brian)
|
||||
sleevecapEase: { pct: 0, min: 0, max: 5 },
|
||||
sleevecapTopFactorX: { pct: 50, min: 25, max: 75 },
|
||||
sleevecapTopFactorY: { pct: 35, min: 30, max: 40 },
|
||||
sleevecapBackFactorX: { pct: 60, min: 35, max: 65 },
|
||||
sleevecapBackFactorY: { pct: 33, min: 30, max: 65 },
|
||||
sleevecapFrontFactorX: { pct: 53, min: 35, max: 65 },
|
||||
sleevecapFrontFactorY: { pct: 33, min: 30, max: 65 },
|
||||
sleevecapQ1Offset: { pct: 2, min: 0, max: 7 },
|
||||
sleevecapQ2Offset: { pct: 3.5, min: 0, max: 7 },
|
||||
sleevecapQ3Offset: { pct: 3, min: 0, max: 7 },
|
||||
sleevecapQ4Offset: { pct: 1, min: 0, max: 7 },
|
||||
sleevecapQ1Spread1: { pct: 6, min: 4, max: 20 },
|
||||
sleevecapQ1Spread2: { pct: 15, min: 4, max: 20 },
|
||||
sleevecapQ2Spread1: { pct: 15, min: 4, max: 20 },
|
||||
sleevecapQ2Spread2: { pct: 10, min: 4, max: 20 },
|
||||
sleevecapQ3Spread1: { pct: 10, min: 4, max: 20 },
|
||||
sleevecapQ3Spread2: { pct: 8, min: 4, max: 20 },
|
||||
sleevecapQ4Spread1: { pct: 7, min: 4, max: 20 },
|
||||
sleevecapQ4Spread2: { pct: 7, min: 4, max: 20 }
|
||||
}
|
||||
}
|
10
packages/teagan/example/.babelrc
Normal file
10
packages/teagan/example/.babelrc
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugins": [
|
||||
["prismjs", {
|
||||
"languages": ["javascript", "css", "markup"],
|
||||
"plugins": ["line-numbers"],
|
||||
"theme": "twilight",
|
||||
"css": true
|
||||
}]
|
||||
]
|
||||
}
|
96
packages/teagan/example/README.md
Normal file
96
packages/teagan/example/README.md
Normal file
|
@ -0,0 +1,96 @@
|
|||
<p align="center">
|
||||
<a title="Go to freesewing.org" href="https://freesewing.org/"><img src="https://freesewing.org/img/logo/black.svg" align="center" width="150px" alt="Freesewing logo"/></a>
|
||||
<br>
|
||||
<a href="https://freesewing.org/">FreeSewing v2</a>
|
||||
</p>
|
||||
<p align="center">A JavaScript library for made-to-measure sewing patterns</p>
|
||||
<p align='center'><a
|
||||
href="https://twitter.com/freesewing_org"
|
||||
title="Follow @freesewing_org on Twitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-blue.svg?logo=twitter&logoColor=white&logoWidth=15"
|
||||
alt="Follow @freesewing_org on Twitter"/>
|
||||
</a><a
|
||||
href="https://gitter.im/freesewing/freesewing"
|
||||
title="Chat with us on Gitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Chat%20with%20us-CA0547.svg?logo=gitter&logoColor=white&logoWidth=15"
|
||||
alt="Chat with us on Gitter"/>
|
||||
</a><a
|
||||
href="https://freesewing.org/patrons/join"
|
||||
title="Become a FreeSewing Patron"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Support%20us-blueviolet.svg?logo=cash-app&logoColor=white&logoWidth=15"
|
||||
alt="Become a FreeSewing Patron"/>
|
||||
</a><a
|
||||
href="https://instagram.com/freesewing_org"
|
||||
title="Follow @freesewing_org on Twitter"
|
||||
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-E4405F.svg?logo=instagram&logoColor=white&logoWidth=15"
|
||||
alt="Follow @freesewing_org on Twitter"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# teagan example
|
||||
|
||||
This project was bootstrapped with [Create Freesewing Pattern](https://en.freesewing.dev/create-freesewing-pattern):
|
||||
|
||||
```js
|
||||
npm init freesewing-pattern
|
||||
```
|
||||
|
||||
This example folder is part of the local development environment.
|
||||
It is **not** part of the pattern's source code.
|
||||
|
||||
To run this example, follow these steps:
|
||||
|
||||
- In the folder above this one, run: `yarn start` (or `npm start`)
|
||||
- Then, in new terminal, run the same command in this folder: `yarn start` (or `npm start`)
|
||||
|
||||
This will spin up the development environment, similar to [our online demo](https://teagan.freesewing.dev/).
|
||||
|
||||
## About FreeSewing 🤔
|
||||
|
||||
Where the world of makers and developers collide, that's where you'll find FreeSewing.
|
||||
|
||||
Our [core library](https://freesewing.dev/en/freesewing) is a *batteries-included* toolbox
|
||||
for parametric design of sewing patterns. It's a modular system (check our list
|
||||
of [plugins](https://freesewing.dev/en/plugins) and getting started is as simple as:
|
||||
|
||||
```bash
|
||||
npm init freesewing-pattern
|
||||
```
|
||||
|
||||
The [getting started] section on [freesewing.dev](https://freesewing.dev/) is a good
|
||||
entrypoint to our documentation, but you'll find a lot more there, including
|
||||
our [API documentation](https://freesewing.dev/en/freesewing/api),
|
||||
as well as [examples](https://freesewing.dev/en/freesewing/examples),
|
||||
and [best practices](https://freesewing.dev/en/do).
|
||||
|
||||
If you're a maker, checkout [freesewing.org](https://freesewing/) where you can generate
|
||||
our sewing patterns adapted to your measurements.
|
||||
|
||||
## 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, you too
|
||||
should [become a patron](https://freesewing.org/patrons/join).
|
||||
|
||||
## Links 👩💻
|
||||
|
||||
- 💻 Makers website: [freesewing.org](https://freesewing.org)
|
||||
- 💻 Developers website: [freesewing.dev](https://freesewing.org)
|
||||
- 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/freesewing)
|
||||
- 🐦 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 [chatroom on Gitter](https://gitter.im) is 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).
|
||||
|
49
packages/teagan/example/package.json
Normal file
49
packages/teagan/example/package.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "teagan-example",
|
||||
"homepage": "https://freesewing.github.io/teagan",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@freesewing/components": "latest",
|
||||
"@freesewing/core": "latest",
|
||||
"@freesewing/css-theme": "latest",
|
||||
"@freesewing/i18n": "latest",
|
||||
"@freesewing/models": "latest",
|
||||
"@freesewing/mui-theme": "latest",
|
||||
"@freesewing/pattern-info": "latest",
|
||||
"@freesewing/plugin-bundle": "latest",
|
||||
"@freesewing/plugin-theme": "latest",
|
||||
"@freesewing/plugin-i18n": "latest",
|
||||
"@freesewing/plugin-svgattr": "latest",
|
||||
"@freesewing/utils": "latest",
|
||||
"@material-ui/core": "^4.11.0",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "^v4.0.0-alpha.56",
|
||||
"pattern": "link:..",
|
||||
"prismjs": "1.20.0",
|
||||
"react": "^16.13",
|
||||
"react-dom": "^16.13",
|
||||
"react-scripts": "^3.4.1",
|
||||
"file-saver": "^2.0.2",
|
||||
"react-markdown": "4.3.1",
|
||||
"typeface-roboto-condensed": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not ie <= 11",
|
||||
"not op_mini all"
|
||||
],
|
||||
"devDependencies": {
|
||||
"babel-plugin-prismjs": "2.0.1"
|
||||
}
|
||||
}
|
23
packages/teagan/example/public/App.js
Normal file
23
packages/teagan/example/public/App.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import React from "react";
|
||||
import freesewing from "@freesewing/core";
|
||||
import { Workbench } from "@freesewing/components";
|
||||
import "typeface-roboto-condensed";
|
||||
import "@freesewing/css-theme";
|
||||
import "./App.css";
|
||||
|
||||
import Pattern from "pattern";
|
||||
|
||||
const App = props => {
|
||||
let instance = new Pattern();
|
||||
let config = instance.config;
|
||||
return (
|
||||
<Workbench
|
||||
freesewing={freesewing}
|
||||
Pattern={Pattern}
|
||||
config={config}
|
||||
userLanguage="en"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
BIN
packages/teagan/example/public/favicon.ico
Normal file
BIN
packages/teagan/example/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
40
packages/teagan/example/public/index.html
Normal file
40
packages/teagan/example/public/index.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>teagan</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
You need to enable JavaScript to run this app.
|
||||
</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
15
packages/teagan/example/public/manifest.json
Normal file
15
packages/teagan/example/public/manifest.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"short_name": "teagan",
|
||||
"name": "teagan",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
32
packages/teagan/example/src/App.js
Normal file
32
packages/teagan/example/src/App.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
import React from 'react'
|
||||
import freesewing from '@freesewing/core'
|
||||
import Workbench from '@freesewing/components/Workbench'
|
||||
import 'typeface-roboto-condensed'
|
||||
import '@freesewing/css-theme'
|
||||
|
||||
import Pattern from 'pattern'
|
||||
|
||||
const App = (props) => {
|
||||
let instance = new Pattern()
|
||||
let config = instance.config
|
||||
|
||||
// You can use this to add transations
|
||||
/*
|
||||
let translations = {
|
||||
JSON: 'JSON',
|
||||
someOtherString: 'Some other string that needs translation'
|
||||
}
|
||||
*/
|
||||
|
||||
return (
|
||||
<Workbench
|
||||
freesewing={freesewing}
|
||||
Pattern={Pattern}
|
||||
config={config}
|
||||
userLanguage="en"
|
||||
//translations={translations}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
11
packages/teagan/example/src/index.js
Normal file
11
packages/teagan/example/src/index.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import App from './App'
|
||||
import * as serviceWorker from './serviceWorker'
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'))
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: http://bit.ly/CRA-PWA
|
||||
serviceWorker.unregister()
|
123
packages/teagan/example/src/serviceWorker.js
Normal file
123
packages/teagan/example/src/serviceWorker.js
Normal file
|
@ -0,0 +1,123 @@
|
|||
// In production, we register a service worker to serve assets from local cache.
|
||||
|
||||
// This lets the app load faster on subsequent visits in production, and gives
|
||||
// it offline capabilities. However, it also means that developers (and users)
|
||||
// will only see deployed updates on the "N+1" visit to a page, since previously
|
||||
// cached resources are updated in the background.
|
||||
|
||||
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
|
||||
// This link also includes instructions on opting out of this behavior.
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
|
||||
)
|
||||
|
||||
export function register(config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location)
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||
// from what our page is served on. This might happen if a CDN is used to
|
||||
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||
return
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`
|
||||
|
||||
if (isLocalhost) {
|
||||
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||
checkValidServiceWorker(swUrl, config)
|
||||
|
||||
// Add some additional logging to localhost, pointing developers to the
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://goo.gl/SC7cgQ'
|
||||
)
|
||||
})
|
||||
} else {
|
||||
// Is not local host. Just register service worker
|
||||
registerValidSW(swUrl, config)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function registerValidSW(swUrl, config) {
|
||||
navigator.serviceWorker
|
||||
.register(swUrl)
|
||||
.then(registration => {
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the old content will have been purged and
|
||||
// the fresh content will have been added to the cache.
|
||||
// It's the perfect time to display a "New content is
|
||||
// available; please refresh." message in your web app.
|
||||
console.log('New content is available; please refresh.')
|
||||
|
||||
// Execute callback
|
||||
if (config.onUpdate) {
|
||||
config.onUpdate(registration)
|
||||
}
|
||||
} else {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.')
|
||||
|
||||
// Execute callback
|
||||
if (config.onSuccess) {
|
||||
config.onSuccess(registration)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during service worker registration:', error)
|
||||
})
|
||||
}
|
||||
|
||||
function checkValidServiceWorker(swUrl, config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl)
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
if (
|
||||
response.status === 404 ||
|
||||
response.headers.get('content-type').indexOf('javascript') === -1
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister().then(() => {
|
||||
window.location.reload()
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// Service worker found. Proceed as normal.
|
||||
registerValidSW(swUrl, config)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('No internet connection found. App is running in offline mode.')
|
||||
})
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister()
|
||||
})
|
||||
}
|
||||
}
|
94
packages/teagan/package.json
Normal file
94
packages/teagan/package.json
Normal file
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
"name": "@freesewing/teagan",
|
||||
"version": "2.8.1",
|
||||
"description": "A FreeSewing pattern for a T-shirt",
|
||||
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
|
||||
"homepage": "https://freesewing.org/",
|
||||
"repository": "github:freesewing/freesewing",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/freesewing/freesewing/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"freesewing",
|
||||
"design",
|
||||
"diy",
|
||||
"fashion",
|
||||
"made to measure",
|
||||
"parametric design",
|
||||
"pattern",
|
||||
"sewing",
|
||||
"sewing pattern"
|
||||
],
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"build": "rollup -c",
|
||||
"test": "BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.js --require @babel/register",
|
||||
"pubtest": "npm publish --registry http://localhost:6662",
|
||||
"pubforce": "npm publish",
|
||||
"symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
|
||||
"start": "rollup -c -w",
|
||||
"netlify": "echo \"Not configured yet\"",
|
||||
"testci": "BABEL_ENV=production ./node_modules/.bin/_mocha tests/*.test.js --require @babel/register"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@freesewing/core": "^2.8.1",
|
||||
"@freesewing/plugin-bundle": "^2.8.1"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"babel-jest": "^26.2.2",
|
||||
"jest": "26.2.2",
|
||||
"@freesewing/components": "^2.8.1",
|
||||
"@freesewing/css-theme": "^2.8.1",
|
||||
"@freesewing/i18n": "^2.8.1",
|
||||
"@freesewing/mui-theme": "^2.8.1",
|
||||
"@freesewing/plugin-bust": "^2.8.1",
|
||||
"@freesewing/plugin-buttons": "^2.8.1",
|
||||
"@freesewing/plugin-flip": "^2.8.1",
|
||||
"@freesewing/utils": "^2.8.1",
|
||||
"@svgr/rollup": "^2.4.1",
|
||||
"cross-env": "^7.0.2",
|
||||
"react-scripts": "^3.4.1",
|
||||
"webpack": "^4.44.1",
|
||||
"rollup": "^2.23.0",
|
||||
"@rollup/plugin-babel": "^5.1.0",
|
||||
"rollup-plugin-terser": "^6.1.0",
|
||||
"@rollup/plugin-commonjs": "^14.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^8.4.0",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.3",
|
||||
"@material-ui/core": "^4.11.0",
|
||||
"@material-ui/icons": "4.9.1",
|
||||
"@material-ui/lab": "^v4.0.0-alpha.56",
|
||||
"react-intl": "^5.4.5",
|
||||
"prop-types": "^15.7.2",
|
||||
"mocha": "^8.1.0",
|
||||
"chai": "^4.2.0",
|
||||
"chai-string": "^1.5.0",
|
||||
"@babel/register": "^7.10.5"
|
||||
},
|
||||
"files": [
|
||||
"dist/*",
|
||||
"README.md",
|
||||
"package.json"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"tag": "latest"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0",
|
||||
"npm": ">=6"
|
||||
},
|
||||
"rollup": {
|
||||
"exports": "default"
|
||||
}
|
||||
}
|
37
packages/teagan/rollup.config.js
Normal file
37
packages/teagan/rollup.config.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
import resolve from '@rollup/plugin-node-resolve'
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import json from '@rollup/plugin-json'
|
||||
import { terser } from 'rollup-plugin-terser'
|
||||
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
|
||||
import { name, version, description, author, license, main, module, rollup } from './package.json'
|
||||
|
||||
const output = [
|
||||
{
|
||||
file: main,
|
||||
format: 'cjs',
|
||||
sourcemap: true,
|
||||
exports: rollup.exports
|
||||
}
|
||||
]
|
||||
if (typeof module !== 'undefined')
|
||||
output.push({
|
||||
file: module,
|
||||
format: 'es',
|
||||
sourcemap: true
|
||||
})
|
||||
|
||||
export default {
|
||||
input: 'src/index.js',
|
||||
output,
|
||||
plugins: [
|
||||
peerDepsExternal(),
|
||||
resolve({ modulesOnly: true }),
|
||||
commonjs(),
|
||||
json(),
|
||||
terser({
|
||||
output: {
|
||||
preamble: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
76
packages/teagan/src/back.js
Normal file
76
packages/teagan/src/back.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
import { dimensions } from './shared'
|
||||
|
||||
export default function (part) {
|
||||
let {
|
||||
store,
|
||||
sa,
|
||||
Point,
|
||||
points,
|
||||
Path,
|
||||
paths,
|
||||
options,
|
||||
complete,
|
||||
paperless,
|
||||
macro,
|
||||
utils,
|
||||
units,
|
||||
measurements
|
||||
} = part.shorthand()
|
||||
|
||||
// Adjust neckline
|
||||
points.cbNeck = new Point(0, points.neck.y + options.backNeckCutout * measurements.neck)
|
||||
points.cbNeckCp1 = points.cbNeck.shift(0, points.neck.x / 2)
|
||||
points.neckCp2 = utils.beamIntersectsY(points.neck, points.neckCp2, points.cbNeck.y)
|
||||
|
||||
// Adjust armhole
|
||||
points.shoulderCp1 = points.shoulderCp1.shiftFractionTowards(points.shoulder, 0.25)
|
||||
|
||||
// Draw seamline
|
||||
paths.seam = new Path()
|
||||
.move(points.cfHem)
|
||||
.line(points.hem)
|
||||
.line(points.waist)
|
||||
.curve_(points.waistCp2, points.armhole)
|
||||
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||
.curve(points.armholeHollowCp2, points.shoulderCp1, points.shoulder)
|
||||
.line(points.neck)
|
||||
.curve(points.neckCp2, points.cbNeckCp1, points.cbNeck)
|
||||
.line(points.cfHem)
|
||||
.close()
|
||||
|
||||
// Set store values required to draft sleevecap
|
||||
store.set('sleevecapEase', 0)
|
||||
store.set(
|
||||
'backArmholeLength',
|
||||
new Path()
|
||||
.move(points.armhole)
|
||||
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||
.curve(points.armholeHollowCp2, points.shoulderCp1, points.shoulder)
|
||||
.length()
|
||||
)
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
macro('cutonfold', {
|
||||
from: points.cfNeck,
|
||||
to: points.cfHem,
|
||||
grainline: true
|
||||
})
|
||||
|
||||
macro('title', { at: points.title, nr: 2, title: 'back' })
|
||||
points.scaleboxAnchor = points.scalebox = points.title.shift(90, 100)
|
||||
macro('scalebox', { at: points.scalebox })
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
//dimensions(macro, points, sa)
|
||||
//macro('vd', {
|
||||
// from: points.cbHem,
|
||||
// to: points.cbNeck,
|
||||
// x: points.cbHem.x - sa - 15
|
||||
//})
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
135
packages/teagan/src/front.js
Normal file
135
packages/teagan/src/front.js
Normal file
|
@ -0,0 +1,135 @@
|
|||
import { dimensions } from './shared'
|
||||
|
||||
export default function (part) {
|
||||
let {
|
||||
utils,
|
||||
store,
|
||||
sa,
|
||||
Point,
|
||||
points,
|
||||
Path,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
options,
|
||||
measurements,
|
||||
complete,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand()
|
||||
|
||||
// Hide Brian paths
|
||||
for (let key of Object.keys(paths)) paths[key].render = false
|
||||
|
||||
// Adapt fit to waist
|
||||
let width
|
||||
if (measurements.waist > measurements.hips)
|
||||
width = (measurements.waist * (1 + options.hipsEase)) / 4
|
||||
else width = (measurements.hips * (1 + options.hipsEase)) / 4
|
||||
points.hem.x = width
|
||||
points.hips.x = width
|
||||
points.waist.x = width
|
||||
points.waistCp2 = points.waist.shift(90, points.armhole.dy(points.waist) / 3)
|
||||
|
||||
// Clone cb (center back) into cf (center front)
|
||||
for (let key of ['Neck', 'Shoulder', 'Armhole', 'Hips', 'Hem']) {
|
||||
points[`cf${key}`] = points[`cb${key}`].clone()
|
||||
}
|
||||
|
||||
// Neckline
|
||||
points.cfNeck = new Point(0, options.necklineDepth * measurements.hpsToWaistBack)
|
||||
points.cfNeckCp1 = points.cfNeck.shift(0, points.neck.x * options.necklineBend * 2)
|
||||
points.neck = points.hps.shiftFractionTowards(points.shoulder, options.necklineWidth)
|
||||
points.neckCp2 = points.neck
|
||||
.shiftTowards(points.shoulder, points.neck.dy(points.cfNeck) * (0.2 + options.necklineBend))
|
||||
.rotate(-90, points.neck)
|
||||
|
||||
// Redraw armhole
|
||||
points.shoulderCp1 = utils.beamIntersectsY(
|
||||
points.shoulder,
|
||||
points.shoulderCp1,
|
||||
points.armholePitch.y
|
||||
)
|
||||
points.armholeHollowCp2 = utils.beamIntersectsX(
|
||||
points.armholeHollow,
|
||||
points.armholeHollowCp2,
|
||||
points.armholePitch.x
|
||||
)
|
||||
|
||||
// Draw seamline
|
||||
paths.seam = new Path()
|
||||
.move(points.cfHem)
|
||||
.line(points.hem)
|
||||
.line(points.waist)
|
||||
.curve_(points.waistCp2, points.armhole)
|
||||
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||
.curve(points.armholeHollowCp2, points.shoulderCp1, points.shoulder)
|
||||
.line(points.neck)
|
||||
.curve(points.neckCp2, points.cfNeckCp1, points.cfNeck)
|
||||
.line(points.cfHem)
|
||||
.close()
|
||||
|
||||
// Store front sleevecap length
|
||||
store.set(
|
||||
'frontArmholeLength',
|
||||
new Path()
|
||||
.move(points.armhole)
|
||||
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||
.curve(points.armholeHollowCp2, points.shoulderCp1, points.shoulder)
|
||||
.length()
|
||||
)
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
macro('cutonfold', {
|
||||
from: points.cfNeck,
|
||||
to: points.cfHem,
|
||||
grainline: true
|
||||
})
|
||||
points.title = new Point(points.waist.x / 2, points.waist.y)
|
||||
macro('title', { at: points.title, nr: 1, title: 'front' })
|
||||
points.logo = points.title.shift(-90, 75)
|
||||
snippets.logo = new Snippet('logo', points.logo)
|
||||
|
||||
if (sa) {
|
||||
/*
|
||||
let saShoulder = new Path().move(points.strapRight).line(points.strapLeft).offset(sa)
|
||||
paths.saShoulder = new Path()
|
||||
.move(points.strapRight)
|
||||
.line(saShoulder.start())
|
||||
.join(saShoulder)
|
||||
.line(points.strapLeft)
|
||||
.attr('class', 'fabric sa')
|
||||
paths.sa = new Path()
|
||||
.move(points.cfHem)
|
||||
.line(points.cfHem)
|
||||
.join(
|
||||
new Path()
|
||||
.move(points.cfHem)
|
||||
.line(points.hem)
|
||||
.offset(sa * 2.5)
|
||||
)
|
||||
.join(
|
||||
new Path()
|
||||
.move(points.hem)
|
||||
.curve_(points.waist, points.armhole)
|
||||
.offset(sa)
|
||||
.line(points.armhole)
|
||||
)
|
||||
.attr('class', 'fabric sa')
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
//dimensions(macro, points, sa)
|
||||
//macro('vd', {
|
||||
// from: points.cfHem,
|
||||
// to: points.cfNeck,
|
||||
// x: points.cfHem.x - sa - 15
|
||||
//})
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
27
packages/teagan/src/index.js
Normal file
27
packages/teagan/src/index.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
import freesewing from '@freesewing/core'
|
||||
import Brian from '@freesewing/brian'
|
||||
import plugins from '@freesewing/plugin-bundle'
|
||||
import config from '../config'
|
||||
// Parts
|
||||
import draftBack from './back'
|
||||
import draftFront from './front'
|
||||
import draftSleeve from './sleeve'
|
||||
|
||||
// Create design
|
||||
const Pattern = new freesewing.Design(config, plugins)
|
||||
|
||||
// Attach draft methods to prototype
|
||||
Pattern.prototype.draftBase = function (part) {
|
||||
// Getting the base part from Brian
|
||||
return new Brian(this.settings).draftBase(part)
|
||||
}
|
||||
Pattern.prototype.draftSleevecap = function (part) {
|
||||
// Getting the sleevecap part from Brian
|
||||
let brian = new Brian(this.settings)
|
||||
return brian.draftSleevecap(part)
|
||||
}
|
||||
Pattern.prototype.draftFront = (part) => draftFront(part)
|
||||
Pattern.prototype.draftBack = (part) => draftBack(part)
|
||||
Pattern.prototype.draftSleeve = (part) => draftSleeve(part)
|
||||
|
||||
export default Pattern
|
37
packages/teagan/src/shared.js
Normal file
37
packages/teagan/src/shared.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
export function dimensions(macro, points, sa) {
|
||||
macro('hd', {
|
||||
from: points.cfHem,
|
||||
to: points.hem,
|
||||
y: points.hem.y + sa * 2.5 + 15
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.cfNeck,
|
||||
to: points.strapLeft,
|
||||
y: points.neck.y - sa - 15
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.cfNeck,
|
||||
to: points.strapRight,
|
||||
y: points.neck.y - sa - 30
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.hem,
|
||||
to: points.armhole,
|
||||
x: points.armhole.x + sa + 15
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.hem,
|
||||
to: points.strapRight,
|
||||
x: points.armhole.x + sa + 30
|
||||
})
|
||||
macro('vd', {
|
||||
from: points.hem,
|
||||
to: points.strapLeft,
|
||||
x: points.armhole.x + sa + 45
|
||||
})
|
||||
macro('hd', {
|
||||
from: points.cfNeck,
|
||||
to: points.armhole,
|
||||
y: points.neck.y - sa - 45
|
||||
})
|
||||
}
|
67
packages/teagan/src/sleeve.js
Normal file
67
packages/teagan/src/sleeve.js
Normal file
|
@ -0,0 +1,67 @@
|
|||
import { dimensions } from './shared'
|
||||
|
||||
export default function (part) {
|
||||
let {
|
||||
store,
|
||||
sa,
|
||||
Point,
|
||||
points,
|
||||
Path,
|
||||
paths,
|
||||
options,
|
||||
complete,
|
||||
paperless,
|
||||
macro,
|
||||
utils,
|
||||
units,
|
||||
measurements
|
||||
} = part.shorthand()
|
||||
|
||||
let height = points.bicepsRight.x * options.sleeveLength
|
||||
let width = measurements.biceps * (1 + options.bicepsEase) * (1 + options.sleeveEase)
|
||||
if (width > points.bicepsRight.x * 2) width = points.bicepsRight.x * 2
|
||||
points.hemLeft = new Point(width / -2, height)
|
||||
points.hemRight = new Point(width / 2, height)
|
||||
|
||||
paths.sleevecap = new Path()
|
||||
.move(points.bicepsRight)
|
||||
.curve(points.bicepsRight, points.capQ1Cp1, points.capQ1)
|
||||
.curve(points.capQ1Cp2, points.capQ2Cp1, points.capQ2)
|
||||
.curve(points.capQ2Cp2, points.capQ3Cp1, points.capQ3)
|
||||
.curve(points.capQ3Cp2, points.capQ4Cp1, points.capQ4)
|
||||
.curve(points.capQ4Cp2, points.bicepsLeft, points.bicepsLeft)
|
||||
.line(points.hemLeft)
|
||||
.line(points.hemRight)
|
||||
.line(points.bicepsRight)
|
||||
|
||||
let target = store.get('frontArmholeLength') + store.get('backArmholeLength')
|
||||
let ist = paths.sleevecap.length()
|
||||
console.log({ target, ist })
|
||||
|
||||
return part
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
macro('cutonfold', {
|
||||
from: points.cfNeck,
|
||||
to: points.cfHem,
|
||||
grainline: true
|
||||
})
|
||||
|
||||
macro('title', { at: points.title, nr: 2, title: 'back' })
|
||||
points.scaleboxAnchor = points.scalebox = points.title.shift(90, 100)
|
||||
macro('scalebox', { at: points.scalebox })
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
//dimensions(macro, points, sa)
|
||||
//macro('vd', {
|
||||
// from: points.cbHem,
|
||||
// to: points.cbNeck,
|
||||
// x: points.cbHem.x - sa - 15
|
||||
//})
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
39
packages/teagan/tests/shared.test.js
Normal file
39
packages/teagan/tests/shared.test.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
// This file is auto-generated.
|
||||
// Changes you make will be overwritten.
|
||||
const expect = require("chai").expect;
|
||||
const models = require("@freesewing/models")
|
||||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Teagan = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
'teagan',
|
||||
new Teagan(),
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'teagan',
|
||||
Teagan,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'teagan',
|
||||
Teagan,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue