Refactor launcher and studio modules
This commit is contained in:
parent
a20d298be2
commit
ec3e0f5138
34 changed files with 10300 additions and 8600 deletions
34
src/worldshaperStudio/domMarkup.ts
Normal file
34
src/worldshaperStudio/domMarkup.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { WORLDSHAPER_THEME_PRESETS } from "./themePresets";
|
||||
import {
|
||||
WORLDSHAPER_STUDIO_MARKUP_SHELL,
|
||||
WORLDSHAPER_STUDIO_MARKUP_SIDEBAR,
|
||||
WORLDSHAPER_STUDIO_MARKUP_STAGE,
|
||||
} from "./domMarkupSections";
|
||||
|
||||
export function buildWorldshaperStudioPopupMarkup(): string {
|
||||
const themePresetButtons = WORLDSHAPER_THEME_PRESETS.map((preset) => `
|
||||
<button
|
||||
class="theme-preset-btn"
|
||||
data-theme-preset="${preset.id}"
|
||||
type="button"
|
||||
title="${preset.label} theme"
|
||||
aria-label="Switch to ${preset.label} theme"
|
||||
>
|
||||
<span
|
||||
class="theme-preset-swatch"
|
||||
style="--theme-swatch-a:${preset.swatch[0]}; --theme-swatch-b:${preset.swatch[1]}; --theme-swatch-c:${preset.swatch[2]}; --theme-swatch-d:${preset.swatch[3]};"
|
||||
></span>
|
||||
</button>
|
||||
`).join("");
|
||||
return (
|
||||
WORLDSHAPER_STUDIO_MARKUP_SHELL.replace("__THEME_PRESET_BUTTONS__", themePresetButtons)
|
||||
+ WORLDSHAPER_STUDIO_MARKUP_SIDEBAR
|
||||
+ WORLDSHAPER_STUDIO_MARKUP_STAGE
|
||||
);
|
||||
}
|
||||
|
||||
export function getWorldshaperStudioBodyMarkup(): string {
|
||||
return buildWorldshaperStudioPopupMarkup()
|
||||
.replace(/^<body>/i, "")
|
||||
.replace(/<\/body>\s*$/i, "");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue