themes-y2k/embed.go
Alex Dunmow 49f9c90589 initial: theme plugin y2k
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/y2k.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:46 +08:00

58 lines
1.3 KiB
Go

package main
import (
"embed"
"io/fs"
"net/http"
"git.dev.alexdunmow.com/block/core/plugin"
)
//go:embed assets/*
var assetsFS embed.FS
//go:embed schemas/*
var schemasFS embed.FS
//go:embed presets.json
var presetsData []byte
//go:embed fonts.json
var fontsData []byte
//go:embed plugin.mod
var pluginModBytes []byte
// Assets returns the embedded assets filesystem rooted at assets/.
func Assets() fs.FS {
sub, _ := fs.Sub(assetsFS, "assets")
return sub
}
// Schemas returns the embedded schemas filesystem rooted at schemas/.
func Schemas() fs.FS {
sub, _ := fs.Sub(schemasFS, "schemas")
return sub
}
// AssetsHandler serves embedded asset files at /templates/y2k/...
func AssetsHandler() http.Handler {
return http.FileServer(http.FS(Assets()))
}
// ThemePresets returns the raw presets.json bytes.
func ThemePresets() []byte { return presetsData }
// BundledFonts returns the raw fonts.json bytes.
func BundledFonts() []byte { return fontsData }
// ThemeCSSManifest returns the theme's CSS manifest. Y2K injects keyframes
// (marquee-x, sparkle, metaball-morph) and chrome/bevel utility classes that
// Tailwind alone cannot express, plus CSS custom properties (--chrome-1..4,
// --mesh-a/b/c, --bevel-light/dark) into the host Tailwind input.
func ThemeCSSManifest() *plugin.CSSManifest {
return &plugin.CSSManifest{
InputCSSAppend: y2kInputCSS,
}
}