diff --git a/packages/holmes/CHANGELOG.md b/packages/holmes/CHANGELOG.md new file mode 100644 index 00000000000..6cb4d84570c --- /dev/null +++ b/packages/holmes/CHANGELOG.md @@ -0,0 +1,86 @@ +# Change log for: @freesewing/holmes + + +## Unreleased + +**Note:** Version bump only for package holmes + + +## 2.1.9 (2020-01-18) + +**Note:** Version bump only for package holmes + + +## 2.1.8 (2019-12-16) + +**Note:** Version bump only for package holmes + + +## 2.1.7 (2019-12-15) + +**Note:** Version bump only for package holmes + + +## 2.1.6 (2019-11-24) + +**Note:** Version bump only for package holmes + + +## 2.1.5 (2019-11-19) + +**Note:** Version bump only for package holmes + + +## 2.1.4 (2019-11-01) + +**Note:** Version bump only for package holmes + + +## 2.1.3 (2019-10-18) + +**Note:** Version bump only for package holmes + + +## 2.1.2 (2019-10-14) + +**Note:** Version bump only for package holmes + + +## 2.1.1 (2019-10-13) + +**Note:** Version bump only for package holmes + + +## 2.1.0 (2019-10-06) + +**Note:** Version bump only for package holmes + + +## 2.0.4 (2019-09-27) + +**Note:** Version bump only for package holmes + + +## 2.0.3 (2019-09-15) + +**Note:** Version bump only for package holmes + + +## 2.0.2 (2019-09-06) + +**Note:** Version bump only for package holmes + + +## 2.0.1 (2019-09-01) + +**Note:** Version bump only for package holmes + + + + +## 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/holmes/README.md b/packages/holmes/README.md index 7a1323f72f4..d09f2627d8c 100644 --- a/packages/holmes/README.md +++ b/packages/holmes/README.md @@ -1,31 +1,100 @@ -# holmes +![FreeSewing](https://freesewing.org/banner.jpg) +

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

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

-> Sherlock Holmes hat +## What am I looking at? 🤔 -[![NPM](https://img.shields.io/npm/v/holmes.svg)](https://www.npmjs.com/package/holmes) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) +This repository is our *monorepo* holding [all our NPM packages](https://www.npmjs.com/search?q=keywords:freesewing). +This folder holds **@freesewing/holmes** -## Install +A FreeSewing pattern for a Sherlock Holmes hat + + + +## About FreeSewing 💀 + +Where the world of makers and developers collide, that's where you'll find FreeSewing. + +Our [core library](https://freesewing.dev/) is a *batteries-included* toolbox +for parametric design of sewing patterns. It's a modular system (check our list +of [plugins](https://freesewing.dev/plugins) and getting started is as simple as: ```bash -npm install --save holmes +npm init freesewing-pattern ``` -## Usage +The [getting started](https://freesewing.dev/start) 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/api), +as well as [our turorial](https://freesewing.dev/tutorial), +and [best practices](https://freesewing.dev/do). -```jsx -import React, { Component } from 'react' +If you're a maker, checkout [freesewing.org](https://freesewing/) where you can generate +our sewing patterns adapted to your measurements. -import MyComponent from 'holmes' +## Support FreeSewing: Become a patron 🥰 -class Example extends Component { - render () { - return ( - - ) - } -} -``` +FreeSewing is an open source project run by a community, +and financially supported by our patrons. -## License +If you feel what we do is worthwhile, you too +should [become a patron](https://freesewing.org/patrons/join). - © [AlfaLyr](https://github.com/AlfaLyr) +## 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/holmes/example/.babelrc b/packages/holmes/example/.babelrc new file mode 100644 index 00000000000..6e3090a4956 --- /dev/null +++ b/packages/holmes/example/.babelrc @@ -0,0 +1,10 @@ +{ + "plugins": [ + ["prismjs", { + "languages": ["javascript", "css", "markup"], + "plugins": ["line-numbers"], + "theme": "twilight", + "css": true + }] + ] +} diff --git a/packages/holmes/example/package.json b/packages/holmes/example/package.json index 64bc5b4a24c..9b8b3d938bf 100644 --- a/packages/holmes/example/package.json +++ b/packages/holmes/example/package.json @@ -1,6 +1,6 @@ { "name": "holmes-example", - "homepage": "https://AlfaLyr.github.io/holmes", + "homepage": "https://freesewing.github.io/holmes", "version": "0.0.0", "private": true, "dependencies": { @@ -19,7 +19,7 @@ "@material-ui/core": "^4.4.0", "@material-ui/icons": "^4.2.1", "@material-ui/lab": "^v4.0.0-alpha.25", - "pattern": "file:..", + "pattern": "link:..", "prismjs": "1.17.1", "react": "^16.9", "react-dom": "^16.9", diff --git a/packages/holmes/example/src/App.js b/packages/holmes/example/src/App.js index b336f6f6cd1..3bad5ad72fb 100644 --- a/packages/holmes/example/src/App.js +++ b/packages/holmes/example/src/App.js @@ -9,14 +9,8 @@ import Pattern from 'pattern' const App = props => { let instance = new Pattern() let config = instance.config - return ( - - ) + + return } export default App diff --git a/packages/holmes/package.json b/packages/holmes/package.json index a9e262b574a..03b28682392 100644 --- a/packages/holmes/package.json +++ b/packages/holmes/package.json @@ -1,26 +1,43 @@ { - "name": "holmes", - "version": "0.0.1", - "description": "Sherlock Holmes hat", - "author": "AlfaLyr", + "name": "@freesewing/holmes", + "version": "2.2.0", + "description": "A FreeSewing pattern for a Sherlock Holmes hat", + "author": "AlfaLyr (https://github.com/alfalyr)", + "homepage": "https://freesewing.org/", + "repository": "github:freesewing/freesewing", "license": "MIT", - "repository": "AlfaLyr/holmes", + "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.es.js", - "jsnext:main": "dist/index.es.js", - "engines": { - "node": ">=8", - "npm": ">=5" - }, + "module": "dist/index.mjs", "scripts": { - "test": "cross-env CI=1 react-scripts test --env=jsdom", - "test:watch": "react-scripts test --env=jsdom", - "build": "rollup -c", + "clean": "rimraf dist", + "build": "npm run clean && rollup -c", + "test": "echo \"holmes: 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", - "prepare": "npm run build", - "predeploy": "cd example && npm install && npm run build", - "deploy": "gh-pages -d example/build" + "netlify": "echo \"Not configured yet\"" }, + "peerDependencies": { + "@freesewing/core": "^2.2.0", + "@freesewing/plugin-bundle": "^2.2.0", + "@freesewing/plugin-bust": "^2.2.0" + }, + "dependencies": {}, "devDependencies": { "react": "^16.8", "react-dom": "^16.8", @@ -29,23 +46,18 @@ "eslint": "^5.16.0", "babel-jest": "24.7.1", "jest": "24.7.1", - "@freesewing/core": "latest", - "@freesewing/plugin-bundle": "latest", - "@freesewing/components": "latest", - "@freesewing/css-theme": "latest", - "@freesewing/i18n": "latest", - "@freesewing/mui-theme": "latest", - "@freesewing/patterns": "latest", - "@freesewing/plugin-bust": "latest", - "@freesewing/plugin-buttons": "latest", - "@freesewing/plugin-debug": "latest", - "@freesewing/plugin-designer": "latest", - "@freesewing/plugin-flip": "latest", - "@freesewing/utils": "latest", + "@freesewing/components": "^2.2.0", + "@freesewing/css-theme": "^2.2.0", + "@freesewing/i18n": "^2.2.0", + "@freesewing/mui-theme": "^2.2.0", + "@freesewing/plugin-bust": "^2.2.0", + "@freesewing/plugin-buttons": "^2.2.0", + "@freesewing/plugin-flip": "^2.2.0", + "@freesewing/utils": "^2.2.0", "@svgr/rollup": "^2.4.1", "cross-env": "^5.1.4", "gh-pages": "^1.2.0", - "react-scripts": "^3.0.1", + "react-scripts": "^3.0.0", "webpack": "4.29.6", "rollup": "^0.64.1", "rollup-plugin-babel": "^4.0.1", @@ -56,11 +68,23 @@ "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/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", - "file-saver": "^2.0.2" + "prop-types": "15.7.2" + }, + "files": [ + "dist/*", + "README.md", + "package.json" + ], + "publishConfig": { + "access": "public", + "tag": "next" + }, + "engines": { + "node": ">=8.0.0", + "npm": ">=5" } } diff --git a/packages/holmes/rollup.config.js b/packages/holmes/rollup.config.js index 70c428bd463..142439a7f29 100644 --- a/packages/holmes/rollup.config.js +++ b/packages/holmes/rollup.config.js @@ -1,47 +1,41 @@ -import babel from "rollup-plugin-babel"; -import commonjs from "rollup-plugin-commonjs"; -import external from "rollup-plugin-peer-deps-external"; -import postcss from "rollup-plugin-postcss"; -import json from "rollup-plugin-json"; -import resolve from "rollup-plugin-node-resolve"; -import url from "rollup-plugin-url"; -import svgr from "@svgr/rollup"; -import minify from "rollup-plugin-babel-minify"; -import { name, version, description, author, license } from "./package.json"; +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' -import pkg 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: [ - { - file: pkg.main, - format: "cjs", - sourcemap: true - }, - { - file: pkg.module, - format: "es", - sourcemap: true - } - ], + input: 'src/index.js', + output, plugins: [ - external(), - postcss({ - modules: true - }), - url({ exclude: ["**/*.svg"] }), - svgr(), - babel({ - exclude: "node_modules/**" - }), - resolve({ browser: true }), - json(), + 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/plugin-gore/CHANGELOG.md b/packages/plugin-gore/CHANGELOG.md new file mode 100644 index 00000000000..81ddd7b325c --- /dev/null +++ b/packages/plugin-gore/CHANGELOG.md @@ -0,0 +1,86 @@ +# Change log for: @freesewing/plugin-gore + + +## Unreleased + +**Note:** Version bump only for package plugin-gore + + +## 2.1.9 (2020-01-18) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.8 (2019-12-16) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.7 (2019-12-15) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.6 (2019-11-24) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.5 (2019-11-19) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.4 (2019-11-01) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.3 (2019-10-18) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.2 (2019-10-14) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.1 (2019-10-13) + +**Note:** Version bump only for package plugin-gore + + +## 2.1.0 (2019-10-06) + +**Note:** Version bump only for package plugin-gore + + +## 2.0.4 (2019-09-27) + +**Note:** Version bump only for package plugin-gore + + +## 2.0.3 (2019-09-15) + +**Note:** Version bump only for package plugin-gore + + +## 2.0.2 (2019-09-06) + +**Note:** Version bump only for package plugin-gore + + +## 2.0.1 (2019-09-01) + +**Note:** Version bump only for package plugin-gore + + + + +## 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/plugin-gore/README.md b/packages/plugin-gore/README.md new file mode 100644 index 00000000000..2fa5d0052b9 --- /dev/null +++ b/packages/plugin-gore/README.md @@ -0,0 +1,100 @@ +![FreeSewing](https://freesewing.org/banner.jpg) +

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

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/plugin-gore** + +A FreeSewing plugin to generate gores for a semi-sphere or dome + + + +## About FreeSewing 💀 + +Where the world of makers and developers collide, that's where you'll find FreeSewing. + +Our [core library](https://freesewing.dev/) is a *batteries-included* toolbox +for parametric design of sewing patterns. It's a modular system (check our list +of [plugins](https://freesewing.dev/plugins) and getting started is as simple as: + +```bash +npm init freesewing-pattern +``` + +The [getting started](https://freesewing.dev/start) 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/api), +as well as [our turorial](https://freesewing.dev/tutorial), +and [best practices](https://freesewing.dev/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.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/plugin-gore/package.json b/packages/plugin-gore/package.json new file mode 100644 index 00000000000..20893234ecb --- /dev/null +++ b/packages/plugin-gore/package.json @@ -0,0 +1,52 @@ +{ + "name": "@freesewing/plugin-gore", + "version": "2.2.0", + "description": "A FreeSewing plugin to generate gores for a semi-sphere or dome", + "author": "AlfaLyr (https://github.com/alfalyr)", + "homepage": "https://freesewing.org/", + "repository": "github:freesewing/freesewing", + "license": "MIT", + "bugs": { + "url": "https://github.com/freesewing/freesewing/issues" + }, + "keywords": [ + "freesewing", + "plugin", + "sewing pattern", + "sewing", + "design", + "parametric design", + "made to measure", + "diy", + "fashion" + ], + "main": "dist/index.js", + "module": "dist/index.mjs", + "scripts": { + "clean": "rimraf dist", + "build": "npm run clean && rollup -c", + "test": "echo \"plugin-gore: 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" + }, + "peerDependencies": { + "@freesewing/core": "^2.2.0" + }, + "dependencies": {}, + "devDependencies": {}, + "files": [ + "dist/*", + "README.md", + "package.json" + ], + "publishConfig": { + "access": "public", + "tag": "next" + }, + "engines": { + "node": ">=8.0.0", + "npm": ">=5" + } +} diff --git a/packages/plugin-gore/rollup.config.js b/packages/plugin-gore/rollup.config.js new file mode 100644 index 00000000000..142439a7f29 --- /dev/null +++ b/packages/plugin-gore/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/plugin-gore/src/index.js b/packages/plugin-gore/src/index.js new file mode 100644 index 00000000000..1ccfb7826e5 --- /dev/null +++ b/packages/plugin-gore/src/index.js @@ -0,0 +1,64 @@ +import { name, version } from '../package.json' + +export default { + name: name, + version: version, + hooks: { + preRender: function(svg) { + if (svg.attributes.get('freesewing:plugin-gore') === false) + svg.attributes.set('freesewing:plugin-gore', version) + } + }, + macros: { + gore: function(so) { + let from = so.from + let goreNumber = so.goreNumber //number of gores for the complete sphere + let radius = so.radius //radius of the sphere + let prefix = so.prefix + let extraLength = so.extraLength //the length of the straight section after a complete semisphere + + this.points[prefix + 'p1'] = from.shift(0, (radius * Math.PI) / 2 + extraLength) + this.points[prefix + 'Cp1'] = this.points[prefix + 'p1'].shift( + 180 - 180 / goreNumber, + radius / 2 / Math.cos(Math.PI / goreNumber) + ) + this.points[prefix + 'p3'] = from.shift(90, (radius * Math.PI) / goreNumber) + this.points[prefix + 'p2'] = this.points[prefix + 'p3'].shift(0, extraLength) + this.points[prefix + 'Cp2'] = this.points[prefix + 'p2'].shift( + 0, + (radius * (Math.PI - 2)) / 2 + ) + + if (extraLength < 0) { + //top curve used to calculate the new points if extraLength < 0 + this.paths.auxiliaryPath = new this.Path() + .move(this.points[prefix + 'p1']) + .curve( + this.points[prefix + 'Cp1'], + this.points[prefix + 'Cp2'], + this.points[prefix + 'p2'] + ) + .setRender(false) + + this.points[prefix + 'p2'] = this.paths.auxiliaryPath.intersectsX(0)[0] //the new point p2 is the one in which the auxiliary curve intersects x=0 + this.paths.auxiliaryPath = this.paths.auxiliaryPath.split(this.points[prefix + 'p2'])[0] //the auxiliary curve is split + this.points[prefix + 'Cp1'] = this.paths.auxiliaryPath.ops[1].cp1 //the new control points are those of the new curve + this.points[prefix + 'Cp2'] = this.paths.auxiliaryPath.ops[1].cp2 + this.points[prefix + 'p3'] = this.points[prefix + 'p2'].clone() + } + + //the seam path is generated + this.paths[prefix + 'seam'] = new this.Path() + .move(from) + .line(this.points[prefix + 'p1']) + .curve(this.points[prefix + 'Cp1'], this.points[prefix + 'Cp2'], this.points[prefix + 'p2']) + .line(this.points[prefix + 'p3']) + .line(from) + .close() + .attr('class', so.class ? so.class : '') + + if (typeof so.render !== 'undefined' && so.render) this.paths[prefix + 'seam'].render = true + else this.paths[prefix + 'seam'].render = false + } + } +} diff --git a/packages/plugin-gore/tests/bust.test.js b/packages/plugin-gore/tests/bust.test.js new file mode 100644 index 00000000000..0f8ae606763 --- /dev/null +++ b/packages/plugin-gore/tests/bust.test.js @@ -0,0 +1,15 @@ +import freesewing from 'freesewing' +import { version } from '../package.json' +let chai = require('chai') +let expect = chai.expect +chai.use(require('chai-string')) +let plugin = require('../dist/index.js') + +it('Should set the plugin name:version attribute', () => { + let pattern = new freesewing.Pattern() + pattern + .use(plugin) + .draft() + .render() + expect(pattern.svg.attributes.get('freesewing:plugin-buttons')).to.equal(version) +})