2022-01-16 17:26:52 +01:00
|
|
|
import freesewing from '@freesewing/core'
|
|
|
|
import config from '../config'
|
|
|
|
// Plugins
|
|
|
|
import banner from '@freesewing/plugin-banner'
|
|
|
|
import bartack from '@freesewing/plugin-bartack'
|
2022-01-16 19:01:54 +01:00
|
|
|
import buttons from '@freesewing/plugin-buttons'
|
2022-01-17 18:14:05 +01:00
|
|
|
import cutonfold from '@freesewing/plugin-cutonfold'
|
2022-01-18 08:30:33 +01:00
|
|
|
import dimension from '@freesewing/plugin-dimension'
|
2022-01-18 09:03:16 +01:00
|
|
|
import flip from '@freesewing/plugin-flip'
|
2022-01-18 09:13:18 +01:00
|
|
|
import gore from '@freesewing/plugin-gore'
|
2022-01-18 10:14:50 +01:00
|
|
|
import grainline from '@freesewing/plugin-grainline'
|
2022-01-18 12:16:09 +01:00
|
|
|
// Not importing i18n since it's a run-time plugin loaded by workbench
|
|
|
|
//import i18n from '@freesewing/plugin-i18n'
|
|
|
|
import logo from '@freesewing/plugin-logo'
|
2022-01-18 12:24:07 +01:00
|
|
|
import measurements from '@freesewing/plugin-measurements'
|
2022-01-18 14:12:36 +01:00
|
|
|
import mirror from '@freesewing/plugin-mirror'
|
2022-01-18 14:27:01 +01:00
|
|
|
import notches from '@freesewing/plugin-notches'
|
2022-01-18 14:36:02 +01:00
|
|
|
import round from '@freesewing/plugin-round'
|
2022-01-18 14:40:26 +01:00
|
|
|
import scalebox from '@freesewing/plugin-scalebox'
|
2022-01-18 14:58:10 +01:00
|
|
|
import sprinkle from '@freesewing/plugin-sprinkle'
|
2022-01-18 16:28:44 +01:00
|
|
|
import title from '@freesewing/plugin-title'
|
2022-01-16 17:26:52 +01:00
|
|
|
// Parts
|
|
|
|
import draftBanner from './plugin-banner'
|
|
|
|
import draftBartack from './plugin-bartack'
|
2022-01-16 19:01:54 +01:00
|
|
|
import draftButtons from './plugin-buttons'
|
2022-01-17 18:14:05 +01:00
|
|
|
import draftCutonfold from './plugin-cutonfold'
|
2022-01-18 08:30:33 +01:00
|
|
|
import draftDimension from './plugin-dimension'
|
2022-01-18 09:03:16 +01:00
|
|
|
import draftFlip from './plugin-flip'
|
2022-01-18 09:13:18 +01:00
|
|
|
import draftGore from './plugin-gore'
|
2022-01-18 10:14:50 +01:00
|
|
|
import draftGrainline from './plugin-grainline'
|
2022-01-18 12:07:37 +01:00
|
|
|
import draftI18n from './plugin-i18n'
|
2022-01-18 12:16:09 +01:00
|
|
|
import draftLogo from './plugin-logo'
|
2022-01-18 12:24:07 +01:00
|
|
|
import draftMeasurements from './plugin-measurements'
|
2022-01-18 14:12:36 +01:00
|
|
|
import draftMirror from './plugin-mirror'
|
2022-01-18 14:27:01 +01:00
|
|
|
import draftNotches from './plugin-notches'
|
2022-01-18 14:36:02 +01:00
|
|
|
import draftRound from './plugin-round'
|
2022-01-18 14:40:26 +01:00
|
|
|
import draftScalebox from './plugin-scalebox'
|
2022-01-18 14:58:10 +01:00
|
|
|
import draftSprinkle from './plugin-sprinkle'
|
2022-01-18 16:28:44 +01:00
|
|
|
import draftTitle from './plugin-title'
|
2022-01-16 17:26:52 +01:00
|
|
|
|
|
|
|
const plugins = [
|
|
|
|
banner,
|
|
|
|
bartack,
|
2022-01-16 19:01:54 +01:00
|
|
|
buttons,
|
2022-01-17 18:14:05 +01:00
|
|
|
cutonfold,
|
2022-01-18 08:30:33 +01:00
|
|
|
dimension,
|
2022-01-18 09:03:16 +01:00
|
|
|
flip,
|
2022-01-18 09:13:18 +01:00
|
|
|
gore,
|
2022-01-18 10:14:50 +01:00
|
|
|
grainline,
|
2022-01-18 12:16:09 +01:00
|
|
|
// Not using i18n since it's a run-time plugin loaded by workbench
|
|
|
|
// i18n,
|
|
|
|
logo,
|
2022-01-18 12:24:07 +01:00
|
|
|
measurements,
|
2022-01-18 14:12:36 +01:00
|
|
|
mirror,
|
2022-01-18 14:27:01 +01:00
|
|
|
notches,
|
2022-01-18 14:36:02 +01:00
|
|
|
round,
|
2022-01-18 14:40:26 +01:00
|
|
|
scalebox,
|
2022-01-18 14:58:10 +01:00
|
|
|
sprinkle,
|
2022-01-18 16:28:44 +01:00
|
|
|
title,
|
2022-01-16 17:26:52 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
const methods = {
|
|
|
|
draftBanner,
|
|
|
|
draftBartack,
|
2022-01-16 19:01:54 +01:00
|
|
|
draftButtons,
|
2022-01-17 18:14:05 +01:00
|
|
|
draftCutonfold,
|
2022-01-18 08:30:33 +01:00
|
|
|
draftDimension,
|
2022-01-18 09:03:16 +01:00
|
|
|
draftFlip,
|
2022-01-18 09:13:18 +01:00
|
|
|
draftGore,
|
2022-01-18 10:14:50 +01:00
|
|
|
draftGrainline,
|
2022-01-18 12:07:37 +01:00
|
|
|
draftI18n,
|
2022-01-18 12:16:09 +01:00
|
|
|
draftLogo,
|
2022-01-18 12:24:07 +01:00
|
|
|
draftMeasurements,
|
2022-01-18 14:12:36 +01:00
|
|
|
draftMirror,
|
2022-01-18 14:27:01 +01:00
|
|
|
draftNotches,
|
2022-01-18 14:36:02 +01:00
|
|
|
draftRound,
|
2022-01-18 14:40:26 +01:00
|
|
|
draftScalebox,
|
2022-01-18 14:58:10 +01:00
|
|
|
draftSprinkle,
|
2022-01-18 16:28:44 +01:00
|
|
|
draftTitle,
|
2022-01-16 17:26:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Create design
|
|
|
|
const Pattern = new freesewing.Design(config, plugins)
|
|
|
|
|
|
|
|
// Attach draft methods to prototype
|
|
|
|
for (const [name, method] of Object.entries(methods)) {
|
2022-01-19 16:23:25 +01:00
|
|
|
Pattern.prototype[name] = (part) => method(part)
|
2022-01-16 17:26:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Pattern
|