✨ Added Benjamin pattern by @woutervdub
This commit is contained in:
parent
e58f222493
commit
6ccda91f77
17 changed files with 11591 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
aaron: "A FreeSewing pattern for a A-shirt or tank top"
|
||||
benjamin: "A FreeSewing pattern for a bow tie"
|
||||
bent: "A FreeSewing pattern for a menswear body block with a two-part sleeve"
|
||||
brian: "A FreeSewing pattern for a basic body block for menswear"
|
||||
bruce: "A FreeSewing pattern for boxer briefs"
|
||||
|
|
107
packages/benjamin/README.md
Normal file
107
packages/benjamin/README.md
Normal file
|
@ -0,0 +1,107 @@
|
|||
> **Note**: This is part of version 2 of FreeSewing.
|
||||
> It is a work in progress, and not ready for prime-time yet
|
||||
>
|
||||
> For all questions, please come say hello in [our chatroom on Gitter](https://gitter.im/).
|
||||
|
||||
<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://www.npmjs.com/package/@freesewing/benjamin"
|
||||
title="@freesewing/benjamin on NPM"
|
||||
><img src="https://img.shields.io/npm/v/@freesewing/benjamin.svg"
|
||||
alt="@freesewing/benjamin on NPM"/>
|
||||
</a><a
|
||||
href="https://opensource.org/licenses/MIT"
|
||||
title="License: MIT"
|
||||
><img src="https://img.shields.io/npm/l/@freesewing/benjamin.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%3Abenjamin"
|
||||
title="Open issues tagged pkg:benjamin"
|
||||
><img src="https://img.shields.io/github/issues/freesewing/freesewing/pkg:benjamin.svg?label=Issues"
|
||||
alt="Open issues tagged pkg:benjamin"/>
|
||||
</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/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>
|
||||
|
||||
# @freesewing/benjamin
|
||||
|
||||
A FreeSewing pattern for a bow tie
|
||||
|
||||
|
||||
|
||||
## 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).
|
55
packages/benjamin/config/index.js
Normal file
55
packages/benjamin/config/index.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
import { version } from "../package.json";
|
||||
|
||||
export default {
|
||||
name: "benjamin",
|
||||
version: version,
|
||||
design: "Wouter Van Wageningen",
|
||||
code: "Wouter Van Wageningen",
|
||||
department: "accessories",
|
||||
type: "pattern",
|
||||
difficulty: 3,
|
||||
tags: ["top", "basics"],
|
||||
optionGroups: {
|
||||
fit: ["collarEase", "adjustmentRibbon"],
|
||||
style: ["tipWidth", "knotWidth", "bowLength", "bowStyle", "endStyle"]
|
||||
},
|
||||
measurements: ["neckCircumference"],
|
||||
dependencies: {},
|
||||
inject: {},
|
||||
hide: [],
|
||||
parts: ["front"],
|
||||
options: {
|
||||
tipWidth: {
|
||||
mm: 65,
|
||||
min: 24,
|
||||
max: 80
|
||||
},
|
||||
knotWidth: {
|
||||
mm: 30,
|
||||
min: 24,
|
||||
max: 40
|
||||
},
|
||||
bowLength: {
|
||||
mm: 120,
|
||||
min: 100,
|
||||
max: 140
|
||||
},
|
||||
collarEase: {
|
||||
mm: 15,
|
||||
min: 0,
|
||||
max: 15
|
||||
},
|
||||
bowStyle: {
|
||||
dflt: "butterfly",
|
||||
list: ["diamond", "butterfly", "square", "widesquare"]
|
||||
},
|
||||
endStyle: {
|
||||
dflt: "straight",
|
||||
list: ["straight", "pointed", "rounded"]
|
||||
},
|
||||
adjustmentRibbon: {
|
||||
dflt: "0",
|
||||
list: ["0", "1"]
|
||||
}
|
||||
}
|
||||
};
|
10
packages/benjamin/example/.babelrc
Normal file
10
packages/benjamin/example/.babelrc
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugins": [
|
||||
["prismjs", {
|
||||
"languages": ["javascript", "css", "markup"],
|
||||
"plugins": ["line-numbers"],
|
||||
"theme": "twilight",
|
||||
"css": true
|
||||
}]
|
||||
]
|
||||
}
|
96
packages/benjamin/example/README.md
Normal file
96
packages/benjamin/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>
|
||||
|
||||
# benjamin 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://benjamin.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).
|
||||
|
47
packages/benjamin/example/package.json
Normal file
47
packages/benjamin/example/package.json
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "benjamin-example",
|
||||
"homepage": "https://freesewing.github.io/benjamin",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@freesewing/components": "beta",
|
||||
"@freesewing/core": "beta",
|
||||
"@freesewing/css-theme": "beta",
|
||||
"@freesewing/i18n": "beta",
|
||||
"@freesewing/models": "beta",
|
||||
"@freesewing/mui-theme": "beta",
|
||||
"@freesewing/pattern-info": "beta",
|
||||
"@freesewing/plugin-bundle": "beta",
|
||||
"@freesewing/plugin-i18n": "beta",
|
||||
"@freesewing/plugin-svgattr": "beta",
|
||||
"@freesewing/utils": "beta",
|
||||
"@material-ui/core": "^4.0.1",
|
||||
"@material-ui/icons": "^4.0.1",
|
||||
"@material-ui/lab": "^v4.0.0-alpha.14",
|
||||
"axios": "0.19.0",
|
||||
"pattern": "link:..",
|
||||
"prismjs": "1.16.0",
|
||||
"react": "^16.8",
|
||||
"react-dom": "^16.8",
|
||||
"react-scripts": "^3.0.0",
|
||||
"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": "1.0.2"
|
||||
}
|
||||
}
|
BIN
packages/benjamin/example/public/favicon.ico
Normal file
BIN
packages/benjamin/example/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
40
packages/benjamin/example/public/index.html
Normal file
40
packages/benjamin/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>benjamin</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/benjamin/example/public/manifest.json
Normal file
15
packages/benjamin/example/public/manifest.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"short_name": "benjamin",
|
||||
"name": "benjamin",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
22
packages/benjamin/example/src/App.js
Normal file
22
packages/benjamin/example/src/App.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
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;
|
||||
return (
|
||||
<Workbench
|
||||
freesewing={freesewing}
|
||||
Pattern={Pattern}
|
||||
config={config}
|
||||
userLanguage="en"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
11
packages/benjamin/example/src/index.js
Normal file
11
packages/benjamin/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();
|
127
packages/benjamin/example/src/serviceWorker.js
Normal file
127
packages/benjamin/example/src/serviceWorker.js
Normal file
|
@ -0,0 +1,127 @@
|
|||
// 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();
|
||||
});
|
||||
}
|
||||
}
|
10605
packages/benjamin/example/yarn.lock
Normal file
10605
packages/benjamin/example/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
90
packages/benjamin/package.json
Normal file
90
packages/benjamin/package.json
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
"name": "@freesewing/benjamin",
|
||||
"version": "2.0.0-beta.27",
|
||||
"description": "A FreeSewing pattern for a bow tie",
|
||||
"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": "npm run clean && rollup -c",
|
||||
"test": "echo \"benjamin: No tests configured. Perhaps you'd like to do this?\" && exit 0",
|
||||
"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\""
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@freesewing/core": "^2.0.0-beta.27",
|
||||
"@freesewing/plugin-bundle": "^2.0.0-beta.27"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"react": "^16.8",
|
||||
"react-dom": "^16.8",
|
||||
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
||||
"babel-eslint": "10.0.1",
|
||||
"eslint": "^5.16.0",
|
||||
"babel-jest": "24.7.1",
|
||||
"jest": "24.7.1",
|
||||
"@freesewing/components": "^2.0.0-beta.27",
|
||||
"@freesewing/css-theme": "^2.0.0-beta.27",
|
||||
"@freesewing/i18n": "^2.0.0-beta.27",
|
||||
"@freesewing/mui-theme": "^2.0.0-beta.27",
|
||||
"@freesewing/patterns": "^2.0.0-beta.27",
|
||||
"@freesewing/plugin-bust": "^2.0.0-beta.27",
|
||||
"@freesewing/plugin-buttons": "^2.0.0-beta.27",
|
||||
"@freesewing/plugin-flip": "^2.0.0-beta.27",
|
||||
"@freesewing/utils": "^2.0.0-beta.27",
|
||||
"@svgr/rollup": "^2.4.1",
|
||||
"cross-env": "^5.1.4",
|
||||
"gh-pages": "^1.2.0",
|
||||
"react-scripts": "^3.0.0",
|
||||
"webpack": "4.29.6",
|
||||
"rollup": "^0.64.1",
|
||||
"rollup-plugin-babel": "^4.0.1",
|
||||
"rollup-plugin-babel-minify": "^7.0.0",
|
||||
"rollup-plugin-commonjs": "^9.1.3",
|
||||
"rollup-plugin-json": "^3.1.0",
|
||||
"rollup-plugin-node-resolve": "^3.3.0",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.0",
|
||||
"rollup-plugin-postcss": "^1.6.2",
|
||||
"rollup-plugin-url": "^1.4.0",
|
||||
"@material-ui/core": "4.0.1",
|
||||
"@material-ui/icons": "4.0.1",
|
||||
"@material-ui/lab": "^v4.0.0-alpha.14",
|
||||
"react-intl": "2.8.0",
|
||||
"prop-types": "15.7.2"
|
||||
},
|
||||
"files": [
|
||||
"dist/*",
|
||||
"README.md",
|
||||
"package.json"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"tag": "beta"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0",
|
||||
"npm": ">=5"
|
||||
}
|
||||
}
|
59
packages/benjamin/rollup.config.js
Normal file
59
packages/benjamin/rollup.config.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
import babel from "rollup-plugin-babel";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import json from "rollup-plugin-json";
|
||||
import minify from "rollup-plugin-babel-minify";
|
||||
import yaml from "rollup-plugin-yaml";
|
||||
import url from "rollup-plugin-url";
|
||||
import postcss from "rollup-plugin-postcss";
|
||||
import svgr from "@svgr/rollup";
|
||||
import peerDepsExternal from "rollup-plugin-peer-deps-external";
|
||||
import {
|
||||
name,
|
||||
version,
|
||||
description,
|
||||
author,
|
||||
license,
|
||||
main,
|
||||
module
|
||||
} from "./package.json";
|
||||
|
||||
const output = [
|
||||
{
|
||||
file: main,
|
||||
format: "cjs",
|
||||
sourcemap: true
|
||||
}
|
||||
];
|
||||
if (typeof module !== "undefined")
|
||||
output.push({
|
||||
file: module,
|
||||
format: "es",
|
||||
sourcemap: true
|
||||
});
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
output,
|
||||
plugins: [
|
||||
peerDepsExternal(),
|
||||
resolve({ modulesOnly: true }),
|
||||
url(),
|
||||
commonjs(),
|
||||
json(),
|
||||
yaml(),
|
||||
svgr(),
|
||||
postcss({
|
||||
modules: true
|
||||
}),
|
||||
babel({
|
||||
exclude: "node_modules/**",
|
||||
plugins: ["@babel/plugin-proposal-object-rest-spread"]
|
||||
}),
|
||||
minify({
|
||||
comments: false,
|
||||
sourceMap: true,
|
||||
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||
})
|
||||
]
|
||||
};
|
293
packages/benjamin/src/front.js
Normal file
293
packages/benjamin/src/front.js
Normal file
|
@ -0,0 +1,293 @@
|
|||
function FlipAllPointsY(points, mirror, start, end) {
|
||||
for (var point in points) {
|
||||
if (point.substr(0, start.length) == start) {
|
||||
console.log(points[point]);
|
||||
points[end + point.substr(start.length)] = points[point].flipY(mirror);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default function(part) {
|
||||
let {
|
||||
store,
|
||||
sa,
|
||||
Point,
|
||||
points,
|
||||
Path,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
options,
|
||||
measurements,
|
||||
final,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
|
||||
// Remove from here
|
||||
//options.bowStyle = 'butterfly';
|
||||
//options.bowStyle = 'square';
|
||||
//options.bowStyle = 'widesquare';
|
||||
//options.bowStyle = 'diamond';
|
||||
//options.endStyle = 'straight' ;
|
||||
//options.endStyle = 'rounded' ;
|
||||
//options.endStyle = 'pointed' ;
|
||||
|
||||
//final = true;
|
||||
//paperless = true;
|
||||
//sa = 10;
|
||||
// Remove to here
|
||||
|
||||
if (options.bowStyle == "square") options.tipWidth = options.knotWidth;
|
||||
|
||||
let backWidth = 24;
|
||||
let bandLength = 70;
|
||||
let transitionLength = 50;
|
||||
let halfBackWidth = backWidth / 2;
|
||||
let halfTipWidth = options.tipWidth / 2;
|
||||
let halfBowLength = options.bowLength / 2;
|
||||
let halfKnotWidth = options.knotWidth / 2;
|
||||
|
||||
console.log(options.bowStyle);
|
||||
console.log(options.knotWidth);
|
||||
|
||||
let butterfly =
|
||||
options.bowStyle == "butterfly" || options.bowStyle == "diamond";
|
||||
|
||||
let tipAdjustment = 0;
|
||||
switch (options.endStyle) {
|
||||
case "pointed":
|
||||
tipAdjustment = halfTipWidth / 1.3;
|
||||
break;
|
||||
case "rounded":
|
||||
tipAdjustment = halfTipWidth;
|
||||
break;
|
||||
}
|
||||
|
||||
let hhbl /*halfHalfBowLength */ = halfBowLength / 2;
|
||||
let bcAdjust = options.bowStyle == "diamond" ? 10 : hhbl - 5;
|
||||
|
||||
let tieStart = new Path();
|
||||
let tieLowKnot = new Path();
|
||||
let tieTip = new Path();
|
||||
let tieTopKnot = new Path();
|
||||
let tieEnd = new Path();
|
||||
|
||||
points.Origin = new Point(0, 0);
|
||||
|
||||
points.LowBandEdge = points.Origin.shift(-90, halfBackWidth);
|
||||
points.LowKnotEdge = points.Origin.shift(-90, halfKnotWidth);
|
||||
points.LowTipEdge = points.Origin.shift(-90, halfTipWidth);
|
||||
|
||||
points.LowBandStart = points.LowBandEdge.clone();
|
||||
points.LowBandEnd = points.LowBandEdge.shift(0, bandLength);
|
||||
points.LowTransitionEnd = points.LowKnotEdge.shift(
|
||||
0,
|
||||
bandLength + transitionLength
|
||||
);
|
||||
|
||||
console.log(points["LowBandEdge"].x);
|
||||
|
||||
tieStart
|
||||
.move(points.Origin)
|
||||
.line(points.LowBandStart)
|
||||
.line(points.LowBandEnd)
|
||||
.line(points.LowTransitionEnd);
|
||||
|
||||
points.LowTip = points.LowTipEdge.shift(
|
||||
0,
|
||||
bandLength + transitionLength + halfBowLength * 3
|
||||
);
|
||||
points.Tip = points.Origin.shift(
|
||||
0,
|
||||
bandLength + transitionLength + halfBowLength * 3 + tipAdjustment
|
||||
);
|
||||
|
||||
if (butterfly) {
|
||||
points.LowTransitionEndCp2 = points.LowBandEnd.shiftOutwards(
|
||||
points.LowTransitionEnd,
|
||||
bcAdjust
|
||||
);
|
||||
points.LowHump = points.LowTipEdge.shift(
|
||||
0,
|
||||
bandLength + transitionLength + halfBowLength
|
||||
);
|
||||
points.LowHumpCp1 = points.LowHump.shift(180, bcAdjust);
|
||||
points.LowHumpCp2 = points.LowHump.shift(0, bcAdjust);
|
||||
points.LowValley = points.LowKnotEdge.shift(
|
||||
0,
|
||||
bandLength + transitionLength + halfBowLength * 2
|
||||
);
|
||||
points.LowValleyCp1 = points.LowValley.shift(180, bcAdjust);
|
||||
points.LowValleyCp2 = points.LowValley.shift(0, bcAdjust);
|
||||
points.LowTipCp1 = points.LowTip.shift(180, bcAdjust);
|
||||
}
|
||||
|
||||
points.LowTipCp2 = points.LowTip.shiftTowards(
|
||||
points.LowTipEdge,
|
||||
-tipAdjustment
|
||||
);
|
||||
points.TipCp1 = points.Tip.shift(-90, halfTipWidth / 4);
|
||||
points.TipCp2 = points.Tip.shift(90, halfTipWidth / 4);
|
||||
|
||||
FlipAllPointsY(points, points.Origin, "Low", "Top");
|
||||
|
||||
if (options.endStyle == "rounded") {
|
||||
tieTip
|
||||
.move(points.LowTip)
|
||||
.curve(points.LowTipCp2, points.TipCp1, points.Tip)
|
||||
.curve(points.TipCp2, points.TopTipCp2, points.TopTip);
|
||||
} else {
|
||||
tieTip
|
||||
.move(points.LowTip)
|
||||
.line(points.Tip)
|
||||
.line(points.TopTip);
|
||||
}
|
||||
|
||||
if (butterfly) {
|
||||
tieLowKnot
|
||||
.move(points.LowTransitionEnd)
|
||||
.curve(points.LowTransitionEndCp2, points.LowHumpCp1, points.LowHump)
|
||||
.curve(points.LowHumpCp2, points.LowValleyCp1, points.LowValley)
|
||||
.curve(points.LowValleyCp2, points.LowTipCp1, points.LowTip);
|
||||
tieTopKnot = tieTopKnot
|
||||
.move(points.TopTransitionEnd)
|
||||
.curve(points.TopTransitionEndCp2, points.TopHumpCp1, points.TopHump)
|
||||
.curve(points.TopHumpCp2, points.TopValleyCp1, points.TopValley)
|
||||
.curve(points.TopValleyCp2, points.TopTipCp1, points.TopTip)
|
||||
.reverse();
|
||||
}
|
||||
|
||||
tieEnd
|
||||
.move(points.TopTransitionEnd)
|
||||
.line(points.TopBandEnd)
|
||||
.line(points.TopBandStart)
|
||||
.line(points.Origin);
|
||||
|
||||
paths.tie = new Path()
|
||||
.move(points.Origin)
|
||||
.join(tieStart)
|
||||
.join(tieLowKnot)
|
||||
.join(tieTip)
|
||||
.join(tieTopKnot)
|
||||
.join(tieEnd)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
|
||||
// Final?
|
||||
if (final) {
|
||||
points.grainlineLeft = points.Origin.shift(0, 30);
|
||||
points.grainlineRight = points.Origin.shift(
|
||||
0,
|
||||
bandLength + transitionLength
|
||||
);
|
||||
macro("grainline", {
|
||||
from: points.grainlineLeft,
|
||||
to: points.grainlineRight
|
||||
});
|
||||
|
||||
points.titleAnchor = points.Origin.shift(
|
||||
0,
|
||||
bandLength + transitionLength + halfBowLength + 6
|
||||
);
|
||||
macro("title", { at: points.titleAnchor, nr: 1, title: "Bow Tie" });
|
||||
|
||||
if (!paperless) {
|
||||
let scaleboxAnchor = points.LowTipEdge.shift(-90, 30).shift(0, 50);
|
||||
macro("scalebox", { at: scaleboxAnchor });
|
||||
}
|
||||
|
||||
let logoAnchor = points.Tip.shift(0, 40);
|
||||
snippets.logo = new Snippet("logo", logoAnchor);
|
||||
|
||||
// Dummy line
|
||||
let h1 = logoAnchor.shift(0, 50);
|
||||
let h2 = h1.shift(0, 1);
|
||||
|
||||
paths.hidden = new Path()
|
||||
.move(h1)
|
||||
.line(h2)
|
||||
.attr("class", "hidden");
|
||||
}
|
||||
|
||||
if (sa) {
|
||||
paths.sa = paths.tie.offset(sa).attr("class", "fabric sa");
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
macro("hd", {
|
||||
from: points.LowBandStart,
|
||||
to: points.LowBandEnd,
|
||||
y: points.LowBandEdge.y + 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.LowBandEnd,
|
||||
to: points.LowTransitionEnd,
|
||||
y: points.LowBandEdge.y + 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.LowBandStart,
|
||||
to: points.TopBandStart,
|
||||
x: points.LowBandStart.x - 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.LowTip,
|
||||
to: points.TopTip,
|
||||
x: points.Tip.x + 15
|
||||
});
|
||||
|
||||
if (butterfly) {
|
||||
macro("hd", {
|
||||
from: points.LowTransitionEnd,
|
||||
to: points.LowHump,
|
||||
y: points.LowTip.y + 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.LowHump,
|
||||
to: points.LowValley,
|
||||
y: points.LowTip.y + 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.LowValley,
|
||||
to: points.LowTip,
|
||||
y: points.LowTip.y + 15
|
||||
});
|
||||
|
||||
//macro('vd', { from: points.LowTransitionEnd, to: points.TopTransitionEnd, x: points.LowTransitionEnd.x });
|
||||
macro("vd", {
|
||||
from: points.LowHump,
|
||||
to: points.TopHump,
|
||||
x: points.LowHump.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.LowValley,
|
||||
to: points.TopValley,
|
||||
x: points.LowValley.x
|
||||
});
|
||||
} else {
|
||||
if (options.bowStyle == "widesquare") {
|
||||
macro("vd", {
|
||||
from: points.LowTransitionEnd,
|
||||
to: points.TopTransitionEnd,
|
||||
x: points.LowTransitionEnd.x
|
||||
});
|
||||
}
|
||||
macro("hd", {
|
||||
from: points.LowTransitionEnd,
|
||||
to: points.LowTip,
|
||||
y: points.LowTip.y + 15
|
||||
});
|
||||
}
|
||||
|
||||
if (tipAdjustment) {
|
||||
macro("hd", {
|
||||
from: points.LowTip,
|
||||
to: points.Tip,
|
||||
y: points.LowTip.y + 15
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
13
packages/benjamin/src/index.js
Normal file
13
packages/benjamin/src/index.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import freesewing from "@freesewing/core";
|
||||
import plugins from "@freesewing/plugin-bundle";
|
||||
import config from "../config";
|
||||
// Parts
|
||||
import draftFront from "./front";
|
||||
|
||||
// Create new design
|
||||
const benjamin = new freesewing.Design(config, plugins);
|
||||
|
||||
// Attach draft methods to prototype
|
||||
benjamin.prototype.draftFront = draftFront;
|
||||
|
||||
export default benjamin;
|
Loading…
Add table
Add a link
Reference in a new issue