1
0
Fork 0

cutting layout page has tabs for each fabric type. parts duplication

This commit is contained in:
Enoch Riese 2023-02-27 17:47:34 -06:00
parent cd034a7cf3
commit 29e3ba6323
12 changed files with 224 additions and 158 deletions

View file

@ -12,6 +12,7 @@ import { roundPlugin } from '../../plugin-round/src/index.mjs'
import { scaleboxPlugin } from '../../plugin-scalebox/src/index.mjs'
import { sprinklePlugin } from '../../plugin-sprinkle/src/index.mjs'
import { titlePlugin } from '../../plugin-title/src/index.mjs'
import { pluginCutlist } from '../../plugin-cutlist/src/index.mjs'
import { name, version } from '../data.mjs'
const bundledPlugins = [
@ -29,38 +30,44 @@ const bundledPlugins = [
scaleboxPlugin,
sprinklePlugin,
titlePlugin,
pluginCutlist,
]
function bundleHooks() {
const hooks = {}
for (const plugin of bundledPlugins) {
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)
}
const hooks = {}
const macros = {}
const store = []
function bundleHooks(plugin) {
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)
}
}
return hooks
}
function bundleMacros() {
const macros = {}
for (const plugin of bundledPlugins) {
for (const i in plugin.macros) macros[i] = plugin.macros[i]
}
function bundleMacros(plugin) {
for (const i in plugin.macros) macros[i] = plugin.macros[i]
}
return macros
function bundleStore(plugin) {
if (plugin.store) store.push(...plugin.store)
}
for (const plugin of bundledPlugins) {
bundleHooks(plugin, hooks)
bundleMacros(plugin, macros)
bundleStore(plugin, store)
}
export const plugin = {
name,
version,
hooks: bundleHooks(),
macros: bundleMacros(),
hooks,
macros,
store,
}
// More specifically named exports