bablojs-test
Version:
A lightweight, fast, and scalable Single Page Application framework built with vanilla JavaScript. BABLOJS provides React-like features including Virtual DOM, hooks, routing, and component-based architecture without any build step or external dependencies
237 lines (233 loc) • 2.63 kB
JavaScript
import { createElement } from "./bablo.js";
const elements = [
"a",
"abbr",
"address",
"area",
"article",
"aside",
"audio",
"b",
"base",
"bdi",
"bdo",
"blockquote",
"body",
"br",
"button",
"canvas",
"caption",
"cite",
"code",
"col",
"colgroup",
"data",
"datalist",
"dd",
"del",
"details",
"dfn",
"dialog",
"div",
"dl",
"dt",
"em",
"embed",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hgroup",
"hr",
"html",
"i",
"iframe",
"img",
"input",
"ins",
"kbd",
"label",
"legend",
"li",
"link",
"main",
"map",
"mark",
"meta",
"meter",
"nav",
"noscript",
"object",
"ol",
"optgroup",
"option",
"output",
"p",
"param",
"picture",
"pre",
"progress",
"q",
"range",
"rp",
"rt",
"ruby",
"s",
"samp",
"script",
"section",
"select",
"small",
"source",
"span",
"strong",
"style",
"sub",
"summary",
"sup",
"table",
"tbody",
"td",
"template",
"textarea",
"tfoot",
"th",
"thead",
"time",
"title",
"tr",
"track",
"u",
"ul",
"var",
"video",
"wbr",
];
const elementFunctions = {};
elements.forEach((tag) => {
const name = tag.charAt(0).toUpperCase() + tag.slice(1);
elementFunctions[name] = (props, ...children) =>
createElement(tag, props, ...children);
});
export const {
A,
Abbr,
Address,
Area,
Article,
Aside,
Audio,
B,
Base,
Bdi,
Bdo,
Blockquote,
Body,
Br,
Button,
Canvas,
Caption,
Cite,
Code,
Col,
Colgroup,
Data,
Datalist,
Dd,
Del,
Details,
Dfn,
Dialog,
Div,
Dl,
Dt,
Em,
Embed,
Fieldset,
Figcaption,
Figure,
Footer,
Form,
H1,
H2,
H3,
H4,
H5,
H6,
Head,
Header,
Hgroup,
Hr,
Html,
I,
Iframe,
Img,
Input,
Ins,
Kbd,
Label,
Legend,
Li,
Link,
Main,
Map,
Mark,
Meta,
Meter,
Nav,
Noscript,
Object,
Ol,
Optgroup,
Option,
Output,
P,
Param,
Picture,
Pre,
Progress,
Q,
Range,
Rp,
Rt,
Ruby,
S,
Samp,
Script,
Section,
Select,
Small,
Source,
Span,
Strong,
Style,
Sub,
Summary,
Sup,
Table,
Tbody,
Td,
Template,
Textarea,
Tfoot,
Th,
Thead,
Time,
Title,
Tr,
Track,
U,
Ul,
Var,
Video,
Wbr,
} = elementFunctions;