Files
FlexLove/docs/index.html
Michael Freno 396f588b47 v0.3.1 release
2025-11-20 16:35:34 -05:00

335 lines
9.5 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FlexLöve Documentation</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/github-markdown-css@5/github-markdown.min.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css"
/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/lua.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
Helvetica, Arial, sans-serif;
background-color: #0d1117;
color: #c9d1d9;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
.header {
text-align: center;
padding: 3rem 0;
border-bottom: 1px solid #30363d;
}
.header h1 {
font-size: 3rem;
margin: 0;
background: linear-gradient(45deg, #58a6ff, #79c0ff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.header p {
font-size: 1.2rem;
color: #8b949e;
margin: 1rem 0;
}
.nav {
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
margin: 2rem 0;
}
.nav a {
padding: 0.75rem 1.5rem;
background-color: #21262d;
color: #c9d1d9;
text-decoration: none;
border-radius: 6px;
border: 1px solid #30363d;
transition: all 0.2s;
}
.nav a:hover {
background-color: #30363d;
border-color: #58a6ff;
}
.markdown-body {
background-color: #0d1117;
padding: 2rem;
border-radius: 6px;
}
.section {
margin: 3rem 0;
}
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin: 3rem 0;
}
.feature-card {
background-color: #161b22;
padding: 2rem;
border-radius: 6px;
border: 1px solid #30363d;
transition: all 0.3s ease;
cursor: pointer;
text-decoration: none;
display: block;
color: inherit;
}
.feature-card:hover {
background-color: #1c2128;
border-color: #58a6ff;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(88, 166, 255, 0.15);
}
.feature-card h3 {
color: #58a6ff;
margin-top: 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.feature-card h3::after {
content: "→";
font-size: 1.5rem;
opacity: 0;
transition: opacity 0.3s ease;
}
.feature-card:hover h3::after {
opacity: 1;
}
.feature-card p {
color: #8b949e;
margin: 0.5rem 0 0 0;
}
code {
background-color: #161b22;
padding: 0.2rem 0.4rem;
border-radius: 3px;
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
monospace;
}
pre {
background-color: #161b22;
padding: 1rem;
border-radius: 6px;
overflow-x: auto;
position: relative;
}
.copy-button {
position: absolute;
top: 8px;
right: 8px;
background-color: #21262d;
color: #8b949e;
border: 1px solid #30363d;
border-radius: 6px;
padding: 6px 12px;
font-size: 12px;
cursor: pointer;
opacity: 0;
transition: all 0.2s;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
pre:hover .copy-button {
opacity: 1;
}
.copy-button:hover {
background-color: #30363d;
border-color: #58a6ff;
color: #c9d1d9;
}
.copy-button:active {
background-color: #238636;
border-color: #238636;
color: #ffffff;
}
.copy-button.copied {
background-color: #238636;
border-color: #238636;
color: #ffffff;
}
.footer {
text-align: center;
padding: 3rem 0;
border-top: 1px solid #30363d;
margin-top: 4rem;
color: #8b949e;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>FlexLöve</h1>
<p>A comprehensive UI library for LÖVE Framework based on flexbox</p>
</div>
<div class="nav">
<a href="https://github.com/mikefreno/FlexLove">GitHub</a>
<a href="#getting-started">Getting Started</a>
<a href="examples.html">Examples</a>
<a href="api.html">API Reference</a>
</div>
<div class="section">
<h2 style="text-align: center; margin-bottom: 2rem">✨ Features</h2>
<div class="features">
<a href="examples.html#layout" class="feature-card">
<h3>🎨 Flexbox & Grid Layouts</h3>
<p>
Modern CSS-like layout system with full flexbox and grid support
for building responsive UIs.
</p>
</a>
<a href="examples.html#theme" class="feature-card">
<h3>🎭 Theme System</h3>
<p>
9-patch NinePatch theming with state support (normal, hover,
pressed, disabled).
</p>
</a>
<a href="examples.html#state" class="feature-card">
<h3>✨ State Management</h3>
<p>
Interactive components with state tracking, counters, toggles, and
dynamic updates.
</p>
</a>
<a href="examples.html#scroll" class="feature-card">
<h3>📜 Scrollable Content</h3>
<p>
Smooth scrolling containers with backdrop blur effects and
overflow handling for long content lists.
</p>
</a>
<a href="examples.html#slider" class="feature-card">
<h3>🎚️ Sliders & Controls</h3>
<p>
Draggable sliders with value tracking, perfect for settings menus
and adjustable parameters.
</p>
</a>
<a href="examples.html#input" class="feature-card">
<h3>⌨️ Input & Events</h3>
<p>
Rich event handling with mouse, keyboard, and touch support. Focus
management and input fields.
</p>
</a>
</div>
</div>
<div class="section" id="getting-started">
<h2>Quick Start</h2>
<pre><code class="language-lua">local FlexLove = require("FlexLove")
-- Initialize with base scaling and theme
FlexLove.init({
baseScale = { width = 1920, height = 1080 },
theme = "space"
})
-- Create a button
local button = FlexLove.new({
width = "20vw",
height = "10vh",
backgroundColor = Color.new(0.2, 0.2, 0.8, 1),
text = "Click Me",
themeComponent = "button",
onEvent = function(element, event)
print("Button clicked!")
end
})
-- In your love callbacks
function love.update(dt)
FlexLove.update(dt)
end
function love.draw()
FlexLove.draw()
end</code></pre>
</div>
<div class="section">
<h2>Installation</h2>
<p>
Add the <code>modules</code> directory and
<code>FlexLove.lua</code> into your LÖVE project.
</p>
<pre><code>git clone https://github.com/mikefreno/FlexLove.git
cp -r FlexLove/modules your-project/
cp FlexLove/FlexLove.lua your-project/</code></pre>
</div>
<div class="footer">
<p>
FlexLöve v0.3.1 | MIT License |
<a href="https://github.com/mikefreno/FlexLove" style="color: #58a6ff"
>GitHub Repository</a
>
</p>
</div>
</div>
<script>
hljs.highlightAll();
document.querySelectorAll('a[href^="#"]').forEach((anchor) => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute("href"));
if (target) {
target.scrollIntoView({ behavior: "smooth", block: "start" });
}
});
});
// Add copy buttons to code blocks
document.querySelectorAll("pre code").forEach((codeBlock) => {
const pre = codeBlock.parentElement;
const button = document.createElement("button");
button.className = "copy-button";
button.textContent = "Copy";
button.title = "Copy to clipboard";
button.addEventListener("click", async () => {
const code = codeBlock.textContent;
try {
await navigator.clipboard.writeText(code);
button.textContent = "Copied!";
button.classList.add("copied");
setTimeout(() => {
button.textContent = "Copy";
button.classList.remove("copied");
}, 2000);
} catch (err) {
console.error("Failed to copy:", err);
button.textContent = "Failed";
setTimeout(() => {
button.textContent = "Copy";
}, 2000);
}
});
pre.appendChild(button);
});
</script>
</body>
</html>