diff --git a/config/dependencies.yaml b/config/dependencies.yaml index f927256a91a..9f59470dcdd 100644 --- a/config/dependencies.yaml +++ b/config/dependencies.yaml @@ -148,6 +148,9 @@ mui-theme: '@material-ui/core': '^4.0.1' 'react': '^16.8' 'react-dom': '^16.8' +notation-legend: + peer: + '@freesewing/plugin-buttons': '^{{version}}' plugin-bundle: _: '@freesewing/plugin-cutonfold': '^{{version}}' diff --git a/config/descriptions.yaml b/config/descriptions.yaml index ddc5464d6ef..28adfd825fc 100644 --- a/config/descriptions.yaml +++ b/config/descriptions.yaml @@ -23,6 +23,7 @@ i18n: 'Translations for the FreeSewing project' jaeger: 'A FreeSewing pattern for a sport coat style jacket' models: 'Body measurements data for a range of default sizes' mui-theme: 'A Material-UI theme for FreeSewing web UIs' +notation-legend: 'A FreeSewing pattern to document pattern notation' pattern-info: 'Information about available freesewing patterns' penelope: 'A FreeSewing pattern for a pencil skirt' plugin-banner: 'A FreeSewing plugin to repeat text on a path' diff --git a/packages/css-theme/src/components/_draft.scss b/packages/css-theme/src/components/_draft.scss index 393016aeafd..d8c4c0910dd 100644 --- a/packages/css-theme/src/components/_draft.scss +++ b/packages/css-theme/src/components/_draft.scss @@ -101,6 +101,23 @@ svg.freesewing.draft { font-weight: bold; stroke: none; } + /* New style for sampled sizes */ + path.size-3XS, + path.size-2XS, + path.size-XS, + path.size-S, + path.size-M { + stroke-width: 0.5; + stroke-dasharray: 0.25 0.75; + } + path.made-to-measure, + path.size-L, + path.size-XL, + path.size-2XL, + path.size-3XL, + path.size-4XL { + stroke-width: 0.5; + } } svg.freesewing.draft text { @@ -176,6 +193,41 @@ svg.freesewing.draft text { stroke: none; fill: $fc-bg-dark; } + + /* New style for sampled sizes */ + path.made-to-measure { + stroke: #212529; + } + path.size-3XS { + stroke: $oc-lime-6; + } + path.size-2XS { + stroke: $oc-orange-6; + } + path.size-XS { + stroke: $oc-grape-6; + } + path.size-S { + stroke: $oc-indigo-6; + } + path.size-M { + stroke: $oc-cyan-6; + } + path.size-L { + stroke: $oc-indigo-6; + } + path.size-XL { + stroke: $oc-grape-6; + } + path.size-2XL { + stroke: $oc-orange-6; + } + path.size-3XL { + stroke: $oc-lime-6; + } + path.size-4XL { + stroke: $oc-teal-6; + } } .theme-wrapper.dark svg.freesewing.draft { /* Stroke classes */ @@ -247,6 +299,41 @@ svg.freesewing.draft text { stroke: none; fill: $fc-bg-light; } + + /* New style for sampled sizes */ + path.made-to-measure { + stroke: #f8f9fa; + } + path.size-3XS { + stroke: $oc-lime-3; + } + path.size-2XS { + stroke: $oc-orange-3; + } + path.size-XS { + stroke: $oc-grape-3; + } + path.size-S { + stroke: $oc-indigo-3; + } + path.size-M { + stroke: $oc-cyan-3; + } + path.size-L { + stroke: $oc-indigo-3; + } + path.size-XL { + stroke: $oc-grape-3; + } + path.size-2XL { + stroke: $oc-orange-3; + } + path.size-3XL { + stroke: $oc-lime-3; + } + path.size-4XL { + stroke: $oc-teal-3; + } } /* SVG defs (snippets) are in the shadow DOM */ diff --git a/packages/notation-legend/.eslintrc.js b/packages/notation-legend/.eslintrc.js new file mode 100644 index 00000000000..2ff6e0a1366 --- /dev/null +++ b/packages/notation-legend/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: 'standard' +} diff --git a/packages/notation-legend/CHANGELOG.md b/packages/notation-legend/CHANGELOG.md new file mode 100644 index 00000000000..263f8240972 --- /dev/null +++ b/packages/notation-legend/CHANGELOG.md @@ -0,0 +1,112 @@ +# Change log for: @freesewing/examples + +## Unreleased + +**Note:** Version bump only for package examples + +## 2.6.0 (2020-05-01) + +**Note:** Version bump only for package examples + +## 2.5.0 (2020-04-05) + +**Note:** Version bump only for package examples + +## 2.4.6 (2020-03-23) + +**Note:** Version bump only for package examples + +## 2.4.5 (2020-03-19) + +**Note:** Version bump only for package examples + +## 2.4.4 (2020-03-15) + +**Note:** Version bump only for package examples + +## 2.4.3 (2020-03-12) + +**Note:** Version bump only for package examples + +## 2.4.2 (2020-03-08) + +**Note:** Version bump only for package examples + +## 2.4.1 (2020-03-04) + +**Note:** Version bump only for package examples + +## 2.4.0 (2020-02-29) + +**Note:** Version bump only for package examples + +## 2.3.0 (2020-02-23) + +**Note:** Version bump only for package examples + +## 2.2.0 (2020-02-22) + +**Note:** Version bump only for package examples + +## 2.1.9 (2020-01-18) + +**Note:** Version bump only for package examples + +## 2.1.8 (2019-12-16) + +**Note:** Version bump only for package examples + +## 2.1.7 (2019-12-15) + +**Note:** Version bump only for package examples + +## 2.1.6 (2019-11-24) + +**Note:** Version bump only for package examples + +## 2.1.5 (2019-11-19) + +**Note:** Version bump only for package examples + +## 2.1.4 (2019-11-01) + +**Note:** Version bump only for package examples + +## 2.1.3 (2019-10-18) + +**Note:** Version bump only for package examples + +## 2.1.2 (2019-10-14) + +**Note:** Version bump only for package examples + +## 2.1.1 (2019-10-13) + +**Note:** Version bump only for package examples + +## 2.1.0 (2019-10-06) + +**Note:** Version bump only for package examples + +## 2.0.4 (2019-09-27) + +**Note:** Version bump only for package examples + +## 2.0.3 (2019-09-15) + +**Note:** Version bump only for package examples + +## 2.0.2 (2019-09-06) + +**Note:** Version bump only for package examples + +## 2.0.1 (2019-09-01) + +**Note:** Version bump only for package examples + +## 2.0.0 (2019-08-25) + +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/packages/notation-legend/README.md b/packages/notation-legend/README.md new file mode 100644 index 00000000000..7d234a9c451 --- /dev/null +++ b/packages/notation-legend/README.md @@ -0,0 +1,99 @@ +![FreeSewing](https://freesewing.org/banner.jpg) + +

@freesewing/examples on NPM + License: MIT + Code quality on DeepScan + Open issues tagged pkg:examples +

Follow @freesewing_org on Twitter + Chat with us on Gitter + Become a FreeSewing Patron + Follow @freesewing_org on Twitter +

+ +## 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/examples** + +A FreeSewing pattern holding examples for our documentation + +## 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). diff --git a/packages/notation-legend/config/index.js b/packages/notation-legend/config/index.js new file mode 100644 index 00000000000..ab72b02e4d4 --- /dev/null +++ b/packages/notation-legend/config/index.js @@ -0,0 +1,43 @@ +import { version } from '../package.json' + +export default { + name: 'notation-legend', + version, + design: 'Joost De Cock', + code: 'Joost De Cock', + department: 'accessories', + type: 'pattern', + difficulty: 1, + tags: ['documentation'], + optionGroups: { + fit: ['fixme'] + }, + measurements: [], + parts: [ + 'fabricLines', + 'saLines', + 'otherLines', + 'sa', + 'logo', + 'notches', + 'buttons', + 'snaps', + 'cutonfold', + 'grainline', + 'dimension', + 'title', + 'scalebox', + 'lineWidths', + 'lineStrokes', + 'sizes' + ], + options: { + focus: '', + // Optiongroups are needed for now, because workbench + fixme: { + pct: 50, + min: 0, + max: 100 + } + } +} diff --git a/packages/notation-legend/example/.babelrc b/packages/notation-legend/example/.babelrc new file mode 100644 index 00000000000..6e3090a4956 --- /dev/null +++ b/packages/notation-legend/example/.babelrc @@ -0,0 +1,10 @@ +{ + "plugins": [ + ["prismjs", { + "languages": ["javascript", "css", "markup"], + "plugins": ["line-numbers"], + "theme": "twilight", + "css": true + }] + ] +} diff --git a/packages/notation-legend/example/README.md b/packages/notation-legend/example/README.md new file mode 100644 index 00000000000..4fed030fc9b --- /dev/null +++ b/packages/notation-legend/example/README.md @@ -0,0 +1,95 @@ +

+Freesewing logo +
+FreeSewing v2 +

+

A JavaScript library for made-to-measure sewing patterns

+

Follow @freesewing_org on Twitter + Chat with us on Gitter + Become a FreeSewing Patron + Follow @freesewing_org on Twitter + +

+ +# examples 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://examples.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). diff --git a/packages/notation-legend/example/package.json b/packages/notation-legend/example/package.json new file mode 100644 index 00000000000..49218445f64 --- /dev/null +++ b/packages/notation-legend/example/package.json @@ -0,0 +1,48 @@ +{ + "name": "examples-example", + "homepage": "https://freesewing.github.io/examples", + "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.4.0", + "@material-ui/icons": "^4.2.1", + "@material-ui/lab": "^v4.0.0-alpha.25", + "pattern": "link:..", + "prismjs": "1.17.1", + "react": "^16.9", + "react-dom": "^16.9", + "react-scripts": "^3.1.1", + "file-saver": "^2.0.2", + "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.1.1" + } +} diff --git a/packages/notation-legend/example/public/App.js b/packages/notation-legend/example/public/App.js new file mode 100644 index 00000000000..e1d3f30cacb --- /dev/null +++ b/packages/notation-legend/example/public/App.js @@ -0,0 +1,16 @@ +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 +} + +export default App diff --git a/packages/notation-legend/example/public/favicon.ico b/packages/notation-legend/example/public/favicon.ico new file mode 100644 index 00000000000..95061a260f1 Binary files /dev/null and b/packages/notation-legend/example/public/favicon.ico differ diff --git a/packages/notation-legend/example/public/index.html b/packages/notation-legend/example/public/index.html new file mode 100644 index 00000000000..29c4b9d87b2 --- /dev/null +++ b/packages/notation-legend/example/public/index.html @@ -0,0 +1,40 @@ + + + + + + + + + + + examples + + + +
+ + + diff --git a/packages/notation-legend/example/public/manifest.json b/packages/notation-legend/example/public/manifest.json new file mode 100644 index 00000000000..7e8fcdf8ce0 --- /dev/null +++ b/packages/notation-legend/example/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "examples", + "name": "examples", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/packages/notation-legend/example/src/App.js b/packages/notation-legend/example/src/App.js new file mode 100644 index 00000000000..24533646faa --- /dev/null +++ b/packages/notation-legend/example/src/App.js @@ -0,0 +1,30 @@ +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 ( + + ) +} + +export default App diff --git a/packages/notation-legend/example/src/index.js b/packages/notation-legend/example/src/index.js new file mode 100644 index 00000000000..9dd7ba788d4 --- /dev/null +++ b/packages/notation-legend/example/src/index.js @@ -0,0 +1,11 @@ +import React from 'react' +import ReactDOM from 'react-dom' +import App from './App' +import * as serviceWorker from './serviceWorker' + +ReactDOM.render(, 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() diff --git a/packages/notation-legend/example/src/serviceWorker.js b/packages/notation-legend/example/src/serviceWorker.js new file mode 100644 index 00000000000..4fe923e7795 --- /dev/null +++ b/packages/notation-legend/example/src/serviceWorker.js @@ -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() + }) + } +} diff --git a/packages/notation-legend/package.json b/packages/notation-legend/package.json new file mode 100644 index 00000000000..a4100847cc8 --- /dev/null +++ b/packages/notation-legend/package.json @@ -0,0 +1,89 @@ +{ + "name": "@freesewing/examples", + "version": "2.6.0", + "description": "A FreeSewing pattern holding examples for our documentation", + "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" + }, + "keywords": [ + "freesewing", + "documentation", + "example", + "parametric design" + ], + "main": "dist/index.js", + "module": "dist/index.mjs", + "scripts": { + "clean": "rimraf dist", + "build": "npm run clean && 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.6.0", + "@freesewing/plugin-bundle": "^2.6.0" + }, + "dependencies": {}, + "devDependencies": { + "react": "^16.8", + "react-dom": "^16.8", + "@babel/plugin-proposal-class-properties": "^7.0.0", + "babel-eslint": "10.1.0", + "eslint": "^5.16.0", + "babel-jest": "24.7.1", + "jest": "24.7.1", + "@freesewing/components": "^2.6.0", + "@freesewing/css-theme": "^2.6.0", + "@freesewing/i18n": "^2.6.0", + "@freesewing/mui-theme": "^2.6.0", + "@freesewing/plugin-bust": "^2.6.0", + "@freesewing/plugin-buttons": "^2.6.0", + "@freesewing/plugin-flip": "^2.6.0", + "@freesewing/utils": "^2.6.0", + "@svgr/rollup": "^5.4.0", + "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", + "mocha": "^6.1.4", + "chai": "^4.1.2", + "chai-string": "^1.4.0", + "@babel/register": "^7.4.4" + }, + "files": [ + "dist/*", + "README.md", + "package.json" + ], + "publishConfig": { + "access": "public", + "tag": "latest" + }, + "engines": { + "node": ">=8.0.0", + "npm": ">=5" + } +} diff --git a/packages/notation-legend/rollup.config.js b/packages/notation-legend/rollup.config.js new file mode 100644 index 00000000000..142439a7f29 --- /dev/null +++ b/packages/notation-legend/rollup.config.js @@ -0,0 +1,41 @@ +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 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 }), + commonjs(), + json(), + 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 */` + }) + ] +} diff --git a/packages/notation-legend/src/buttons.js b/packages/notation-legend/src/buttons.js new file mode 100644 index 00000000000..81c35d799fc --- /dev/null +++ b/packages/notation-legend/src/buttons.js @@ -0,0 +1,16 @@ +import { box, drawLine } from './shared' +import { fabricTypes } from './styles' + +export default (part) => { + const { points, Point, snippets, Snippet } = part.shorthand() + + points.a = new Point(30, 10) + points.atxt = new Point(30, 20).attr('data-text', 'button').attr('data-text-class', 'center') + snippets.a = new Snippet('button', points.a) + + points.b = new Point(80, 10) + points.btxt = new Point(80, 20).attr('data-text', 'buttonhole').attr('data-text-class', 'center') + snippets.b = new Snippet('buttonhole', points.b).attr('data-rotate', 90) + + return box(part, 120, 30) +} diff --git a/packages/notation-legend/src/cutonfold.js b/packages/notation-legend/src/cutonfold.js new file mode 100644 index 00000000000..62546d4d300 --- /dev/null +++ b/packages/notation-legend/src/cutonfold.js @@ -0,0 +1,15 @@ +import { box, drawLine } from './shared' + +export default (part) => { + const { points, Point, macro } = part.shorthand() + + points.a = new Point(10, 20) + points.b = new Point(90, 20) + + macro('cutonfold', { + from: points.a, + to: points.b + }) + + return box(part, 100, 25) +} diff --git a/packages/notation-legend/src/dimension.js b/packages/notation-legend/src/dimension.js new file mode 100644 index 00000000000..e15264b8463 --- /dev/null +++ b/packages/notation-legend/src/dimension.js @@ -0,0 +1,15 @@ +import { box, drawLine } from './shared' + +export default (part) => { + const { points, Point, macro } = part.shorthand() + + points.a = new Point(10, 20) + points.b = new Point(90, 20) + + macro('ld', { + from: points.a, + to: points.b + }) + + return box(part, 100, 25) +} diff --git a/packages/notation-legend/src/fabriclines.js b/packages/notation-legend/src/fabriclines.js new file mode 100644 index 00000000000..68986cd3bb4 --- /dev/null +++ b/packages/notation-legend/src/fabriclines.js @@ -0,0 +1,13 @@ +import { box, drawLine } from './shared' +import { fabricTypes } from './styles' + +export default (part) => { + let y = 10 + let w = 110 + for (const t of fabricTypes) { + drawLine(part, y, t) + y += 15 + } + + return box(part, 120, 65) +} diff --git a/packages/notation-legend/src/grainline.js b/packages/notation-legend/src/grainline.js new file mode 100644 index 00000000000..3768bf33604 --- /dev/null +++ b/packages/notation-legend/src/grainline.js @@ -0,0 +1,15 @@ +import { box, drawLine } from './shared' + +export default (part) => { + const { points, Point, macro } = part.shorthand() + + points.a = new Point(10, 20) + points.b = new Point(90, 20) + + macro('grainline', { + from: points.a, + to: points.b + }) + + return box(part, 100, 25) +} diff --git a/packages/notation-legend/src/index.js b/packages/notation-legend/src/index.js new file mode 100644 index 00000000000..3e88edb83df --- /dev/null +++ b/packages/notation-legend/src/index.js @@ -0,0 +1,48 @@ +import freesewing from '@freesewing/core' +import plugins from '@freesewing/plugin-bundle' +import buttonsPlugin from '@freesewing/plugin-buttons' +import config from '../config/' +// Notation examples +import draftFabricLines from './fabriclines' +import draftSaLines from './salines' +import draftOtherLines from './otherlines' +import draftSa from './sa' +import draftNotches from './notches' +import draftButtons from './buttons' +import draftSnaps from './snaps' +import draftLogo from './logo' +import draftCutonfold from './cutonfold' +import draftGrainline from './grainline' +import draftDimension from './dimension' +import draftTitle from './title' +import draftScalebox from './scalebox' +import draftLineWidths from './linewidths' +import draftLineStrokes from './linestrokes' +import draftSizes from './sizes' + +// Create design +const Pattern = new freesewing.Design(config, [plugins, buttonsPlugin]) + +// Attach draft methods to prototype +let methods = { + draftFabricLines, + draftSaLines, + draftOtherLines, + draftSa, + draftLogo, + draftButtons, + draftSnaps, + draftNotches, + draftCutonfold, + draftGrainline, + draftDimension, + draftTitle, + draftScalebox, + draftLineWidths, + draftLineStrokes, + draftSizes +} + +for (let m of Object.keys(methods)) Pattern.prototype[m] = methods[m] + +export default Pattern diff --git a/packages/notation-legend/src/linestrokes.js b/packages/notation-legend/src/linestrokes.js new file mode 100644 index 00000000000..6a22b854a26 --- /dev/null +++ b/packages/notation-legend/src/linestrokes.js @@ -0,0 +1,13 @@ +import { box, drawLine } from './shared' +import { lineStrokes } from './styles' + +export default (part) => { + let y = 10 + let w = 110 + for (const t of lineStrokes) { + drawLine(part, y, t) + y += 15 + } + + return box(part, 120, 50) +} diff --git a/packages/notation-legend/src/linewidths.js b/packages/notation-legend/src/linewidths.js new file mode 100644 index 00000000000..b4f71b3bd43 --- /dev/null +++ b/packages/notation-legend/src/linewidths.js @@ -0,0 +1,13 @@ +import { box, drawLine } from './shared' +import { lineWidths } from './styles' + +export default (part) => { + let y = 10 + let w = 110 + for (const t of lineWidths) { + drawLine(part, y, t) + y += 15 + } + + return box(part, 120, 95) +} diff --git a/packages/notation-legend/src/logo.js b/packages/notation-legend/src/logo.js new file mode 100644 index 00000000000..d916133de69 --- /dev/null +++ b/packages/notation-legend/src/logo.js @@ -0,0 +1,11 @@ +import { box, drawLine } from './shared' + +export default (part) => { + const { points, Point, snippets, Snippet } = part.shorthand() + + points.a = new Point(50, 40) + points.atxt = new Point(30, 20).attr('data-text', 'logo').attr('data-text-class', 'center') + snippets.a = new Snippet('logo', points.a) + + return box(part, 100, 60) +} diff --git a/packages/notation-legend/src/notches.js b/packages/notation-legend/src/notches.js new file mode 100644 index 00000000000..f6acc157e3d --- /dev/null +++ b/packages/notation-legend/src/notches.js @@ -0,0 +1,16 @@ +import { box, drawLine } from './shared' +import { fabricTypes } from './styles' + +export default (part) => { + const { points, Point, snippets, Snippet } = part.shorthand() + + points.a = new Point(30, 10) + points.atxt = new Point(30, 20).attr('data-text', 'notch').attr('data-text-class', 'center') + snippets.a = new Snippet('notch', points.a) + + points.b = new Point(80, 10) + points.btxt = new Point(80, 20).attr('data-text', 'bnotch').attr('data-text-class', 'center') + snippets.b = new Snippet('bnotch', points.b) + + return box(part, 120, 30) +} diff --git a/packages/notation-legend/src/otherlines.js b/packages/notation-legend/src/otherlines.js new file mode 100644 index 00000000000..aca1a2c0943 --- /dev/null +++ b/packages/notation-legend/src/otherlines.js @@ -0,0 +1,26 @@ +import { box } from './shared' +import { lineTypes } from './styles' + +export default (part) => { + let { points, Point, paths, Path, snippets, Snippet } = part.shorthand() + + const drawLine = (y, t) => { + points[`${t}From`] = new Point(10, y) + points[`${t}To`] = new Point(w, y) + paths[t] = new Path() + .move(points[`${t}From`]) + .line(points[`${t}To`]) + .attr('class', t) + .attr('data-text', t) + .attr('data-text-class', 'center') + } + + let y = 10 + let w = 110 + for (const t of lineTypes) { + drawLine(y, t) + y += 15 + } + + return box(part, 120, 65) +} diff --git a/packages/notation-legend/src/sa.js b/packages/notation-legend/src/sa.js new file mode 100644 index 00000000000..4e9a9486cce --- /dev/null +++ b/packages/notation-legend/src/sa.js @@ -0,0 +1,22 @@ +import { box, drawLine } from './shared' +import { fabricTypes } from './styles' + +export default (part) => { + const { points, Point, paths, Path } = part.shorthand() + + points.a = new Point(10, 40) + points.aCp = new Point(40, 40) + points.b = new Point(69.5, 10) + points.c = new Point(110, 50) + + paths.a = new Path() + .move(points.a) + .curve_(points.aCp, points.b) + .line(points.c) + .attr('class', 'fabric') + .attr('data-text', 'seam') + + paths.sa = paths.a.offset(-10).attr('class', 'fabric sa').attr('data-text', 'seamAllowance') + + return box(part, 120, 60) +} diff --git a/packages/notation-legend/src/salines.js b/packages/notation-legend/src/salines.js new file mode 100644 index 00000000000..934bf51534d --- /dev/null +++ b/packages/notation-legend/src/salines.js @@ -0,0 +1,13 @@ +import { box, drawLine } from './shared' +import { fabricTypes } from './styles' + +export default (part) => { + let y = 10 + let w = 110 + for (const t of fabricTypes) { + drawLine(part, y, t + ' sa') + y += 15 + } + + return box(part, 120, 65) +} diff --git a/packages/notation-legend/src/scalebox.js b/packages/notation-legend/src/scalebox.js new file mode 100644 index 00000000000..07f9f1a2ad3 --- /dev/null +++ b/packages/notation-legend/src/scalebox.js @@ -0,0 +1,10 @@ +import { box, drawLine } from './shared' + +export default (part) => { + const { points, Point, macro } = part.shorthand() + + points.a = new Point(55, 25) + macro('scalebox', { at: points.a }) + + return box(part, 110, 55) +} diff --git a/packages/notation-legend/src/shared.js b/packages/notation-legend/src/shared.js new file mode 100644 index 00000000000..b4d2450fd7d --- /dev/null +++ b/packages/notation-legend/src/shared.js @@ -0,0 +1,27 @@ +/** + * This draws a (diagonal in a) box + * with with w and height h with a non-visible line. + * This is to force our examples parts to a certain size + */ +export function box(part, w = 100, h = 50) { + part.paths.box = new part.Path() + .move(new part.Point(0, 0)) + .line(new part.Point(w, h)) + .attr('class', 'hidden') + + return part +} + +export function drawLine(part, y, t) { + let { points, Point, paths, Path } = part.shorthand() + points[`${t}From`] = new Point(10, y) + points[`${t}To`] = new Point(110, y) + paths[t] = new Path() + .move(points[`${t}From`]) + .line(points[`${t}To`]) + .attr('class', t) + .attr('data-text', t) + .attr('data-text-class', 'center') + + return part +} diff --git a/packages/notation-legend/src/sizes.js b/packages/notation-legend/src/sizes.js new file mode 100644 index 00000000000..73d6978758e --- /dev/null +++ b/packages/notation-legend/src/sizes.js @@ -0,0 +1,106 @@ +import { box, drawLine } from './shared' + +export default (part) => { + const { points, Point, paths, Path } = part.shorthand() + + points.xxxs1 = new Point(0, 10) + points.xxxs2 = new Point(10, 10) + paths.xxxs = new Path() + .move(points.xxxs1) + .line(points.xxxs2) + .attr('class', 'size-3XS') + .attr('data-text', '3XS') + .attr('data-text-class', 'center text-xs') + + points.xxs1 = new Point(12, 10) + points.xxs2 = new Point(22, 10) + paths.xxs = new Path() + .move(points.xxs1) + .line(points.xxs2) + .attr('class', 'size-2XS') + .attr('data-text', '2XS') + .attr('data-text-class', 'center text-xs') + + points.xs1 = new Point(24, 10) + points.xs2 = new Point(34, 10) + paths.xs = new Path() + .move(points.xs1) + .line(points.xs2) + .attr('class', 'size-XS') + .attr('data-text', 'XS') + .attr('data-text-class', 'center text-xs') + + points.s1 = new Point(36, 10) + points.s2 = new Point(46, 10) + paths.s = new Path() + .move(points.s1) + .line(points.s2) + .attr('class', 'size-S') + .attr('data-text', 'S') + .attr('data-text-class', 'center text-xs') + + points.m1 = new Point(48, 10) + points.m2 = new Point(58, 10) + paths.m = new Path() + .move(points.m1) + .line(points.m2) + .attr('class', 'size-M') + .attr('data-text', 'M') + .attr('data-text-class', 'center text-xs') + + points.l1 = new Point(60, 10) + points.l2 = new Point(70, 10) + paths.l = new Path() + .move(points.l1) + .line(points.l2) + .attr('class', 'size-L') + .attr('data-text', 'L') + .attr('data-text-class', 'center text-xs') + + points.xl1 = new Point(72, 10) + points.xl2 = new Point(82, 10) + paths.xl = new Path() + .move(points.xl1) + .line(points.xl2) + .attr('class', 'size-XL') + .attr('data-text', 'XL') + .attr('data-text-class', 'center text-xs') + + points.xxl1 = new Point(84, 10) + points.xxl2 = new Point(96, 10) + paths.xxl = new Path() + .move(points.xxl1) + .line(points.xxl2) + .attr('class', 'size-2XL') + .attr('data-text', '2XL') + .attr('data-text-class', 'center text-xs') + + points.xxxl1 = new Point(98, 10) + points.xxxl2 = new Point(108, 10) + paths.xxxl = new Path() + .move(points.xxxl1) + .line(points.xxxl2) + .attr('class', 'size-3XL') + .attr('data-text', '3XL') + .attr('data-text-class', 'center text-xs') + + points.xxxxl1 = new Point(110, 10) + points.xxxxl2 = new Point(120, 10) + paths.xxxxl = new Path() + .move(points.xxxxl1) + .line(points.xxxxl2) + .attr('class', 'size-4XL') + .attr('data-text', '4XL') + .attr('data-text-class', 'center text-xs') + + points.m2m1 = new Point(0, 17) + points.m2m2 = new Point(120, 17) + paths.m2m = new Path() + .move(points.m2m1) + .line(points.m2m2) + .attr('class', 'made-to-measure') + .attr('data-text', 'madeToMeasure') + .attr('data-text-class', 'center text-xs') + + return box(part, 120, 20) +} diff --git a/packages/notation-legend/src/snaps.js b/packages/notation-legend/src/snaps.js new file mode 100644 index 00000000000..fe0d6ed6dfa --- /dev/null +++ b/packages/notation-legend/src/snaps.js @@ -0,0 +1,16 @@ +import { box, drawLine } from './shared' +import { fabricTypes } from './styles' + +export default (part) => { + const { points, Point, snippets, Snippet } = part.shorthand() + + points.a = new Point(30, 10) + points.atxt = new Point(30, 20).attr('data-text', 'snap-stud').attr('data-text-class', 'center') + snippets.a = new Snippet('snap-stud', points.a) + + points.b = new Point(80, 10) + points.btxt = new Point(80, 20).attr('data-text', 'snap-socket').attr('data-text-class', 'center') + snippets.b = new Snippet('snap-socket', points.b).attr('data-rotate', 90) + + return box(part, 120, 30) +} diff --git a/packages/notation-legend/src/styles.js b/packages/notation-legend/src/styles.js new file mode 100644 index 00000000000..34e0827126e --- /dev/null +++ b/packages/notation-legend/src/styles.js @@ -0,0 +1,14 @@ +export const fabricTypes = ['fabric', 'lining', 'canvas', 'interfacing', 'various'] + +export const lineTypes = ['note', 'mark', 'contrast', 'help'] + +export const lineWidths = [ + 'stroke-xs', + 'stroke-sm', + 'default', + 'stroke-lg', + 'stroke-xl', + 'stroke-xxl' +] + +export const lineStrokes = ['dotted', 'dashed', 'lashed'] diff --git a/packages/notation-legend/src/title.js b/packages/notation-legend/src/title.js new file mode 100644 index 00000000000..28aefdb7934 --- /dev/null +++ b/packages/notation-legend/src/title.js @@ -0,0 +1,15 @@ +import { box, drawLine } from './shared' + +export default (part) => { + const { points, Point, macro } = part.shorthand() + + points.a = new Point(30, 30) + + macro('title', { + at: points.a, + nr: 1, + title: 'Part name' + }) + + return box(part, 100, 65) +} diff --git a/packages/notation-legend/test.html b/packages/notation-legend/test.html new file mode 100644 index 00000000000..dbb7342c9e5 --- /dev/null +++ b/packages/notation-legend/test.html @@ -0,0 +1,14 @@ + + + + + Brian + + +
+ + + + diff --git a/packages/notation-legend/tests/shared.test.js b/packages/notation-legend/tests/shared.test.js new file mode 100644 index 00000000000..14c227a60fd --- /dev/null +++ b/packages/notation-legend/tests/shared.test.js @@ -0,0 +1,21 @@ +// 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 Examples = 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('examples', new Examples(), expect, models, patterns) + +// Test drafting +testPatternDrafting('examples', Examples, expect, models, patterns) + +// Test sampling +testPatternSampling('examples', Examples, expect, models, patterns)