1
0
Fork 0

minor fixes

This commit is contained in:
Wouter van Wageningen 2023-03-08 05:15:30 +00:00
parent 61c32ed104
commit 44772771a7
29 changed files with 89 additions and 4194 deletions

View file

@ -130,5 +130,5 @@ export const bartack = {
}
// More specifically named exports
// export const bartackPlugin = bartack
// export const pluginBartack = bartack
export const bartackPlugin = bartack
export const pluginBartack = bartack

View file

@ -78,5 +78,5 @@ export const buttons = {
}
// More specifically named exports
// export const buttonsPlugin = plugin
// export const pluginButtons = plugin
export const buttonsPlugin = buttons
export const pluginButtons = buttons

View file

@ -58,5 +58,5 @@ export const crossbox = {
}
// More specifically named exports
// export const cutonfoldPlugin = cutonfold
// export const pluginCutonfold = cutonfold
export const crossboxPlugin = crossbox
export const pluginCrossbox = crossbox

View file

@ -67,5 +67,5 @@ export const cutonfold = {
}
// More specifically named exports
// export const cutonfoldPlugin = cutonfold
// export const pluginCutonfold = cutonfold
export const cutonfoldPlugin = cutonfold
export const pluginCutonfold = cutonfold

View file

@ -52,5 +52,5 @@ export const grainline = {
}
// More specifically named exports
// export const grainlinePlugin = plugin
// export const pluginGrainline = plugin
export const grainlinePlugin = grainline
export const pluginGrainline = grainline

View file

@ -1,42 +1,60 @@
import { bartack } from './bartack.mjs'
import { buttons } from './buttons.mjs'
import { crossbox } from './crossbox.mjs'
import { cutonfold } from './cutonfold.mjs'
import { grainline } from './grainline.mjs'
import { logo } from './logo.mjs'
import { scalebox, scalebox2 } from './scalebox.mjs'
import { notches } from './notches.mjs'
import { pleat } from './pleat.mjs'
import { sewtogether } from './sewtogether.mjs'
import { name, version } from '../data.mjs'
// Named exports
// export bartack
export const bartackPlugin = bartack
export const pluginBartack = bartack
import { bartackPlugin } from './bartack.mjs'
import { buttonsPlugin } from './buttons.mjs'
import { crossboxPlugin } from './crossbox.mjs'
import { cutonfoldPlugin } from './cutonfold.mjs'
import { grainlinePlugin } from './grainline.mjs'
import { logoPlugin } from './logo.mjs'
import { notchesPlugin } from './notches.mjs'
import { pleatPlugin } from './pleat.mjs'
import { scaleboxPlugin } from './scalebox.mjs'
import { sewtogetherPlugin } from './sewtogether.mjs'
export const crossboxPlugin = crossbox
export const pluginCrossbox = crossbox
const annotationPlugins = [
bartackPlugin,
buttonsPlugin,
crossboxPlugin,
cutonfoldPlugin,
grainlinePlugin,
logoPlugin,
notchesPlugin,
pleatPlugin,
scaleboxPlugin,
sewtogetherPlugin,
]
export const cutonfoldPlugin = cutonfold
export const pluginCutonfold = cutonfold
function annotationHooks() {
const hooks = {}
for (const plugin of annotationPlugins) {
for (const i in plugin.hooks) {
if (typeof hooks[i] === 'undefined') hooks[i] = []
const hook = plugin.hooks[i]
if (typeof hook === 'function') hooks[i].push(hook)
else if (typeof hook === 'object') {
for (let method of hook) hooks[i].push(method)
}
}
}
export const pleatPlugin = pleat
export const pluginPleat = pleat
return hooks
}
export const scaleboxPlugin = scalebox
export const pluginScalebox = scalebox
function annotationMacros() {
const macros = {}
for (const plugin of annotationPlugins) {
for (const i in plugin.macros) macros[i] = plugin.macros[i]
}
export const sewtogetherPlugin = sewtogether
export const pluginSewtogether = sewtogether
return macros
}
export const buttonsPlugin = buttons
export const pluginButtons = buttons
export const plugin = {
name,
version,
hooks: annotationHooks(),
macros: annotationMacros(),
}
export const grainlinePlugin = grainline
export const pluginGrainline = grainline
export const logoPlugin = logo
export const pluginLogo = logo
export const notchesPlugin = notches
export const pluginNotches = notches
export const annotationPlugin = plugin
export const pluginAnnotation = plugin

View file

@ -15,5 +15,5 @@ export const logo = {
}
// More specifically named exports
// export const logoPlugin = logo
// export const pluginLogo = logo
export const logoPlugin = logo
export const pluginLogo = logo

View file

@ -21,5 +21,5 @@ export const notches = {
}
// More specifically named exports
// export const notchesPlugin = notches
// export const pluginNotches = notches
export const notchesPlugin = notches
export const pluginNotches = notches

View file

@ -72,5 +72,5 @@ export const pleat = {
}
// More specifically named exports
// export const pleatPlugin = plugin
// export const pluginPleat = plugin
export const pleatPlugin = pleat
export const pluginPleat = pleat

View file

@ -1,10 +1,16 @@
import { name, version } from '../data.mjs'
const markers = `
<marker id="pleatTo" markerWidth="12" markerHeight="8" orient="auto" refY="4" refX="12">
<path class="note fill-note" d="M 12,4 L 0,0 C 2,2 2,6 0,8 z" />
</marker>
`
export const scalebox = {
name: 'scalebox',
name,
version,
macros: {
scalebox(so, { store, points, paths, scale, Point, Path }) {
scalebox: function (so, { store, points, paths, scale, Point, Path }) {
// Passing `false` will remove the scalebox
if (so === false) {
for (let id of [
@ -285,3 +291,7 @@ export const scalebox = {
},
},
}
// More specifically named exports
export const scaleboxPlugin = scalebox
export const pluginScalebox = scalebox

View file

@ -90,5 +90,5 @@ export const sewtogether = {
}
// More specifically named exports
// export const sewtogetherPlugin = plugin
// export const pluginSewtogether = plugin
export const sewtogetherPlugin = sewtogether
export const pluginSewtogether = sewtogether