fire: Switched to plugin-bundle
This commit is contained in:
parent
9907fb371c
commit
79f27d2efa
18 changed files with 1123 additions and 238 deletions
1
packages/brian/bundle.js
Symbolic link
1
packages/brian/bundle.js
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../plugins/plugin-bundle/dist/browser.js
|
|
@ -7,93 +7,24 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="svg"></div>
|
<div id="svg"></div>
|
||||||
<script type="text/javascript" src="freesewing.js"></script>
|
<script type="text/javascript" src="freesewing.js"></script>
|
||||||
<script type="text/javascript" src="tmp/cutonfold.js"></script>
|
<script type="text/javascript" src="bundle.js"></script>
|
||||||
<script type="text/javascript" src="tmp/grainline.js"></script>
|
|
||||||
<script type="text/javascript" src="tmp/dimension.js"></script>
|
|
||||||
<script type="text/javascript" src="tmp/logo.js"></script>
|
|
||||||
<script type="text/javascript" src="tmp/title.js"></script>
|
|
||||||
<script type="text/javascript" src="dist/browser.js"></script>
|
<script type="text/javascript" src="dist/browser.js"></script>
|
||||||
<script type="text/javascript" src="tmp/theme.js"></script>
|
<script type="text/javascript" src="tmp/theme.js"></script>
|
||||||
<script type="text/javascript" src="tmp/designer.js"></script>
|
<script type="text/javascript" src="tmp/designer.js"></script>
|
||||||
|
<script type="text/javascript" src="tmp/debug.js"></script>
|
||||||
<script type="text/javascript" src="tmp/models.js"></script>
|
<script type="text/javascript" src="tmp/models.js"></script>
|
||||||
|
<script type="text/javascript" src="tmp/validate.js"></script>
|
||||||
<script type="text/javascript" src="tmp/antmantest.js"></script>
|
<script type="text/javascript" src="tmp/antmantest.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var debug = {
|
|
||||||
name: 'debug',
|
|
||||||
hooks: {
|
|
||||||
debug: function (next, d='',e='',b='',u='',g='') {
|
|
||||||
console.log('%cDebug', 'color: #dd69dd; font-weight: bold', d,e,b,u,g);
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var pattern = freesewing.patterns.brian
|
var pattern = freesewing.patterns.brian
|
||||||
.with(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)
|
||||||
pattern.on('preSample', function(next) {
|
;
|
||||||
console.log('preSample hook');
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern.on('postSample', function(next) {
|
pattern.settings.paperless = true;
|
||||||
console.log('postSample hook');
|
pattern.settings.measurements = freesewing.models.men.manSize36;
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern.on('preDraft', function(next) {
|
|
||||||
console.log('preDraft hook', JSON.parse(JSON.stringify(this)));
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern.on('postDraft', function(next) {
|
|
||||||
console.log('postDraft hook', JSON.parse(JSON.stringify(this)));
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern.on('preRender', function(next) {
|
|
||||||
console.log('preRender hook', this);
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern.on('postRender', function(next) {
|
|
||||||
console.log('postRender hook', this);
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern.on('preDraft', function(next) {
|
|
||||||
console.log('%cpreDraft hook', 'color: red', this);
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern.on('postDraft', function(next) {
|
|
||||||
console.log('%cpostDraft hook', 'color: red', this);
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern.on('insertText', function(next) {
|
|
||||||
console.log('%cinsertText hook', 'color: red', this.text);
|
|
||||||
this.text = this.text.toUpperCase();
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
pattern.on('preDraft', function(next) {
|
|
||||||
console.log('%cpreDraft hook', 'color: red', this);
|
|
||||||
for(let m in this.config.measurements) {
|
|
||||||
let measurement = this.config.measurements[m];
|
|
||||||
if(!this.context.settings.measurements[measurement]) {
|
|
||||||
this.debug('Missing measurement:', measurement);
|
|
||||||
this.debug('All measurements:', this.settings.measurements);
|
|
||||||
throw `Missing measurement: ${measurement}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
//pattern.settings.paperless = true;
|
|
||||||
|
|
||||||
pattern.settings.measurements = freesewing.models.men.manSize36;
|
|
||||||
|
|
||||||
pattern.settings.sa = 10;
|
pattern.settings.sa = 10;
|
||||||
pattern.settings.units = 'metric';
|
pattern.settings.units = 'metric';
|
||||||
|
|
1174
packages/brian/package-lock.json
generated
1174
packages/brian/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -46,11 +46,8 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@freesewing/plugin-cutonfold": "0.7.2",
|
"freesewing": "^0.6.0",
|
||||||
"@freesewing/plugin-grainline": "0.0.1",
|
"@freesewing/plugin-bundle": "0.0.1"
|
||||||
"@freesewing/plugin-logo": "^0.2.1",
|
|
||||||
"@freesewing/plugin-title": "0.5.1",
|
|
||||||
"freesewing": "^0.6.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.0.0-beta.56",
|
"@babel/core": "7.0.0-beta.56",
|
||||||
|
|
|
@ -23,22 +23,11 @@ export default {
|
||||||
// }
|
// }
|
||||||
//})
|
//})
|
||||||
],
|
],
|
||||||
external: [
|
external: ["freesewing", "@freesewing/plugin-bundle"],
|
||||||
"freesewing",
|
|
||||||
"@freesewing/plugin-grainline",
|
|
||||||
"@freesewing/plugin-cutonfold",
|
|
||||||
"@freesewing/plugin-dimension",
|
|
||||||
"@freesewing/plugin-logo",
|
|
||||||
"@freesewing/plugin-title"
|
|
||||||
],
|
|
||||||
output: {
|
output: {
|
||||||
globals: {
|
globals: {
|
||||||
freesewing: "freesewing",
|
freesewing: "freesewing",
|
||||||
"@freesewing/plugin-cutonfold": "freesewing.plugins.cutonfold",
|
"@freesewing/plugin-bundle": "freesewing.plugins.bundle"
|
||||||
"@freesewing/plugin-grainline": "freesewing.plugins.grainline",
|
|
||||||
"@freesewing/plugin-dimension": "freesewing.plugins.dimension",
|
|
||||||
"@freesewing/plugin-logo": "freesewing.plugins.logo",
|
|
||||||
"@freesewing/plugin-title": "freesewing.plugins.title"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,9 +2,7 @@ import freesewing from "freesewing";
|
||||||
import * as shared from "./shared";
|
import * as shared from "./shared";
|
||||||
|
|
||||||
var back = {
|
var back = {
|
||||||
draft: function(pattern) {
|
draft: function(part) {
|
||||||
let part = new pattern.Part().copy(pattern.parts.base);
|
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {store, sa, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
|
let {store, sa, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import freesewing from "freesewing";
|
import freesewing from "freesewing";
|
||||||
|
|
||||||
var base = {
|
var base = {
|
||||||
draft: function(pattern) {
|
draft: function(part) {
|
||||||
let part = new pattern.Part();
|
|
||||||
part.render = false;
|
part.render = false;
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
|
|
|
@ -3,9 +3,7 @@ import base from "./base";
|
||||||
import * as shared from "./shared";
|
import * as shared from "./shared";
|
||||||
|
|
||||||
var front = {
|
var front = {
|
||||||
draft: function(pattern) {
|
draft: function(part) {
|
||||||
let part = new pattern.Part().copy(pattern.parts.back);
|
|
||||||
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, final, paperless, macro} = part.shorthand();
|
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, measurements, final, paperless, macro} = part.shorthand();
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
import freesewing from "freesewing";
|
import freesewing from "freesewing";
|
||||||
import pluginCutonfold from "@freesewing/plugin-cutonfold";
|
import pluginBundle from "@freesewing/plugin-bundle";
|
||||||
import pluginGrainline from "@freesewing/plugin-grainline";
|
|
||||||
import pluginDimension from "@freesewing/plugin-dimension";
|
|
||||||
import pluginLogo from "@freesewing/plugin-logo";
|
|
||||||
import pluginTitle from "@freesewing/plugin-title";
|
|
||||||
|
|
||||||
import config from "../config/config";
|
import config from "../config/config";
|
||||||
import { version } from "../package.json";
|
import { version } from "../package.json";
|
||||||
|
@ -13,39 +9,22 @@ import back from "./back";
|
||||||
import front from "./front";
|
import front from "./front";
|
||||||
import sleeve from "./sleeve";
|
import sleeve from "./sleeve";
|
||||||
|
|
||||||
var pattern = new freesewing.Pattern({ version: version, ...config })
|
var pattern = new freesewing.Pattern({ version: version, ...config }).with(
|
||||||
.with(pluginCutonfold)
|
pluginBundle
|
||||||
.with(pluginGrainline)
|
);
|
||||||
.with(pluginDimension)
|
|
||||||
.with(pluginLogo)
|
|
||||||
.with(pluginTitle);
|
|
||||||
|
|
||||||
pattern.draft = function() {
|
pattern.draft = function() {
|
||||||
pattern.parts.base = this.draftBase();
|
this.parts.base = this.draftBase(new pattern.Part());
|
||||||
pattern.parts.back = this.draftBack();
|
this.parts.back = this.draftBack(new pattern.Part().copy(this.parts.base));
|
||||||
pattern.parts.front = this.draftFront();
|
this.parts.front = this.draftFront(new pattern.Part().copy(this.parts.back));
|
||||||
pattern.parts.sleeve = this.draftSleeve();
|
this.parts.sleeve = this.draftSleeve(new pattern.Part());
|
||||||
|
|
||||||
return pattern;
|
return pattern;
|
||||||
};
|
};
|
||||||
|
|
||||||
pattern.draftBase = function(pattern = false) {
|
pattern.draftBase = part => base.draft(part);
|
||||||
if (pattern === false) pattern = this;
|
pattern.draftBack = part => back.draft(part);
|
||||||
return base.draft(pattern);
|
pattern.draftFront = part => front.draft(part);
|
||||||
};
|
pattern.draftSleeve = part => sleeve.draft(part);
|
||||||
|
|
||||||
pattern.draftBack = function(pattern = false) {
|
|
||||||
if (pattern === false) pattern = this;
|
|
||||||
return back.draft(pattern);
|
|
||||||
};
|
|
||||||
|
|
||||||
pattern.draftFront = function(pattern = false) {
|
|
||||||
if (pattern === false) pattern = this;
|
|
||||||
return front.draft(pattern);
|
|
||||||
};
|
|
||||||
|
|
||||||
pattern.draftSleeve = function(pattern = false) {
|
|
||||||
if (pattern === false) pattern = this;
|
|
||||||
return sleeve.draft(pattern);
|
|
||||||
};
|
|
||||||
export default pattern;
|
export default pattern;
|
||||||
|
|
|
@ -41,22 +41,23 @@ export function shoulderToArmholePitch(points, Path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dimensions(macro, points, Path, sa) {
|
export function dimensions(macro, points, Path, sa) {
|
||||||
|
console.log("points for dimensions", points);
|
||||||
macro("pd", {
|
macro("pd", {
|
||||||
path: new Path()
|
path: new Path()
|
||||||
.move(points.armhole)
|
.move(points.armhole)
|
||||||
.curve(points.armholeCp1, points.armholeCp1, points.armholeHollow)
|
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||||
.curve(
|
.curve(
|
||||||
points.armholeHollowCp1,
|
points.armholeHollowCp2,
|
||||||
points.armholeHollowCp1,
|
points.armholePitchCp1,
|
||||||
points.armholePitch
|
points.armholePitch
|
||||||
)
|
)
|
||||||
.curve(points.shoulderCp1, points.shoulderCp1, points.shoulder),
|
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
|
||||||
d: sa + 15
|
d: sa + 15
|
||||||
});
|
});
|
||||||
macro("pd", {
|
macro("pd", {
|
||||||
path: new Path()
|
path: new Path()
|
||||||
.move(points.armholePitch)
|
.move(points.armholePitch)
|
||||||
.curve(points.shoulderCp1, points.shoulderCp1, points.shoulder),
|
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
|
||||||
d: -15
|
d: -15
|
||||||
});
|
});
|
||||||
macro("vd", {
|
macro("vd", {
|
||||||
|
|
|
@ -145,8 +145,7 @@ function draftSleevecap(part, run) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var sleeve = {
|
var sleeve = {
|
||||||
draft: function(pattern) {
|
draft: function(part) {
|
||||||
let part = new pattern.Part();
|
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
let {debug, store, units, sa, measurements, options, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
|
let {debug, store, units, sa, measurements, options, Point, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
../../plugins/plugin-cutonfold/dist/browser.js
|
|
1
packages/brian/tmp/debug.js
Symbolic link
1
packages/brian/tmp/debug.js
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../plugins/plugin-debug/dist/browser.js
|
|
@ -1 +0,0 @@
|
||||||
../../plugins/plugin-dimension/dist/browser.js
|
|
|
@ -1 +0,0 @@
|
||||||
../../plugins/plugin-grainline/dist/browser.js
|
|
|
@ -1 +0,0 @@
|
||||||
../../plugins/plugin-logo/dist/browser.js
|
|
|
@ -1 +0,0 @@
|
||||||
../../plugins/plugin-title/dist/browser.js
|
|
1
packages/brian/tmp/validate.js
Symbolic link
1
packages/brian/tmp/validate.js
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../plugins/plugin-validate/dist/browser.js
|
Loading…
Add table
Add a link
Reference in a new issue