chore: Linter fixes
This commit is contained in:
parent
b1429a3704
commit
ef5e792d6b
40 changed files with 93 additions and 99 deletions
|
@ -34,7 +34,7 @@ function sleevecapAdjust(store, twoBacks = false, options = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function draftSleevecap(params, run) {
|
function draftSleevecap(params, run) {
|
||||||
let { store, measurements, options, Point, points, Path, paths, part } = params
|
const { store, measurements, options, Point, points, Path, paths, part } = params
|
||||||
// Sleeve center axis
|
// Sleeve center axis
|
||||||
points.centerBiceps = new Point(0, 0)
|
points.centerBiceps = new Point(0, 0)
|
||||||
points.centerCap = points.centerBiceps.shift(
|
points.centerCap = points.centerBiceps.shift(
|
||||||
|
@ -151,6 +151,8 @@ function draftSleevecap(params, run) {
|
||||||
// Uncomment this line to see all sleevecap iterations
|
// Uncomment this line to see all sleevecap iterations
|
||||||
//paths[run] = paths.sleevecap;
|
//paths[run] = paths.sleevecap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
function redrawSleevecapFront(params, delta) {
|
function redrawSleevecapFront(params, delta) {
|
||||||
|
|
|
@ -236,6 +236,13 @@ const Examples = new Design({
|
||||||
stacks_leftEye,
|
stacks_leftEye,
|
||||||
stacks_rightEye,
|
stacks_rightEye,
|
||||||
stacks_mouth,
|
stacks_mouth,
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
settings_sa,
|
||||||
|
|
||||||
|
// Docs
|
||||||
|
docs_coords,
|
||||||
|
docs_overview,
|
||||||
],
|
],
|
||||||
plugins: [pluginBundle, gorePlugin],
|
plugins: [pluginBundle, gorePlugin],
|
||||||
})
|
})
|
||||||
|
@ -349,5 +356,9 @@ export {
|
||||||
stacks_rightEye,
|
stacks_rightEye,
|
||||||
stacks_mouth,
|
stacks_mouth,
|
||||||
|
|
||||||
|
// Docs
|
||||||
|
docs_coords,
|
||||||
|
docs_overview,
|
||||||
|
|
||||||
Examples,
|
Examples,
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,11 @@ function hugoFront({
|
||||||
macro,
|
macro,
|
||||||
part,
|
part,
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
// Remove clutter
|
// Remove clutter
|
||||||
const seam = paths.seam
|
for (const key in paths) {
|
||||||
paths = {}
|
if (key !== 'seam') delete paths[key]
|
||||||
paths.seam = seam
|
}
|
||||||
|
|
||||||
// Remove notch inherited from Brian
|
// Remove notch inherited from Brian
|
||||||
delete snippets.armholePitchNotch
|
delete snippets.armholePitchNotch
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import { front } from './front.mjs'
|
import { front } from './front.mjs'
|
||||||
|
|
||||||
function hugoPocket({ utils, store, sa, points, Path, paths, complete, paperless, macro, part }) {
|
function hugoPocket({ utils, store, sa, points, Path, paths, complete, paperless, macro, snippets, part }) {
|
||||||
return part
|
|
||||||
// Remove clutter
|
|
||||||
const pocket = part.paths.pocket
|
|
||||||
part.paths = {}
|
|
||||||
part.snippets = {}
|
|
||||||
|
|
||||||
paths.seam = pocket
|
// Remove clutter
|
||||||
|
for (const key in paths) {
|
||||||
|
if (key !== 'pocket') delete paths[key]
|
||||||
|
}
|
||||||
|
for (const key in snippets) delete snippets[key]
|
||||||
|
|
||||||
|
paths.seam = paths.pocket
|
||||||
.line(points.cfRibbing)
|
.line(points.cfRibbing)
|
||||||
.line(points.pocketHem)
|
.line(points.pocketHem)
|
||||||
.close()
|
.close()
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import { pocket } from './pocket.mjs'
|
import { pocket } from './pocket.mjs'
|
||||||
|
|
||||||
function hugoPocketFacing({ sa, points, Path, paths, complete, paperless, macro, store, part }) {
|
function hugoPocketFacing({ sa, points, Path, paths, complete, paperless, macro, store, part }) {
|
||||||
return part
|
|
||||||
// Remove clutter
|
|
||||||
const facing = part.paths.facing
|
|
||||||
part.paths = {}
|
|
||||||
|
|
||||||
paths.seam = facing
|
// Remove clutter
|
||||||
|
for (const key in paths) {
|
||||||
|
if (key !== 'facing') delete paths[key]
|
||||||
|
}
|
||||||
|
|
||||||
|
paths.seam = paths.facing
|
||||||
|
.clone()
|
||||||
.line(points.pocketTop)
|
.line(points.pocketTop)
|
||||||
.curve(points.pocketTopCp, points.pocketTip, points.pocketTip)
|
.curve(points.pocketTopCp, points.pocketTip, points.pocketTip)
|
||||||
.line(points.facingEnd)
|
.line(points.facingEnd)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { testPatternDrafting } from '../../../tests/designs/drafting.mjs'
|
||||||
testPatternConfig(Hugo)
|
testPatternConfig(Hugo)
|
||||||
|
|
||||||
// Test drafting - Change the second parameter to `true` to log errors
|
// Test drafting - Change the second parameter to `true` to log errors
|
||||||
testPatternDrafting(Hugo, false)
|
testPatternDrafting(Hugo, true)
|
||||||
|
|
||||||
// Test sampling - Change the second parameter to `true` to log errors
|
// Test sampling - Change the second parameter to `true` to log errors
|
||||||
//testPatternSampling(Hugo, false)
|
//testPatternSampling(Hugo, false)
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
import { box } from './shared.mjs'
|
import { box } from './shared.mjs'
|
||||||
import { pluginBundle } from '@freesewing/plugin-bundle'
|
import { pluginBundle } from '@freesewing/plugin-bundle'
|
||||||
|
|
||||||
const bartackOptions = (options) => ({
|
|
||||||
angle: options.bartackAngle,
|
|
||||||
length: options.bartackLength,
|
|
||||||
density: options.bartackDensity,
|
|
||||||
width: options.bartackWidth,
|
|
||||||
start: options.bartackStart,
|
|
||||||
end: options.bartackEnd,
|
|
||||||
})
|
|
||||||
|
|
||||||
function legendBartack({ points, Point, paths, Path, macro, options, part }) {
|
function legendBartack({ points, Point, paths, Path, macro, options, part }) {
|
||||||
points.bartack = new Point(40, 20).attr('data-text', 'bartack').attr('data-text-dy', -2)
|
points.bartack = new Point(40, 20).attr('data-text', 'bartack').attr('data-text-dy', -2)
|
||||||
macro('bartack', {
|
macro('bartack', {
|
||||||
|
|
|
@ -92,6 +92,7 @@ export const waistband = {
|
||||||
name: 'penelope.waistband',
|
name: 'penelope.waistband',
|
||||||
measurements: ['waist', 'waistToKnee'],
|
measurements: ['waist', 'waistToKnee'],
|
||||||
options: {
|
options: {
|
||||||
|
waistEase,
|
||||||
waistBandOverlap: 25,
|
waistBandOverlap: 25,
|
||||||
waistBand: { bool: true, menu: 'style' },
|
waistBand: { bool: true, menu: 'style' },
|
||||||
waistBandWidth: { pct: 10, min: 5, max: 20, menu: 'style' },
|
waistBandWidth: { pct: 10, min: 5, max: 20, menu: 'style' },
|
||||||
|
|
|
@ -51,7 +51,7 @@ export const demo = {
|
||||||
if (options.only === 'false' || options.only === 'widths') addWidths(params, true)
|
if (options.only === 'false' || options.only === 'widths') addWidths(params, true)
|
||||||
if (options.only === 'false' || options.only === 'styles') addStyles(params, true)
|
if (options.only === 'false' || options.only === 'styles') addStyles(params, true)
|
||||||
if (options.only === 'false' || options.only === 'combos') addCombos(params, true)
|
if (options.only === 'false' || options.only === 'combos') addCombos(params, true)
|
||||||
if (options.only === 'false' || options.only === 'circles') addCircles(params, true)
|
if (options.only === 'false' || options.only === 'circles') addCircles(params)
|
||||||
if (options.only === 'false' || options.only === 'text') addText(params, true)
|
if (options.only === 'false' || options.only === 'text') addText(params, true)
|
||||||
if (options.only === 'false' || options.only === 'snippets') addSnippets(params, true)
|
if (options.only === 'false' || options.only === 'snippets') addSnippets(params, true)
|
||||||
if (options.only === 'false' || options.only === 'macros') addMacros(params, true)
|
if (options.only === 'false' || options.only === 'macros') addMacros(params, true)
|
||||||
|
|
|
@ -283,6 +283,7 @@ function simonSleeve({
|
||||||
export const sleeve = {
|
export const sleeve = {
|
||||||
name: 'simon.sleeve',
|
name: 'simon.sleeve',
|
||||||
from: brianSleeve,
|
from: brianSleeve,
|
||||||
|
after: front,
|
||||||
hideDependencies: true,
|
hideDependencies: true,
|
||||||
options: {
|
options: {
|
||||||
cuffOverlap,
|
cuffOverlap,
|
||||||
|
|
|
@ -39,5 +39,6 @@ export {
|
||||||
waistbandBack,
|
waistbandBack,
|
||||||
strapFront,
|
strapFront,
|
||||||
strapBack,
|
strapBack,
|
||||||
|
pantsProto,
|
||||||
Waralee,
|
Waralee,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Pattern } from './pattern.mjs'
|
import { Pattern } from './pattern.mjs'
|
||||||
import { addPartConfig } from './utils.mjs'
|
|
||||||
import { loadDesignDefaults } from './config.mjs'
|
import { loadDesignDefaults } from './config.mjs'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {
|
||||||
addNonEnumProp,
|
addNonEnumProp,
|
||||||
macroName,
|
macroName,
|
||||||
sampleStyle,
|
sampleStyle,
|
||||||
capitalize,
|
|
||||||
addPartConfig,
|
addPartConfig,
|
||||||
mergeDependencies,
|
mergeDependencies,
|
||||||
} from './utils.mjs'
|
} from './utils.mjs'
|
||||||
|
@ -151,7 +150,7 @@ Pattern.prototype.getConfig = function () {
|
||||||
/* Utility method to get the (initialized) part list */
|
/* Utility method to get the (initialized) part list */
|
||||||
Pattern.prototype.getPartList = function () {
|
Pattern.prototype.getPartList = function () {
|
||||||
this.init()
|
this.init()
|
||||||
return Object.keys(this.config.parts) || []
|
return Object.keys(this.config.parts)
|
||||||
}
|
}
|
||||||
|
|
||||||
function snappedOption(option, pattern) {
|
function snappedOption(option, pattern) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Design, Pattern, Path } from '../src/index.mjs'
|
import { Design, Pattern } from '../src/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { round, Pattern, Design, pctBasedOn } from '../src/index.mjs'
|
import { Design } from '../src/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { round, Design, Point, pctBasedOn } from '../src/index.mjs'
|
import { Design, Point } from '../src/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { round, Pattern, Design, pctBasedOn } from '../src/index.mjs'
|
//import { round, Pattern, Design, pctBasedOn } from '../src/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('Pattern', () => {
|
describe('Pattern', () => {
|
||||||
describe('Pattern.sample()', () => {
|
describe('Pattern.sample()', () => {
|
||||||
|
it('FIXME: Write some tests here', () => {
|
||||||
|
expect(true).to.equal(true)
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
it('Should sample an option', () => {
|
it('Should sample an option', () => {
|
||||||
let pattern = new Pattern({
|
let pattern = new Pattern({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { round, Design, Point, pctBasedOn } from '../src/index.mjs'
|
import { Design } from '../src/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import chaiString from 'chai-string'
|
import chaiString from 'chai-string'
|
||||||
import { Design, Pattern } from '../src/index.mjs'
|
//import { Design, Pattern } from '../src/index.mjs'
|
||||||
import pkg from '../package.json' assert { type: 'json' }
|
//import pkg from '../package.json' assert { type: 'json' }
|
||||||
import render from './fixtures/render.mjs'
|
//import render from './fixtures/render.mjs'
|
||||||
|
|
||||||
chai.use(chaiString)
|
chai.use(chaiString)
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
const { version } = pkg
|
//const { version } = pkg
|
||||||
|
|
||||||
|
it('FIXME: Write some tests here', () => {
|
||||||
|
expect(true).to.equal(true)
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
describe('Svg', () => {
|
describe('Svg', () => {
|
||||||
const part = {
|
const part = {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import {
|
import {
|
||||||
Pattern,
|
|
||||||
Point,
|
Point,
|
||||||
isCoord,
|
isCoord,
|
||||||
capitalize,
|
capitalize,
|
||||||
|
@ -20,17 +19,13 @@ import {
|
||||||
circlesIntersect,
|
circlesIntersect,
|
||||||
beamIntersectsCircle,
|
beamIntersectsCircle,
|
||||||
lineIntersectsCircle,
|
lineIntersectsCircle,
|
||||||
curveEdge,
|
|
||||||
stretchToScale,
|
stretchToScale,
|
||||||
round,
|
round,
|
||||||
sampleStyle,
|
sampleStyle,
|
||||||
deg2rad,
|
deg2rad,
|
||||||
rad2deg,
|
rad2deg,
|
||||||
pctBasedOn,
|
pctBasedOn,
|
||||||
Bezier,
|
|
||||||
generateStackTransform,
|
|
||||||
macroName,
|
macroName,
|
||||||
Design,
|
|
||||||
} from '../src/index.mjs'
|
} from '../src/index.mjs'
|
||||||
|
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Design, Pattern } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { bannerPlugin } from './dist/index.mjs'
|
import { bannerPlugin } from './dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import { version, name } from '../data.mjs'
|
import { version, name } from '../data.mjs'
|
||||||
|
|
||||||
// Helper method to construct prefixed/suffixed name
|
|
||||||
const getName = (n, so) => `${so.prefix}${n}${so.suffix}`
|
|
||||||
|
|
||||||
// Method that draws the actual bartack
|
// Method that draws the actual bartack
|
||||||
const drawBartack = (points, self) => {
|
const drawBartack = (points, self) => {
|
||||||
let path = new self.Path().move(points.path1[0])
|
let path = new self.Path().move(points.path1[0])
|
||||||
|
|
|
@ -52,8 +52,6 @@ function setGrain(store, partName, grain = false) {
|
||||||
return store
|
return store
|
||||||
}
|
}
|
||||||
return store.set(path, grain)
|
return store.set(path, grain)
|
||||||
|
|
||||||
return store
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Method to add the cutOnFold info */
|
/** Method to add the cutOnFold info */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Design, Point } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { plugin } from '../dist/index.mjs'
|
import { plugin } from '../dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Design, Pattern, round } from '@freesewing/core'
|
import { Design, round } from '@freesewing/core'
|
||||||
import { plugin } from './dist/index.mjs'
|
import { plugin } from './dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { Design, Pattern, round } from '@freesewing/core'
|
import { Design, round } from '@freesewing/core'
|
||||||
import { plugin } from './dist/index.mjs'
|
import { plugin } from './dist/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { round, Design, Pattern } from '@freesewing/core'
|
import { round, Design } from '@freesewing/core'
|
||||||
import { plugin } from '../src/index.mjs'
|
import { plugin } from '../src/index.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -157,7 +157,7 @@ export function scalebox(so) {
|
||||||
if (name.indexOf('@freesewing/') !== -1) name = name.replace('@freesewing/', '')
|
if (name.indexOf('@freesewing/') !== -1) name = name.replace('@freesewing/', '')
|
||||||
this.points.__scaleboxTitle = this.points.__scaleboxTitle
|
this.points.__scaleboxTitle = this.points.__scaleboxTitle
|
||||||
.attr('data-text', name)
|
.attr('data-text', name)
|
||||||
.attr('data-text', 'v' + this.context.config?.data?.version || 'No Version')
|
.attr('data-text', 'v' + (this.context.config?.data?.version || 'No Version'))
|
||||||
}
|
}
|
||||||
this.points.__scaleboxTitle.attributes.add('data-text-class', 'text-lg')
|
this.points.__scaleboxTitle.attributes.add('data-text-class', 'text-lg')
|
||||||
// Text
|
// Text
|
||||||
|
|
|
@ -81,7 +81,7 @@ export const plugin = {
|
||||||
this.points[`_${prefix}_titlePattern`] = so.at
|
this.points[`_${prefix}_titlePattern`] = so.at
|
||||||
.shift(-90 - so.rotation, shift * so.scale)
|
.shift(-90 - so.rotation, shift * so.scale)
|
||||||
.attr('data-text', name)
|
.attr('data-text', name)
|
||||||
.attr('data-text', 'v' + this.context.config?.data?.version || 'No Version')
|
.attr('data-text', 'v' + (this.context.config?.data?.version || 'No Version'))
|
||||||
.attr('data-text-class', 'fill-note')
|
.attr('data-text-class', 'fill-note')
|
||||||
.attr('data-text-transform', transform(so.at.shift(-90 - so.rotation, shift * so.scale)))
|
.attr('data-text-transform', transform(so.at.shift(-90 - so.rotation, shift * so.scale)))
|
||||||
if (this.context.settings.metadata && this.context.settings.metadata.for) {
|
if (this.context.settings.metadata && this.context.settings.metadata.for) {
|
||||||
|
|
|
@ -38,9 +38,9 @@ const PatternListPageTemplate = ({ section=false }) => {
|
||||||
const all = []
|
const all = []
|
||||||
for (const section in app.designs) all.push(...app.designs[section])
|
for (const section in app.designs) all.push(...app.designs[section])
|
||||||
return all
|
return all
|
||||||
} else return app.designs[section]
|
}
|
||||||
|
|
||||||
return []
|
return app.designs[section]
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -2,9 +2,9 @@ import rough from 'roughjs/bundled/rough.cjs.js'
|
||||||
|
|
||||||
const getAttributes = (element) => Array.prototype.slice.call(element.attributes)
|
const getAttributes = (element) => Array.prototype.slice.call(element.attributes)
|
||||||
|
|
||||||
const getNum = (element, attributes) => attributes.map(attr => parseFloat(element.getAttribute(attr), 10))
|
const getNum = (element, attributes) => attributes.map(attr => parseFloat(element.getAttribute(attr)))
|
||||||
|
|
||||||
const getDiam = (element, attributes) => attributes.map(attr => 2 * parseFloat(element.getAttribute(attr), 10))
|
const getDiam = (element, attributes) => attributes.map(attr => 2 * parseFloat(element.getAttribute(attr)))
|
||||||
|
|
||||||
const getCoords = (element, attribute) => element
|
const getCoords = (element, attribute) => element
|
||||||
.getAttribute(attribute)
|
.getAttribute(attribute)
|
||||||
|
@ -70,7 +70,7 @@ const coarse = (svg, options) => {
|
||||||
|
|
||||||
for(let i = 0; i < children.length; i += 1) {
|
for(let i = 0; i < children.length; i += 1) {
|
||||||
const original = children[i];
|
const original = children[i];
|
||||||
const params = [];
|
let params = [];
|
||||||
let shapeType;
|
let shapeType;
|
||||||
|
|
||||||
switch(original.tagName) {
|
switch(original.tagName) {
|
||||||
|
|
|
@ -17,12 +17,29 @@ const colorDot = dot => dot
|
||||||
.replace(regexA, getColorTint)
|
.replace(regexA, getColorTint)
|
||||||
.replace(regexB, getColor)
|
.replace(regexB, getColor)
|
||||||
const fixSvg = svg => svg.replace(/#000000/g, () => 'currentColor')
|
const fixSvg = svg => svg.replace(/#000000/g, () => 'currentColor')
|
||||||
|
const wrapDot = dot => {
|
||||||
|
if (dot.slice(0,7) === 'digraph') return dot
|
||||||
|
|
||||||
|
return plain
|
||||||
|
? `digraph G { bgcolor=transparent; ${colorDot(dot)} }`
|
||||||
|
: `digraph G {
|
||||||
|
graph [fontname = "Indie Flower"];
|
||||||
|
node [fontname = "Indie Flower"];
|
||||||
|
edge [fontname = "Indie Flower"];
|
||||||
|
bgcolor=transparent;
|
||||||
|
overlap=false;
|
||||||
|
${colorDot(dot)} }`
|
||||||
|
}
|
||||||
// Supported layout engines
|
// Supported layout engines
|
||||||
const engines = [ 'circo', 'dot', 'fdp', 'neato', 'osage', 'twopi' ]
|
const engines = [ 'circo', 'dot', 'fdp', 'neato', 'osage', 'twopi' ]
|
||||||
|
|
||||||
const Dot = props => {
|
const Dot = props => {
|
||||||
|
|
||||||
|
// Extract code/caption from props
|
||||||
|
const [code, caption] = props.children
|
||||||
|
// Extract dot code from mdx
|
||||||
|
const dot = wrapDot(code.props.children.props.children)
|
||||||
|
|
||||||
// State and effect are needed to run async code as this
|
// State and effect are needed to run async code as this
|
||||||
// library always returns a promise
|
// library always returns a promise
|
||||||
const svgRef = useRef(null)
|
const svgRef = useRef(null)
|
||||||
|
@ -68,24 +85,6 @@ const Dot = props => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const wrapDot = dot => {
|
|
||||||
if (dot.slice(0,7) === 'digraph') return dot
|
|
||||||
|
|
||||||
return plain
|
|
||||||
? `digraph G { bgcolor=transparent; ${colorDot(dot)} }`
|
|
||||||
: `digraph G {
|
|
||||||
graph [fontname = "Indie Flower"];
|
|
||||||
node [fontname = "Indie Flower"];
|
|
||||||
edge [fontname = "Indie Flower"];
|
|
||||||
bgcolor=transparent;
|
|
||||||
overlap=false;
|
|
||||||
${colorDot(dot)} }`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract code/caption from props
|
|
||||||
const [code, caption] = props.children
|
|
||||||
// Extract dot code from mdx
|
|
||||||
const dot = wrapDot(code.props.children.props.children)
|
|
||||||
// Initialize viz library
|
// Initialize viz library
|
||||||
const viz = new Viz({ Module, render })
|
const viz = new Viz({ Module, render })
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ const mdxCustomComponents = (app=false) => ({
|
||||||
img: Figure,
|
img: Figure,
|
||||||
Dot,
|
Dot,
|
||||||
table: props => <table {...props} className="mdx-table table-auto w-full">{props.children}</table>,
|
table: props => <table {...props} className="mdx-table table-auto w-full">{props.children}</table>,
|
||||||
|
Tab,
|
||||||
|
Tabs,
|
||||||
})
|
})
|
||||||
|
|
||||||
export default mdxCustomComponents
|
export default mdxCustomComponents
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Part from './part'
|
||||||
import { getProps } from './utils'
|
import { getProps } from './utils'
|
||||||
|
|
||||||
const Stack = props => {
|
const Stack = props => {
|
||||||
const { stackName, stack, patternProps, gist, app, updateGist, unsetGist, showInfo } = props
|
const { stackName, stack, gist, app, updateGist, unsetGist, showInfo } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<g {...getProps(stack)} id={`stack-${stackName}`}>
|
<g {...getProps(stack)} id={`stack-${stackName}`}>
|
||||||
|
|
|
@ -59,7 +59,7 @@ const WorkbenchMeasurements = ({ app, design, gist, updateGist, gistReady }) =>
|
||||||
<h2>{t('cfp:preloadMeasurements')}</h2>
|
<h2>{t('cfp:preloadMeasurements')}</h2>
|
||||||
<Tabs tabs="Adults, Dolls, Giants">
|
<Tabs tabs="Adults, Dolls, Giants">
|
||||||
{Object.keys(groups).map(group => (
|
{Object.keys(groups).map(group => (
|
||||||
<Tab tabId={group}>
|
<Tab tabId={group} key={group}>
|
||||||
{Object.keys(icons).map(type => (
|
{Object.keys(icons).map(type => (
|
||||||
<React.Fragment key={type}>
|
<React.Fragment key={type}>
|
||||||
<h4 className="mt-4">{t(type)}</h4>
|
<h4 className="mt-4">{t(type)}</h4>
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Option from './option'
|
||||||
import { Ul, Details, TopSummary, TopSumTitle } from 'shared/components/workbench/menu'
|
import { Ul, Details, TopSummary, TopSumTitle } from 'shared/components/workbench/menu'
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
import { optionsMenuStructure } from 'shared/utils.mjs'
|
import { optionsMenuStructure } from 'shared/utils.mjs'
|
||||||
import { adult, doll, giant, measurements } from '@freesewing/models'
|
import { adult, doll, giant } from '@freesewing/models'
|
||||||
|
|
||||||
const groups = { adult, doll, giant }
|
const groups = { adult, doll, giant }
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import { linkClasses } from 'shared/components/navigation/primary.js'
|
|
||||||
import { Li, SumButton, SumDiv } from 'shared/components/workbench/menu'
|
import { Li, SumButton, SumDiv } from 'shared/components/workbench/menu'
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
|
|
||||||
const Option = props => {
|
const Option = props => {
|
||||||
const { t } = useTranslation([`o_${props.design.config.data.name}`, 'workbench'])
|
|
||||||
const active = (
|
const active = (
|
||||||
props.sampleSettings?.type === 'option' &&
|
props.sampleSettings?.type === 'option' &&
|
||||||
props.active === props.option
|
props.active === props.option
|
||||||
|
|
|
@ -1,18 +1,9 @@
|
||||||
import designs from "../../config/software/designs.json" assert { type: 'json' }
|
|
||||||
import { adult, doll, giant } from '@freesewing/models'
|
import { adult, doll, giant } from '@freesewing/models'
|
||||||
import { getFamily, getShortName } from './config.mjs'
|
import { getFamily, getShortName } from './config.mjs'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
const noSizes = [
|
|
||||||
'examples',
|
|
||||||
'rendertest',
|
|
||||||
'plugintest',
|
|
||||||
'legend',
|
|
||||||
'tutorial',
|
|
||||||
]
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This runs unit tests for pattern drafting
|
* This runs unit tests for pattern drafting
|
||||||
* It expects the following:
|
* It expects the following:
|
||||||
|
@ -25,8 +16,6 @@ export const testPatternDrafting = (Pattern, log=false) => {
|
||||||
const pattern = new Pattern()
|
const pattern = new Pattern()
|
||||||
const config = pattern.getConfig()
|
const config = pattern.getConfig()
|
||||||
const design = getShortName(config.data.name)
|
const design = getShortName(config.data.name)
|
||||||
const family = getFamily(design)
|
|
||||||
const parts = pattern.getPartList()
|
|
||||||
// Helper method to try/catch pattern drafting
|
// Helper method to try/catch pattern drafting
|
||||||
const doesItDraftAndRender = (pattern, log=false) => {
|
const doesItDraftAndRender = (pattern, log=false) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import designs from "../../config/software/designs.json" assert { type: 'json' }
|
|
||||||
import { adult, doll, giant } from '@freesewing/models'
|
import { adult, doll, giant } from '@freesewing/models'
|
||||||
import { getFamily } from './config.mjs'
|
import { getFamily } from './config.mjs'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
|
@ -20,8 +19,8 @@ export const testPatternSampling = (Pattern, log=false) => {
|
||||||
const pattern = new Pattern()
|
const pattern = new Pattern()
|
||||||
const config = pattern.getConfig()
|
const config = pattern.getConfig()
|
||||||
const design = pattern.config.data.name
|
const design = pattern.config.data.name
|
||||||
const family = getFamily(design)
|
//const family = getFamily(design)
|
||||||
const parts = pattern.getPartList()
|
//const parts = pattern.getPartList()
|
||||||
|
|
||||||
// Helper method to try/catch pattern sampling
|
// Helper method to try/catch pattern sampling
|
||||||
const doesItSample = (pattern, log=false) => {
|
const doesItSample = (pattern, log=false) => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { Pattern } from '@freesewing/core'
|
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
/*
|
/*
|
||||||
* This runs unit tests for the plugin configuration
|
* This runs unit tests for the plugin configuration
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue