1
0
Fork 0

sparkles: Updates for freesewing v0.23

This commit is contained in:
Joost De Cock 2018-12-20 08:32:21 +01:00
parent 8147e10a08
commit aa16927fa5
14 changed files with 1785 additions and 2772 deletions

View file

@ -7,6 +7,25 @@ export default {
"naturalWaistToUnderbust", "naturalWaistToUnderbust",
"naturalWaistToHip" "naturalWaistToHip"
], ],
dependencies: {
panel1: "panels",
panel2: "panels",
panel3: "panels",
panel4: "panels",
panel5: "panels",
panel6: "panels",
panels: "base"
},
inject: {
panel1: "panels",
panel2: "panels",
panel3: "panels",
panel4: "panels",
panel5: "panels",
panel6: "panels",
panels: "base"
},
hide: [ "panels", "base" ],
options: { options: {
// Lists // Lists
panels: { panels: {

View file

@ -13,14 +13,16 @@
<script type="text/javascript" src="node_modules/@freesewing/plugin-designer/dist/browser.js"></script> <script type="text/javascript" src="node_modules/@freesewing/plugin-designer/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-debug/dist/browser.js"></script> <script type="text/javascript" src="node_modules/@freesewing/plugin-debug/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-validate/dist/browser.js"></script> <script type="text/javascript" src="node_modules/@freesewing/plugin-validate/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/plugin-i18n/dist/browser.js"></script> <!-- <script type="text/javascript" src="node_modules/@freesewing/plugin-i18n/dist/browser.js"></script> -->
<script type="text/javascript" src="../../plugins/plugin-i18n/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/models/dist/browser.js"></script> <script type="text/javascript" src="node_modules/@freesewing/models/dist/browser.js"></script>
<script type="text/javascript" src="node_modules/@freesewing/antman/dist/browser.js"></script> <script type="text/javascript" src="node_modules/@freesewing/antman/dist/browser.js"></script>
<script> <script>
var pattern = freesewing.patterns.cathrin var pattern = new freesewing.patterns.cathrin;
pattern
.with(freesewing.plugins.debug) .with(freesewing.plugins.debug)
.with(freesewing.plugins.theme) .with(freesewing.plugins.theme)
// .with(freesewing.plugins.designer) .with(freesewing.plugins.designer)
.with(freesewing.plugins.validate) .with(freesewing.plugins.validate)
.with(freesewing.plugins.i18n) .with(freesewing.plugins.i18n)
; ;
@ -42,7 +44,7 @@
models: freesewing.models.men models: freesewing.models.men
} }
pattern.options.panels = 13; pattern.settings.options.panels = 13;
//pattern.settings.only = ['panels']; //pattern.settings.only = ['panels'];
//pattern.sampleOption('panels'); //pattern.sampleOption('panels');
//pattern.sampleMeasurement('shoulderSlope'); //pattern.sampleMeasurement('shoulderSlope');

File diff suppressed because it is too large Load diff

View file

@ -47,8 +47,8 @@
] ]
}, },
"dependencies": { "dependencies": {
"freesewing": "^0.17", "freesewing": "^0.23.2",
"@freesewing/plugin-bundle": "^0.3" "@freesewing/plugin-bundle": "^0.5.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.0.0-beta.56", "@babel/core": "7.0.0-beta.56",
@ -60,11 +60,11 @@
"babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-object-rest-spread": "^6.26.0",
"@freesewing/antman": "^0.3", "@freesewing/antman": "^0.3",
"@freesewing/models": "^0.6", "@freesewing/models": "^0.6",
"@freesewing/plugin-debug": "^0.1", "@freesewing/plugin-debug": "^0.5.2",
"@freesewing/plugin-designer": "^0.7.2", "@freesewing/plugin-designer": "^0.10",
"@freesewing/plugin-i18n": "^0.0.2", "@freesewing/plugin-i18n": "^0.1.2",
"@freesewing/plugin-theme": "^0.13.2", "@freesewing/plugin-theme": "^0.18.3",
"@freesewing/plugin-validate": "^0.2", "@freesewing/plugin-validate": "^0.4.1",
"eslint": "5.3.0", "eslint": "5.3.0",
"eslint-config-prettier": "^2.9.0", "eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.2", "eslint-plugin-prettier": "^2.6.2",

View file

@ -1,6 +1,4 @@
var base = { export default function(part) {
draft: function(part) {
// prettier-ignore // prettier-ignore
let {measurements, options, store, points, snippets, paths, Point, Snippet, Path, utils, complete, debug } = part.shorthand(); let {measurements, options, store, points, snippets, paths, Point, Snippet, Path, utils, complete, debug } = part.shorthand();
@ -10,9 +8,17 @@ var base = {
// Absolute values for some options // Absolute values for some options
store.set('waistReduction', measurements.naturalWaist * options.waistReduction); store.set('waistReduction', measurements.naturalWaist * options.waistReduction);
debug('Waist reduction is', utils.units(store.get('waistReduction'))); debug({
type: "info",
label: '✅ Waist reduction',
msg: utils.units(store.get('waistReduction'))
});
store.set('backOpening', measurements.underbust * options.backOpening); store.set('backOpening', measurements.underbust * options.backOpening);
debug('Back opening is', utils.units(store.get('backOpening'))); debug({
type: "info",
label: '✅ Back opening',
msg: utils.units(store.get('backOpening'))
});
let len = measurements.naturalWaistToUnderbust + measurements.naturalWaistToHip; let len = measurements.naturalWaistToUnderbust + measurements.naturalWaistToHip;
for(let option of ['backRise', 'backDrop', 'frontRise', 'frontDrop', 'hipRise']) for(let option of ['backRise', 'backDrop', 'frontRise', 'frontDrop', 'hipRise'])
store.set(option, len * options[option]); store.set(option, len * options[option]);
@ -101,7 +107,4 @@ var base = {
.close(); .close();
return part; return part;
}
}; };
export default base;

View file

@ -1,57 +1,38 @@
import freesewing from "freesewing"; import freesewing from "freesewing";
import pluginBundle from "@freesewing/plugin-bundle"; import pluginBundle from "@freesewing/plugin-bundle";
import config from "../config/config"; import config from "../config/config";
import { version } from "../package.json"; import { version } from "../package.json";
//Parts
import draftBase from "./base";
import draftPanels from "./panels";
import draftPanel1 from "./panel1";
import draftPanel2 from "./panel2";
import draftPanel3 from "./panel3";
import draftPanel4 from "./panel4";
import draftPanel5 from "./panel5";
import draftPanel6 from "./panel6";
import base from "./base"; // Constructor boilerplate
import panels from "./panels"; const Cathrin = function(settings = false) {
freesewing.Pattern.call(this, { version: version, ...config });
this.with(pluginBundle);
if (settings !== false) this.mergeSettings(settings);
import panel1 from "./panel1"; return this;
import panel2 from "./panel2";
import panel3 from "./panel3";
import panel4 from "./panel4";
import panel5 from "./panel5";
import panel6 from "./panel6";
var pattern = new freesewing.Pattern({ version: version, ...config })
.with(pluginBundle);
pattern.draft = function() {
this.parts.base = this.draftBase(new pattern.Part());
if (!this.needs("base", true)) this.parts.base.render = false;
if(this.needs("panels")) this.parts.panels = this.draftPanels(new pattern.Part().copy(this.parts.base));
if (!this.needs("panels", true)) this.parts.panels.render = false;
if (this.needs("panel1"))
this.parts.panel1 = this.draftPanel1(new pattern.Part().copy(this.parts.panels));
if (this.needs("panel2"))
this.parts.panel2 = this.draftPanel2(new pattern.Part().copy(this.parts.panels));
if (this.needs("panel3"))
this.parts.panel3 = this.draftPanel3(new pattern.Part().copy(this.parts.panels));
if (this.needs("panel4"))
this.parts.panel4 = this.draftPanel4(new pattern.Part().copy(this.parts.panels));
if (this.needs("panel5"))
this.parts.panel5 = this.draftPanel5(new pattern.Part().copy(this.parts.panels));
if (this.needs("panel6"))
this.parts.panel6 = this.draftPanel6(new pattern.Part().copy(this.parts.panels));
return pattern;
}; };
pattern.draftBase = part => base.draft(part); // Inheritance boilerplate
pattern.draftPanels = part => panels.draft(part); Cathrin.prototype = Object.create(freesewing.Pattern.prototype);
pattern.draftPanel1 = part => panel1.draft(part); Cathrin.prototype.constructor = Cathrin;
pattern.draftPanel2 = part => panel2.draft(part);
pattern.draftPanel3 = part => panel3.draft(part);
pattern.draftPanel4 = part => panel4.draft(part);
pattern.draftPanel5 = part => panel5.draft(part);
pattern.draftPanel6 = part => panel6.draft(part);
export default pattern; // Attach per-part draft methods to prototype
Cathrin.prototype.draftBase = draftBase;
Cathrin.prototype.draftPanels = draftPanels;
Cathrin.prototype.draftPanel1 = draftPanel1;
Cathrin.prototype.draftPanel2 = draftPanel2;
Cathrin.prototype.draftPanel3 = draftPanel3;
Cathrin.prototype.draftPanel4 = draftPanel4;
Cathrin.prototype.draftPanel5 = draftPanel5;
Cathrin.prototype.draftPanel6 = draftPanel6;
export default Cathrin;

View file

@ -1,8 +1,6 @@
import panel1ab from './panel1ab'; import draftPanel1ab from './panel1ab';
var panel1 = {
draft: function(part) {
export default function(part) {
// prettier-ignore // prettier-ignore
let {macro, sa, points, paths, Point, Path, options, complete, paperless } = part.shorthand(); let {macro, sa, points, paths, Point, Path, options, complete, paperless } = part.shorthand();
@ -13,7 +11,7 @@ var panel1 = {
delete paths.panel5; delete paths.panel5;
delete paths.panel6; delete paths.panel6;
if (options.panels === 13) return panel1ab.draft(part); if (options.panels === 13) return draftPanel1ab(part);
// Complete pattern? // Complete pattern?
if(complete) { if(complete) {
@ -70,7 +68,4 @@ var panel1 = {
} }
return part; return part;
}
}; };
export default panel1;

View file

@ -1,6 +1,4 @@
var panel1ab = { export default function(part) {
draft: function(part) {
// prettier-ignore // prettier-ignore
let {macro, utils, sa, points, paths, Point, Path, options, complete, paperless } = part.shorthand(); let {macro, utils, sa, points, paths, Point, Path, options, complete, paperless } = part.shorthand();
@ -145,7 +143,4 @@ var panel1ab = {
} }
return part; return part;
}
}; };
export default panel1ab;

View file

@ -1,6 +1,4 @@
var panel2 = { export default function(part) {
draft: function(part) {
// prettier-ignore // prettier-ignore
let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand(); let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand();
@ -73,7 +71,4 @@ var panel2 = {
} }
return part; return part;
}
}; };
export default panel2;

View file

@ -1,6 +1,4 @@
var panel3 = { export default function(part) {
draft: function(part) {
// prettier-ignore // prettier-ignore
let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand(); let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand();
@ -73,7 +71,4 @@ var panel3 = {
} }
return part; return part;
}
}; };
export default panel3;

View file

@ -1,6 +1,4 @@
var panel4 = { export default function(part) {
draft: function(part) {
// prettier-ignore // prettier-ignore
let {macro, sa, snippets, Snippet, points, paths, Point, complete, paperless } = part.shorthand(); let {macro, sa, snippets, Snippet, points, paths, Point, complete, paperless } = part.shorthand();
@ -76,7 +74,4 @@ var panel4 = {
} }
return part; return part;
}
}; };
export default panel4;

View file

@ -1,6 +1,4 @@
var panel5 = { export default function(part) {
draft: function(part) {
// prettier-ignore // prettier-ignore
let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand(); let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand();
@ -73,7 +71,4 @@ var panel5 = {
} }
return part; return part;
}
}; };
export default panel5;

View file

@ -1,6 +1,4 @@
var panel6 = { export default function(part) {
draft: function(part) {
// prettier-ignore // prettier-ignore
let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand(); let {macro, sa, points, paths, Point, complete, paperless } = part.shorthand();
@ -81,7 +79,4 @@ var panel6 = {
} }
return part; return part;
}
}; };
export default panel6;

View file

@ -1,6 +1,4 @@
var panels = { export default function(part) {
draft: function(part) {
// prettier-ignore // prettier-ignore
let {measurements, options, store, points, snippets, paths, Point, Snippet, Path, utils, complete, debug } = part.shorthand(); let {measurements, options, store, points, snippets, paths, Point, Snippet, Path, utils, complete, debug } = part.shorthand();
let count = 1; let count = 1;
@ -110,7 +108,4 @@ var panels = {
paths.outline.render = false; paths.outline.render = false;
return part; return part;
}
}; };
export default panels;