
This adds page templates that will auto-generate pages for each design. This not only allows us to split the bundle for these individual designs, we are also now passing the inline docs for a design as static props, as that will limit the memory footprint of webpack. Remains to be seen how this will all come together, but it's better than throwing everything at webpack and watching the build fail.
78 lines
1.7 KiB
JavaScript
78 lines
1.7 KiB
JavaScript
// __SDEFILE__ - This file is a dependency for the stand-alone environment
|
|
import { PanZoomPattern as ShowPattern } from 'shared/components/workbench/pan-zoom-pattern.mjs'
|
|
import { DraftMenu, ns as menuNs } from './menu.mjs'
|
|
import { PatternWithMenu } from '../pattern-with-menu.mjs'
|
|
import { DraftHeader, ns as headerNs } from './header.mjs'
|
|
|
|
export const ns = [...menuNs, ...headerNs]
|
|
|
|
export const DraftView = ({
|
|
design,
|
|
pattern,
|
|
patternConfig,
|
|
settings,
|
|
setSettings,
|
|
ui,
|
|
update,
|
|
language,
|
|
account,
|
|
docs,
|
|
setView,
|
|
view,
|
|
saveAs,
|
|
}) => {
|
|
let output = null
|
|
let renderProps = false
|
|
if (ui.renderer === 'svg') {
|
|
try {
|
|
const __html = pattern.render()
|
|
output = (
|
|
<ShowPattern>
|
|
<div className="w-full h-full" dangerouslySetInnerHTML={{ __html }} />
|
|
</ShowPattern>
|
|
)
|
|
} catch (err) {
|
|
console.log(err)
|
|
}
|
|
} else {
|
|
renderProps = pattern.getRenderProps()
|
|
output = <ShowPattern {...{ renderProps }} />
|
|
}
|
|
|
|
return (
|
|
<PatternWithMenu
|
|
{...{
|
|
settings,
|
|
ui,
|
|
update,
|
|
control: account.control,
|
|
account,
|
|
design,
|
|
pattern: output,
|
|
setSettings,
|
|
saveAs,
|
|
Header: DraftHeader,
|
|
menu: (
|
|
<DraftMenu
|
|
{...{
|
|
design,
|
|
pattern,
|
|
patternConfig,
|
|
setSettings,
|
|
settings,
|
|
ui,
|
|
update,
|
|
language,
|
|
account,
|
|
docs,
|
|
renderProps,
|
|
view,
|
|
setView,
|
|
flags: pattern.setStores?.[0]?.plugins?.['plugin-annotations']?.flags,
|
|
}}
|
|
/>
|
|
),
|
|
}}
|
|
/>
|
|
)
|
|
}
|