0.1.3 โ€ข Published 5 months ago

@cnuebred/frontforge v0.1.3

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

FrontForge

FrontForge Logo

npm version npm downloads

FrontForge is a minimalist TypeScript-based frontend framework that allows you to describe your entire HTML structure, styles, and logic in code - and compile it into a complete, standalone HTML file. Ideal for generating simple UI apps or static pages directly from TypeScript.

This project was created out of pure passion by a beginner developer who strongly believes in simplicity, transparency, and minimal dependencies. FrontForge is intentionally built to stay lean, with no heavy abstractions or runtime overhead โ€” just TypeScript and the browser DOM.


โœจ Features

  • ๐Ÿงฑ Declarative UI construction with Widget and ContainerWidget
  • ๐ŸŽฏ Reactive state with Pocket (based on Proxy)
  • ๐Ÿ“ฆ Auto HTML/JS/CSS bundling with ForgeBundle
  • โš™๏ธ Easy layout utilities via Flex() and Grid()
  • ๐Ÿ–ฑ๏ธ Simple event handling with .event()
  • ๐Ÿ“„ Markdown-style inline content support
  • ๐Ÿ’จ Minimal dependencies, zero-runtime abstraction

๐Ÿ“ฆ Installation

npm install @cnuebred/frontforge

Requires Node.js (LTS recommended) and TypeScript.


๐Ÿš€ Quick Example

// >>> main.ts
import { Widget, ContainerWidget, ForgeBundle } from "@cnuebred/frontforge";

// Create UI elements
const header = new Widget("h1.title", "Welcome to FrontForge");
const button = new Widget("button", "Click me");

// React to click event
button.event("click", () => {
  header.value = "Button clicked!";
  header.render();
});

// Group in a container and attach to DOM
const container = new ContainerWidget("div");
container.add(header).add(button);
container.hook("body");
// >>> end of main.ts

import { ForgeBundle } from "@cnuebred/frontforge";

// Bundle and export as HTML
const bundle = new ForgeBundle();
await bundle.script("./main.ts");
await bundle.style("./style.scss");
bundle.head.title("My App");
bundle.build("index", "./dist");

๐Ÿงฐ API Overview

Widget

const w = new Widget("p.text", "Hello");
w.attribute = { id: "my-id", style: "color: red;" };
w.value = "**Bold** content";
w.event("click", () => alert("clicked"));
w.render();

ContainerWidget

const c = new ContainerWidget("div");
c.add(new Widget("span", "Child 1"));
c.add(new Widget("span", "Child 2"));
c.hook("body");

Pocket (reactive state)

import { Pocket } from "@cnuebred/frontforge";

const p = new Pocket({ count: 0 });
const state = p.target;

p.set_setter_callback(({ property, new_value }) => {
  console.log(`${property} changed to ${new_value}`);
});

state.count++; // triggers the callback

Flex / Grid Layouts

import { Flex, flex_direction_e, flex_justify_e, Widget } from "@cnuebred/frontforge";

const row = Flex([
  new Widget("div.box", "A"),
  new Widget("div.box", "B"),
], {
  direction: flex_direction_e.row,
  justify_content: flex_justify_e.space_between,
  height: 200
});

row.hook("body");

๐Ÿ› ๏ธ Build & Bundle

Use ForgeBundle to compile your app to a standalone .html file with embedded styles and JS.

const bundle = new ForgeBundle();
await bundle.script("./src/app.ts");
await bundle.style("./src/styles.scss");

bundle.head.title("My Static Page");
bundle.head.meta({ name: "viewport", content: "width=device-width, initial-scale=1" });

bundle.build("index", "./dist");

๐Ÿ”ง Requirements

  • Node.js (v16+ recommended)
  • TypeScript
  • Works in browser environments
  • Uses: esbuild, sass, crypto, and modern ES features

๐Ÿงช Playground / Test

You can experiment with widgets like this:

const counter = new Widget("h2", () => `Count: ${state.count}`);
const button = new Widget("button", "Increment");
button.event("click", () => { state.count++ });

const layout = Flex([counter, button]);
layout.hook("body");

๐Ÿ“ˆ Roadmap

  • Component abstraction
  • Data binding helpers
  • Dev server with hot reload

๐Ÿ™‹โ€โ™‚๏ธ Author

Made with โค๏ธ by Cube (@cnuebred)
Feedback, issues, or contributions are welcome!

0.1.3

5 months ago

0.1.2

5 months ago

0.1.1

6 months ago

0.1.0

6 months ago

0.0.30

7 months ago

0.0.29

7 months ago

0.0.28

7 months ago

0.0.27

7 months ago

0.0.26

7 months ago

0.0.25

7 months ago

0.0.24

7 months ago

0.0.23

7 months ago

0.0.22

7 months ago

0.0.21

7 months ago

0.0.20

7 months ago

0.0.19

7 months ago

0.0.18

7 months ago

0.0.17

7 months ago

0.0.16

7 months ago

0.0.15

7 months ago

0.0.14

7 months ago

0.0.13

7 months ago

0.0.12

7 months ago

0.0.11

7 months ago

0.0.10

7 months ago

0.0.9

7 months ago

0.0.8

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago