create-gardener 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/buildHelper.js +5 -0
- package/template/src/backend/controllers/gardener/hotReload.ts +34 -0
- package/template/src/backend/routes/gardener.route.ts +2 -0
- package/template/src/frontend/static/components/gardener/hotReloadbtn.js +25 -78
- package/template/src/frontend/static/gardenerDev.js +2 -18
- package/template/src/frontend/static/style.css +0 -61
- package/template/src/frontend/views/_.ejs +104 -90
- package/template/build/backend/controllers/gardener/addComponent.d.ts +0 -8
- package/template/build/backend/controllers/gardener/addComponent.d.ts.map +0 -1
- package/template/build/backend/controllers/gardener/addComponent.js +0 -19
- package/template/build/backend/controllers/gardener/addComponent.js.map +0 -1
- package/template/build/backend/controllers/gardener/addPage.d.ts +0 -3
- package/template/build/backend/controllers/gardener/addPage.d.ts.map +0 -1
- package/template/build/backend/controllers/gardener/addPage.js +0 -86
- package/template/build/backend/controllers/gardener/addPage.js.map +0 -1
- package/template/build/backend/controllers/gardener/createStatic.d.ts +0 -3
- package/template/build/backend/controllers/gardener/createStatic.d.ts.map +0 -1
- package/template/build/backend/controllers/gardener/createStatic.js +0 -63
- package/template/build/backend/controllers/gardener/createStatic.js.map +0 -1
- package/template/build/backend/controllers/gardener/imageOptimiser.d.ts +0 -3
- package/template/build/backend/controllers/gardener/imageOptimiser.d.ts.map +0 -1
- package/template/build/backend/controllers/gardener/imageOptimiser.js +0 -54
- package/template/build/backend/controllers/gardener/imageOptimiser.js.map +0 -1
- package/template/build/backend/controllers/gardener/index.d.ts +0 -6
- package/template/build/backend/controllers/gardener/index.d.ts.map +0 -1
- package/template/build/backend/controllers/gardener/index.js +0 -6
- package/template/build/backend/controllers/gardener/index.js.map +0 -1
- package/template/build/backend/controllers/gardener/saveTemplate.d.ts +0 -3
- package/template/build/backend/controllers/gardener/saveTemplate.d.ts.map +0 -1
- package/template/build/backend/controllers/gardener/saveTemplate.js +0 -36
- package/template/build/backend/controllers/gardener/saveTemplate.js.map +0 -1
- package/template/build/backend/libs/generateWebp.d.ts +0 -2
- package/template/build/backend/libs/generateWebp.d.ts.map +0 -1
- package/template/build/backend/libs/generateWebp.js +0 -16
- package/template/build/backend/libs/generateWebp.js.map +0 -1
- package/template/build/backend/routes/gardener.route.d.ts +0 -4
- package/template/build/backend/routes/gardener.route.d.ts.map +0 -1
- package/template/build/backend/routes/gardener.route.js +0 -18
- package/template/build/backend/routes/gardener.route.js.map +0 -1
- package/template/build/backend/server.d.ts +0 -2
- package/template/build/backend/server.d.ts.map +0 -1
- package/template/build/backend/server.js +0 -20
- package/template/build/backend/server.js.map +0 -1
- package/template/build/frontend/assets/favicon.png +0 -0
- package/template/build/frontend/assets/gardener.jpg +0 -0
- package/template/build/frontend/static/bundle/bundle._.js +0 -1
- package/template/build/frontend/static/bundle/bundle._about.js +0 -1
- package/template/build/frontend/static/bundle/bundle._kartik.js +0 -1
- package/template/build/frontend/static/bundle/bundle._new.js +0 -1
- package/template/build/frontend/static/bundle/bundle._ritish.js +0 -1
- package/template/build/frontend/static/cache/favicon_500x500.webp +0 -0
- package/template/build/frontend/static/cache/favicon_50x50.webp +0 -0
- package/template/build/frontend/static/cache/gardener_100x100.webp +0 -0
- package/template/build/frontend/static/cache/gardener_500x500.webp +0 -0
- package/template/build/frontend/static/cache/gardener_50x50.webp +0 -0
- package/template/build/frontend/static/components/copybtn.js +0 -99
- package/template/build/frontend/static/components/footer.js +0 -33
- package/template/build/frontend/static/components/gardener/errorBox.js +0 -47
- package/template/build/frontend/static/components/gardener/hotReloadbtn.js +0 -82
- package/template/build/frontend/static/components/gardener/pageOverlayBtn.js +0 -138
- package/template/build/frontend/static/components/gardener/parserWindow.js +0 -159
- package/template/build/frontend/static/components/nonui/api.js +0 -52
- package/template/build/frontend/static/components/nonui/navigation.js +0 -59
- package/template/build/frontend/static/components/notification.js +0 -67
- package/template/build/frontend/static/gardener.js +0 -160
- package/template/build/frontend/static/gardenerConfig.js +0 -1
- package/template/build/frontend/static/gardenerDev.js +0 -165
- package/template/build/frontend/static/global.js +0 -4
- package/template/build/frontend/static/pages/pages._.js +0 -25
- package/template/build/frontend/static/pages/pages._about.js +0 -2
- package/template/build/frontend/static/pages/pages._kartik.js +0 -2
- package/template/build/frontend/static/pages/pages._new.js +0 -2
- package/template/build/frontend/static/pages/pages._ritish.js +0 -2
- package/template/build/frontend/static/style.css +0 -2
- package/template/build/frontend/static/style2.css +0 -26
- package/template/build/frontend/style.css +0 -1045
- package/template/build/frontend/tailwind.css +0 -1
- package/template/build/frontend/views/_.ejs +0 -125
- package/template/build/frontend/views/_about.ejs +0 -126
- package/template/build/frontend/views/_kartik.ejs +0 -126
- package/template/build/frontend/views/_new.ejs +0 -126
- package/template/build/frontend/views/_ritish.ejs +0 -126
- package/template/build/frontend/views/partials/icons/clipboard.ejs +0 -1
- package/template/build/frontend/views/partials/icons/clipboardok.ejs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addPage.d.ts","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/addPage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA8CjD,wBAAsB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,iBAyCxD"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import fsp from "fs/promises";
|
|
2
|
-
import { access } from "fs/promises";
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = path.dirname(__filename);
|
|
7
|
-
const frontendDir = path.resolve(__dirname, '..', '..', '..', 'frontend');
|
|
8
|
-
const templateDir = path.join(frontendDir, 'template');
|
|
9
|
-
async function findTemplate(fileName) {
|
|
10
|
-
try {
|
|
11
|
-
while (fileName.length !== 0) {
|
|
12
|
-
console.log(fileName);
|
|
13
|
-
const searchFile = `template.${fileName}.ejs`;
|
|
14
|
-
console.log(searchFile);
|
|
15
|
-
const searchPath = path.join(templateDir, searchFile);
|
|
16
|
-
console.log(searchPath);
|
|
17
|
-
try {
|
|
18
|
-
await access(searchPath); // ✅ checks if file exists
|
|
19
|
-
return searchPath; // return full path immediately
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// file does not exist → continue
|
|
23
|
-
}
|
|
24
|
-
let lastUnderscore = fileName.lastIndexOf('_');
|
|
25
|
-
if (lastUnderscore === -1)
|
|
26
|
-
break;
|
|
27
|
-
if (lastUnderscore === 0)
|
|
28
|
-
lastUnderscore += 1;
|
|
29
|
-
fileName = fileName.substring(0, lastUnderscore);
|
|
30
|
-
console.log(fileName);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
throw new Error("Template not found");
|
|
35
|
-
}
|
|
36
|
-
// ❗ explicit failure instead of silent bug
|
|
37
|
-
}
|
|
38
|
-
export async function addPage(req, res) {
|
|
39
|
-
try {
|
|
40
|
-
const pagename = req.body.page;
|
|
41
|
-
const name = pagename.replaceAll('/', '_');
|
|
42
|
-
const templatePath = await findTemplate(name); //path.join(frontendDir, findTemplate(name)); //path.join(frontendDir, 'frontendtemplate.ejs');
|
|
43
|
-
if (!templatePath)
|
|
44
|
-
throw new Error('no template found');
|
|
45
|
-
const viewPath = path.join(frontendDir, `views`, `${name}.ejs`);
|
|
46
|
-
const routePath = path.resolve(__dirname, '..', '..', 'routes', 'gardener.route.ts');
|
|
47
|
-
const jsDir = path.join(frontendDir, 'static/pages');
|
|
48
|
-
const jsFilePath = path.join(jsDir, `pages.${name}.js`);
|
|
49
|
-
const bundleDir = path.join(frontendDir, 'bundle');
|
|
50
|
-
const templateContent = await fsp.readFile(templatePath, 'utf8');
|
|
51
|
-
await fsp.writeFile(viewPath, templateContent, "utf8");
|
|
52
|
-
await replaceLastOccurrence(viewPath, '<script', `<script src="/static/pages/pages.${name}.js" type='module'></script>`);
|
|
53
|
-
const routeEntry = `router.route("${pagename}").get((req: Request, res: Response) => res.render("${name}",{fileName:"${name}"}));\n`;
|
|
54
|
-
await fsp.appendFile(routePath, routeEntry, "utf8");
|
|
55
|
-
await fsp.mkdir(jsDir, { recursive: true });
|
|
56
|
-
const jsContent = 'import { gardener, fetchElement, replaceElement, appendElement } from "../gardener.js";\n import {log, parser, addEl, State} from "../gardenerDev.js"';
|
|
57
|
-
await fsp.writeFile(jsFilePath, jsContent, "utf8");
|
|
58
|
-
await fsp.mkdir(bundleDir, { recursive: true });
|
|
59
|
-
const bundleContent = `import '../static/global.js';import '../static/pages/pages.${name}.js'; `;
|
|
60
|
-
await fsp.writeFile(path.join(bundleDir, `bundle.${name}.js`), bundleContent, "utf8");
|
|
61
|
-
res.json({ success: true });
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
const error = err;
|
|
65
|
-
res.json({ success: false, msg: error.message });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async function replaceLastOccurrence(filePath, searchPattern, replacementLine) {
|
|
69
|
-
const content = await fsp.readFile(filePath, 'utf8');
|
|
70
|
-
const lines = content.split('\n');
|
|
71
|
-
let found = false;
|
|
72
|
-
for (let i = lines.length - 1; i >= 0; i--) {
|
|
73
|
-
if (lines[i].includes(searchPattern)) {
|
|
74
|
-
lines[i] = `${replacementLine}\n${lines[i]}`;
|
|
75
|
-
found = true;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (found) {
|
|
80
|
-
await fsp.writeFile(filePath, lines.join('\n'), 'utf8');
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
console.warn(`Pattern "${searchPattern}" not found in ${filePath}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=addPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addPage.js","sour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AC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,KAAK,GAAG,KAAK,CAAC;IAElB,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAE3C,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YACtC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,eAAe,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,KAAK,GAAG,IAAI,CAAC;YACb,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,CAAC,YAAY,aAAa,kBAAkB,QAAQ,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createStatic.d.ts","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/createStatic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAWjD,wBAAsB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,+CAyE7D"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fsp from "fs/promises";
|
|
3
|
-
import ejs from "ejs";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = path.dirname(__filename);
|
|
7
|
-
const frontendDir = path.resolve(__dirname, '..', '..', '..', 'frontend');
|
|
8
|
-
export async function createStatic(req, res) {
|
|
9
|
-
try {
|
|
10
|
-
const viewsDir = path.join(frontendDir, "views");
|
|
11
|
-
const outDir = path.resolve("src/tempfrontend");
|
|
12
|
-
const finalOut = path.resolve("src/frontendStatic");
|
|
13
|
-
await fsp.mkdir(outDir, { recursive: true });
|
|
14
|
-
await fsp.mkdir(finalOut, { recursive: true });
|
|
15
|
-
const entries = await fsp.readdir(viewsDir, { withFileTypes: true });
|
|
16
|
-
const rendered = [];
|
|
17
|
-
for (const entry of entries) {
|
|
18
|
-
// skip folders (partials, layouts, etc.)
|
|
19
|
-
if (!entry.isFile())
|
|
20
|
-
continue;
|
|
21
|
-
if (!entry.name.endsWith(".ejs"))
|
|
22
|
-
continue;
|
|
23
|
-
const inputPath = path.join(viewsDir, entry.name);
|
|
24
|
-
const outputName = entry.name.replace(/\.ejs$/, ".html");
|
|
25
|
-
const outputPath = path.join(outDir, outputName);
|
|
26
|
-
const html = await ejs.renderFile(inputPath, {
|
|
27
|
-
fileName: inputPath
|
|
28
|
-
}, {
|
|
29
|
-
// async: true,
|
|
30
|
-
views: [viewsDir], // needed for includes
|
|
31
|
-
});
|
|
32
|
-
await fsp.writeFile(outputPath, html, "utf8");
|
|
33
|
-
rendered.push(outputName);
|
|
34
|
-
}
|
|
35
|
-
const entries3 = await fsp.readdir(outDir, { withFileTypes: true });
|
|
36
|
-
for (const entry of entries3) {
|
|
37
|
-
// "_path1_path2_path3.html" -> ["path1", "path2", "path3"]
|
|
38
|
-
const parts = entry.name
|
|
39
|
-
.replace(/^_/, "")
|
|
40
|
-
.replace(/\.html$/, "")
|
|
41
|
-
.split("_");
|
|
42
|
-
const targetDir = path.join(finalOut, ...parts);
|
|
43
|
-
const targetFile = path.join(targetDir, "index.html");
|
|
44
|
-
// ensure directories exist
|
|
45
|
-
await fsp.mkdir(targetDir, { recursive: true });
|
|
46
|
-
console.log('done');
|
|
47
|
-
// copy file
|
|
48
|
-
await fsp.copyFile(path.join(outDir, entry.name), targetFile);
|
|
49
|
-
}
|
|
50
|
-
await fsp.rm(outDir, { recursive: true, force: true });
|
|
51
|
-
await fsp.cp(path.join(frontendDir, "static"), path.join(finalOut, 'static'), { recursive: true });
|
|
52
|
-
return res.json({
|
|
53
|
-
success: true,
|
|
54
|
-
generated: rendered,
|
|
55
|
-
outDir,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
console.error(err);
|
|
60
|
-
return res.status(500).json({ error: "Static build failed" });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=createStatic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createStatic.js","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/createStatic.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAE1E,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAY,EAAE,GAAa;IAC5D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,O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QACnB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageOptimiser.d.ts","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/imageOptimiser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAWjD,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,sDAuD/D"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import fsp from "fs/promises";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import generateWebP from "../../libs/generateWebp.js";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = path.dirname(__filename);
|
|
7
|
-
export async function imageOptimiser(req, res) {
|
|
8
|
-
try {
|
|
9
|
-
const { name } = req.params;
|
|
10
|
-
if (typeof name !== 'string')
|
|
11
|
-
return res.status(400).json({ success: false, message: "invalid path" });
|
|
12
|
-
// name format: test_500x300.webp
|
|
13
|
-
const match = name.match(/^(.+?)_(\d+)x(\d+)\.webp$/);
|
|
14
|
-
if (!match) {
|
|
15
|
-
return res.status(400).json({ error: "Invalid image format" });
|
|
16
|
-
}
|
|
17
|
-
const [, baseName, widthStr, heightStr] = match;
|
|
18
|
-
if (!widthStr || !heightStr)
|
|
19
|
-
return;
|
|
20
|
-
const width = parseInt(widthStr, 10);
|
|
21
|
-
const height = parseInt(heightStr, 10);
|
|
22
|
-
const cacheDir = path.join(__dirname, "..", "..", "..", "frontend", "static", "cache");
|
|
23
|
-
await fsp.mkdir(cacheDir, { recursive: true });
|
|
24
|
-
const outputPath = path.join(cacheDir, name);
|
|
25
|
-
try {
|
|
26
|
-
await fsp.access(outputPath);
|
|
27
|
-
return res.sendFile(path.basename(outputPath), {
|
|
28
|
-
root: path.dirname(outputPath),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// not cached → continue
|
|
33
|
-
}
|
|
34
|
-
const assetsDir = path.resolve(__dirname, '..', '..', '..', "frontend", "assets");
|
|
35
|
-
const files = await fsp.readdir(assetsDir);
|
|
36
|
-
const sourceFile = files.find((file) => {
|
|
37
|
-
const parsed = path.parse(file);
|
|
38
|
-
return parsed.name === baseName;
|
|
39
|
-
});
|
|
40
|
-
if (!sourceFile) {
|
|
41
|
-
return res.status(404).json({ error: "Source image not found" });
|
|
42
|
-
}
|
|
43
|
-
const inputPath = path.join(assetsDir, sourceFile);
|
|
44
|
-
await generateWebP(inputPath, outputPath, width, height);
|
|
45
|
-
return res.sendFile(path.basename(outputPath), {
|
|
46
|
-
root: path.dirname(outputPath),
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
console.error(err);
|
|
51
|
-
return res.status(500).json({ error: "Image optimisation failed" });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=imageOptimiser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageOptimiser.js","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/imageOptimiser.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,YAAY,MAAM,4BAA4B,CAAC;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAG3C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAY,EA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;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"saveTemplate.d.ts","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/saveTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAWjD,wBAAsB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,+CA8B7D"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import fsp from "fs/promises";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = path.dirname(__filename);
|
|
6
|
-
const frontendDir = path.resolve(__dirname, "..", "..", "..", "frontend");
|
|
7
|
-
const templateDir = path.join(frontendDir, "template");
|
|
8
|
-
export async function saveTemplate(req, res) {
|
|
9
|
-
try {
|
|
10
|
-
const { path: reqPath } = req.body; // ✅ renamed
|
|
11
|
-
const name = reqPath;
|
|
12
|
-
const sourceFile = path.join(frontendDir, 'views', `${name}.ejs`);
|
|
13
|
-
const sourceFileContent = await fsp.readFile(sourceFile, "utf-8");
|
|
14
|
-
const targetFileContent = replaceLastOccurrence(sourceFileContent, `/static/pages/pages.${name}.js`, "");
|
|
15
|
-
// ✅ ensure directory exists
|
|
16
|
-
await fsp.mkdir(templateDir, { recursive: true });
|
|
17
|
-
await fsp.writeFile(path.join(templateDir, `template.${name}.ejs`), targetFileContent, "utf-8");
|
|
18
|
-
return res.json({ message: "Template Saved Successfully" });
|
|
19
|
-
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
console.error(err);
|
|
22
|
-
return res.status(500).json({ message: "Something went wrong" });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function replaceLastOccurrence(content, searchPattern, replacementLine) {
|
|
26
|
-
const lines = content.split("\n");
|
|
27
|
-
for (let i = lines.length - 1; i >= 0; i--) {
|
|
28
|
-
if (lines[i].includes(searchPattern)) {
|
|
29
|
-
lines[i] = replacementLine; // ✅ replace cleanly
|
|
30
|
-
return lines.join("\n"); // ✅ return result
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
console.warn(`Pattern not found: ${searchPattern}`);
|
|
34
|
-
return content; // fallback
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=saveTemplate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"saveTemplate.js","sourceRoot":"","sources":["../../../../src/backend/controllers/gardener/saveTemplate.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE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AK,CAAC,IAAI,CAAC,CAAC;IAElC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YACtC,KAAK,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,oBAAoB;YAChD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAI,kBAAkB;QAChD,CAAC;IACH,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,sBAAsB,aAAa,EAAE,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC,CAAC,WAAW;AAC7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateWebp.d.ts","sourceRoot":"","sources":["../../../src/backend/libs/generateWebp.ts"],"names":[],"mappings":"AAIA,wBAA8B,YAAY,CACxC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fsp from "fs/promises";
|
|
3
|
-
import sharp from "sharp";
|
|
4
|
-
export default async function generateWebP(inputPath, outputPath, width, height) {
|
|
5
|
-
const cacheDir = path.dirname(outputPath);
|
|
6
|
-
await fsp.mkdir(cacheDir, { recursive: true });
|
|
7
|
-
await sharp(inputPath)
|
|
8
|
-
.resize(width, height, {
|
|
9
|
-
fit: "inside",
|
|
10
|
-
withoutEnlargement: true,
|
|
11
|
-
})
|
|
12
|
-
.webp({ quality: 100 })
|
|
13
|
-
.toFile(outputPath);
|
|
14
|
-
console.log("✅ Image successfully generated");
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=generateWebp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateWebp.js","sourceRoot":"","sources":["../../../src/backend/libs/generateWebp.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,YAAY,CACxC,SAAiB,EACjB,UAAkB,EAClB,KAAa,EACb,MAAc;IAEd,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1C,MAAM,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAG/C,MAAM,KAAK,CAAC,SAAS,CAAC;SACnB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE;QACrB,GAAG,EAAE,QAAQ;QACb,kBAAkB,EAAE,IAAI;KACzB,CAAC;SACD,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;SACtB,MAAM,CAAC,UAAU,CAAC,CAAC;IAEtB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gardener.route.d.ts","sourceRoot":"","sources":["../../../src/backend/routes/gardener.route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,QAAA,MAAM,MAAM,EAAE,MAAiB,CAAC;AAChC,eAAe,MAAM,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Router } from "express";
|
|
2
|
-
import { addComponent, addPage, createStatic, imageOptimiser, saveTemplate } from "../controllers/gardener/index.js";
|
|
3
|
-
const router = Router();
|
|
4
|
-
export default router;
|
|
5
|
-
router.route("/static/cache/:name").get(imageOptimiser);
|
|
6
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
-
router.route("/createstatic").get(createStatic);
|
|
8
|
-
router.route('/addcomponent').post(addComponent);
|
|
9
|
-
router.route('/addpage').post(addPage);
|
|
10
|
-
router.route('/savetemplate').post(saveTemplate);
|
|
11
|
-
}
|
|
12
|
-
router.route('/').get((req, res) => res.render('_', { fileName: '_' }));
|
|
13
|
-
router.route("/new").get((req, res) => res.render("_new", { fileName: "_new" }));
|
|
14
|
-
router.route("/new").get((req, res) => res.render("_new", { fileName: "_new" }));
|
|
15
|
-
router.route("/about").get((req, res) => res.render("_about", { fileName: "_about" }));
|
|
16
|
-
router.route("/ritish").get((req, res) => res.render("_ritish", { fileName: "_ritish" }));
|
|
17
|
-
router.route("/kartik").get((req, res) => res.render("_kartik", { fileName: "_kartik" }));
|
|
18
|
-
//# sourceMappingURL=gardener.route.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gardener.route.js","sourceRoot":"","sources":["../../../src/backend/routes/gardener.route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErH,MAAM,MAAM,GAAW,MAAM,EAAE,CAAC;AAChC,eAAe,MAAM,CAAC;AAKtB,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAExD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC1C,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,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,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/backend/server.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// server.ts
|
|
2
|
-
import 'dotenv/config';
|
|
3
|
-
import express from 'express';
|
|
4
|
-
import frontendRoute from './routes/gardener.route.js';
|
|
5
|
-
import path from "path";
|
|
6
|
-
const app = express();
|
|
7
|
-
import { fileURLToPath } from "url";
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
const staticFiles = path.resolve(__dirname, '..', 'frontend');
|
|
11
|
-
app.set('views', path.join(staticFiles, 'views'));
|
|
12
|
-
app.set("view engine", "ejs");
|
|
13
|
-
app.use(express.static(staticFiles));
|
|
14
|
-
app.use(express.json());
|
|
15
|
-
app.use(frontendRoute);
|
|
16
|
-
const PORT = process.env.PORT || 3000;
|
|
17
|
-
app.listen(PORT, () => {
|
|
18
|
-
console.log("server listening 🚀🚀🚀 PORT:", PORT);
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/backend/server.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,OAAO,eAAe,CAAC;AACvB,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,aAAa,MAAM,4BAA4B,CAAA;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;AAE7D,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAClD,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAC9B,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;AACrC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AACxB,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAEvB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AAEtC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IACpB,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC"}
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var j=n("body");function d(e){a(j,i({t:"div",cn:["fixed","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2","w-11/12","max-w-md","bg-white","text-gray-800","shadow-2xl","border-l-8","border-red-600","rounded-r-lg","z-[100]","p-0","overflow-hidden"],children:[{t:"div",cn:["bg-red-50","p-4","flex","items-center","gap-3"],children:[{t:"h2",cn:["text-red-700","font-bold","text-lg","uppercase","tracking-wider"],txt:"\u26A0\uFE0F System Error"}]},{t:"div",cn:["p-6","bg-white"],children:[{t:"p",cn:["font-mono","text-sm","bg-gray-100","p-3","rounded","border","border-gray-200","break-words"],txt:e},{t:"button",cn:["mt-4","w-full","py-2","bg-gray-800","text-white","rounded","hover:bg-black","transition-colors","cursor-pointer"],txt:"Dismiss",events:{click:t=>t.target.closest(".fixed").remove()}}]}]}))}function n(e){let t=document.querySelector(e);return t||console.warn(`Element not found: ${e}`),t}function a(e,t){try{if(typeof e=="string"&&(e=n(e)),!e)throw new Error("Parent element is null or undefined");if(!t)throw new Error("Child element is null or undefined");e.appendChild(t)}catch(r){d(r)}}function O(e,t){try{if(!e)throw new Error("Element type is required");let r=document.createElement(e);return t&&r.classList.add(...t),r}catch(r){return d(r),null}}function $(e,t){if(!e){console.warn("insertText: Element is null or undefined");return}e.textContent=t}function f(e,t){try{if(typeof e=="string"&&(e=n(e)),!e)throw new Error("Original element is null or undefined");if(!t)throw new Error("New element is null or undefined");e.replaceWith(t)}catch(r){d(r)}}function i(e){try{if(!e)throw new Error("DOM configuration is null or undefined");if(e.nodeType===1)return e;if(!e.t)throw new Error("Element type (t) is required in DOM configuration");let t=["svg","path","circle","rect","line","polygon","polyline","g","defs","clipPath","use"].includes(e.t),r;if(t?(r=document.createElementNS("http://www.w3.org/2000/svg",e.t),e.cn&&r.classList.add(...e.cn)):r=O(e.t,e.cn),!r)throw new Error(`Failed to create element: ${e.t}`);e.txt&&$(r,e.txt);let l=new Set(["value","selected","muted","disabled","selectedIndex","volume"]);if(e.attr)for(let[o,c]of Object.entries(e.attr))try{if(t||o.startsWith("data-")||o.startsWith("aria-"))r.setAttribute(o,c);else if(o in r&&!l.has(o))try{r[o]=c===""?!0:c}catch{r.setAttribute(o,c)}else r.setAttribute(o,c)}catch(p){console.warn(`Failed to set attribute ${o}:`,p)}return e.events&&Object.entries(e.events).forEach(([o,c])=>{try{if(typeof c!="function")throw new Error(`Event handler for '${o}' must be a function`);r.addEventListener(o,c)}catch(p){console.warn(`Failed to add event listener ${o}:`,p)}}),e.children&&e.children.forEach(o=>{try{a(r,i(o))}catch(c){console.warn("Failed to append child:",c)}}),r}catch(t){return d(t),null}}var h="prod";var m=n("#main");function w(){document.querySelectorAll("a").forEach(t=>{t.addEventListener("click",r=>{r.preventDefault(),P(t.href)})}),window.addEventListener("pagehide",()=>{setTimeout(()=>{m.style.transform="translateX(0px)",setTimeout(()=>{try{n(".tempnpdiv").remove()}catch{}},200)},200)})}function P(e){a(m,i({t:"div",cn:["tempnpdiv","top-0","left-[100vw]","fixed","h-screen","w-screen"]}));let t=window.innerWidth;console.log(t),m.style.transition=".2s",m.style.transform=`translateX(-${t}px)`,setTimeout(()=>{window.location.href=e},200)}function E(){let e=n(".loader");e.style.transition=".4s",e.style.opacity="0",h!=="dev"?setTimeout(()=>e.remove(),400):e.remove()}E();w();function s(e){console.log("clicked"),f(n(".notification"),L(e))}function L(e){return e?i({t:"div",cn:["notification","fixed","top-[-60px]","left-0","md:left-auto","md:right-[60px]","right-0","z-50","flex","justify-center","min-w-100","px-4","box-border"],children:[{t:"div",cn:["flex","items-center","w-full","max-w-sm","p-4","rounded-2xl","shadow-xl","text-white","backdrop-blur-md","bg-opacity-95",{success:"bg-[#2e7d32]",warning:"bg-[#ed6c02]",failure:"bg-[#d32f2f]"}[e.status]],children:[{t:"div",cn:["flex-1","text-sm","font-medium","tracking-wide"],txt:e.message}]}]}):null}function x(){return i({t:"button",events:{click:()=>{try{navigator.clipboard.writeText(n(".initCommand").innerText),f(".copybtn",x()),s({status:"success",message:"Copied"})}catch{s({status:"failure",message:"Couldn't Copy"})}}},cn:["copybtn","flex","items-center","justify-center","p-2","text-gray-400","hover:text-white","hover:bg-white/10","rounded","transition-all","duration-200","active:scale-95"],children:[{t:"span",cn:["w-5","h-5"],children:[{t:"svg",cn:["icon","icon-tabler","icons-tabler-outline","icon-tabler-clipboard-check"],attr:{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},children:[{t:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{t:"path",attr:{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"}},{t:"path",attr:{d:"M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2"}},{t:"path",attr:{d:"M9 14l2 2l4 -4"}}]}]}]})}var A=n("body");function k(e=!0){if(e){let t=i({t:"form",cn:["addpageform","fixed","left-2/5","bg-gray-200","rounded-lg","block","top-2/5","p-2","flex","flex-col","p-5","gap-2"],events:{submit:async r=>{try{r.preventDefault();let l=new FormData(r.target),o=Object.fromEntries(l.entries()),c=await fetch("/addpage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(p=>p.json());k(!1),window.location.href=`${o.page}`}catch(l){console.log(l)}}},children:[{t:"label",txt:"ENTER PATH FOR NEW PAGE"},{t:"input",attr:{name:"page"},cn:["pathinput"]}]});a(A,t),n(".pathinput").focus()}else n(".addpageform").remove()}var v=i({t:"div",cn:["fixed","bottom-20","right-4","flex","flex-col","gap-2","bg-white","shadow-lg","rounded-xl","p-3","z-50"],children:[{t:"button",cn:["px-4","py-2","bg-blue-500","text-white","rounded-lg","hover:bg-blue-600","transition"],children:[{t:"span",txt:"New Page"}],events:{click:k}},{t:"button",cn:["px-4","py-2","bg-gray-800","text-white","rounded-lg","hover:bg-gray-900","transition"],children:[{t:"span",txt:"Save Template"}],events:{click:async()=>{let t=await(await fetch("/savetemplate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n("#fileName").innerText})})).json();alert(t.message)}}}]}),b=i({t:"div",cn:["fixed","bottom-4","right-4","z-50"],events:{mouseenter:()=>a(b,v),mouseleave:()=>v.remove()},children:[{t:"span",cn:["flex","items-center","justify-center","h-14","w-14","bg-black","text-white","fixed","bottom-22","right-2","rounded-full","shadow-lg","cursor-pointer"],txt:"GR"}]});var D=n("body");var F={hotreload:!1},u,T,y=localStorage.getItem("hotreload");y===null?u=F.hotreload:y==="true"?u=!0:y==="false"&&(u=!1);function g(){let e=u,t=n("#hrcheckbox");localStorage.setItem("hotreload",e),u=!u,e?(t.style.background="#66e666",n(".hrcheckbox").checked=!0,localStorage.setItem("hotreload","true"),T=setTimeout(()=>window.location.reload(),1e3)):(t.style.background="red",n(".hrcheckbox").checked=!1,localStorage.setItem("hotreload","false"),clearTimeout(T))}function C(){return i({t:"p",cn:["bg-gray-200","fixed","bottom-0","z-100","right-0","border-b-1","p-2","rounded-md"],children:[{t:"span",txt:"Press "},{t:"span",cn:["text-green-500","font-bold"],txt:"Alt+h"},{t:"span",txt:" to toggle Hot Reload"},{t:"form",attr:{id:"hrcheckbox"},events:{click:()=>g()},cn:["p-2","bg-red-300"],children:[{t:"label",txt:"Hot Reload "},{t:"input",cn:["hrcheckbox"],attr:{type:"checkbox"}}]}]})}var S=n("body");h==="dev"&&(a(S,b),a(S,C()),g());document.addEventListener("keydown",function(e){e.altKey&&e.key.toLowerCase()==="h"&&(e.preventDefault(),g())});function N(e,t,r){try{typeof e=="string"&&(e=n(e)),e.addEventListener(t,r)}catch(l){d(`addElError: ${l}`)}}N(".copybtn","click",()=>{try{navigator.clipboard.writeText(n(".initCommand").innerText),f(".copybtn",x()),s({status:"success",message:"Copied"})}catch{s({status:"failure",message:"Couldn't Copy"})}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var k=n("body");function l(e){i(k,c({t:"div",cn:["fixed","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2","w-11/12","max-w-md","bg-white","text-gray-800","shadow-2xl","border-l-8","border-red-600","rounded-r-lg","z-[100]","p-0","overflow-hidden"],children:[{t:"div",cn:["bg-red-50","p-4","flex","items-center","gap-3"],children:[{t:"h2",cn:["text-red-700","font-bold","text-lg","uppercase","tracking-wider"],txt:"\u26A0\uFE0F System Error"}]},{t:"div",cn:["p-6","bg-white"],children:[{t:"p",cn:["font-mono","text-sm","bg-gray-100","p-3","rounded","border","border-gray-200","break-words"],txt:e},{t:"button",cn:["mt-4","w-full","py-2","bg-gray-800","text-white","rounded","hover:bg-black","transition-colors","cursor-pointer"],txt:"Dismiss",events:{click:t=>t.target.closest(".fixed").remove()}}]}]}))}function n(e){let t=document.querySelector(e);return t||console.warn(`Element not found: ${e}`),t}function i(e,t){try{if(typeof e=="string"&&(e=n(e)),!e)throw new Error("Parent element is null or undefined");if(!t)throw new Error("Child element is null or undefined");e.appendChild(t)}catch(r){l(r)}}function S(e,t){try{if(!e)throw new Error("Element type is required");let r=document.createElement(e);return t&&r.classList.add(...t),r}catch(r){return l(r),null}}function C(e,t){if(!e){console.warn("insertText: Element is null or undefined");return}e.textContent=t}function c(e){try{if(!e)throw new Error("DOM configuration is null or undefined");if(e.nodeType===1)return e;if(!e.t)throw new Error("Element type (t) is required in DOM configuration");let t=["svg","path","circle","rect","line","polygon","polyline","g","defs","clipPath","use"].includes(e.t),r;if(t?(r=document.createElementNS("http://www.w3.org/2000/svg",e.t),e.cn&&r.classList.add(...e.cn)):r=S(e.t,e.cn),!r)throw new Error(`Failed to create element: ${e.t}`);e.txt&&C(r,e.txt);let p=new Set(["value","selected","muted","disabled","selectedIndex","volume"]);if(e.attr)for(let[o,a]of Object.entries(e.attr))try{if(t||o.startsWith("data-")||o.startsWith("aria-"))r.setAttribute(o,a);else if(o in r&&!p.has(o))try{r[o]=a===""?!0:a}catch{r.setAttribute(o,a)}else r.setAttribute(o,a)}catch(d){console.warn(`Failed to set attribute ${o}:`,d)}return e.events&&Object.entries(e.events).forEach(([o,a])=>{try{if(typeof a!="function")throw new Error(`Event handler for '${o}' must be a function`);r.addEventListener(o,a)}catch(d){console.warn(`Failed to add event listener ${o}:`,d)}}),e.children&&e.children.forEach(o=>{try{i(r,c(o))}catch(a){console.warn("Failed to append child:",a)}}),r}catch(t){return l(t),null}}var f="prod";var u=n("#main");function x(){document.querySelectorAll("a").forEach(t=>{t.addEventListener("click",r=>{r.preventDefault(),N(t.href)})}),window.addEventListener("pagehide",()=>{setTimeout(()=>{u.style.transform="translateX(0px)",setTimeout(()=>{try{n(".tempnpdiv").remove()}catch{}},200)},200)})}function N(e){i(u,c({t:"div",cn:["tempnpdiv","top-0","left-[100vw]","fixed","h-screen","w-screen"]}));let t=window.innerWidth;console.log(t),u.style.transition=".2s",u.style.transform=`translateX(-${t}px)`,setTimeout(()=>{window.location.href=e},200)}function b(){let e=n(".loader");e.style.transition=".4s",e.style.opacity="0",f!=="dev"?setTimeout(()=>e.remove(),400):e.remove()}b();x();var O=n("body");function w(e=!0){if(e){let t=c({t:"form",cn:["addpageform","fixed","left-2/5","bg-gray-200","rounded-lg","block","top-2/5","p-2","flex","flex-col","p-5","gap-2"],events:{submit:async r=>{try{r.preventDefault();let p=new FormData(r.target),o=Object.fromEntries(p.entries()),a=await fetch("/addpage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(d=>d.json());w(!1),window.location.href=`${o.page}`}catch(p){console.log(p)}}},children:[{t:"label",txt:"ENTER PATH FOR NEW PAGE"},{t:"input",attr:{name:"page"},cn:["pathinput"]}]});i(O,t),n(".pathinput").focus()}else n(".addpageform").remove()}var y=c({t:"div",cn:["fixed","bottom-20","right-4","flex","flex-col","gap-2","bg-white","shadow-lg","rounded-xl","p-3","z-50"],children:[{t:"button",cn:["px-4","py-2","bg-blue-500","text-white","rounded-lg","hover:bg-blue-600","transition"],children:[{t:"span",txt:"New Page"}],events:{click:w}},{t:"button",cn:["px-4","py-2","bg-gray-800","text-white","rounded-lg","hover:bg-gray-900","transition"],children:[{t:"span",txt:"Save Template"}],events:{click:async()=>{let t=await(await fetch("/savetemplate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n("#fileName").innerText})})).json();alert(t.message)}}}]}),m=c({t:"div",cn:["fixed","bottom-4","right-4","z-50"],events:{mouseenter:()=>i(m,y),mouseleave:()=>y.remove()},children:[{t:"span",cn:["flex","items-center","justify-center","h-14","w-14","bg-black","text-white","fixed","bottom-22","right-2","rounded-full","shadow-lg","cursor-pointer"],txt:"GR"}]});var _=n("body");var $={hotreload:!1},s,E,g=localStorage.getItem("hotreload");g===null?s=$.hotreload:g==="true"?s=!0:g==="false"&&(s=!1);function h(){let e=s,t=n("#hrcheckbox");localStorage.setItem("hotreload",e),s=!s,e?(t.style.background="#66e666",n(".hrcheckbox").checked=!0,localStorage.setItem("hotreload","true"),E=setTimeout(()=>window.location.reload(),1e3)):(t.style.background="red",n(".hrcheckbox").checked=!1,localStorage.setItem("hotreload","false"),clearTimeout(E))}function v(){return c({t:"p",cn:["bg-gray-200","fixed","bottom-0","z-100","right-0","border-b-1","p-2","rounded-md"],children:[{t:"span",txt:"Press "},{t:"span",cn:["text-green-500","font-bold"],txt:"Alt+h"},{t:"span",txt:" to toggle Hot Reload"},{t:"form",attr:{id:"hrcheckbox"},events:{click:()=>h()},cn:["p-2","bg-red-300"],children:[{t:"label",txt:"Hot Reload "},{t:"input",cn:["hrcheckbox"],attr:{type:"checkbox"}}]}]})}var T=n("body");f==="dev"&&(i(T,m),i(T,v()),h());document.addEventListener("keydown",function(e){e.altKey&&e.key.toLowerCase()==="h"&&(e.preventDefault(),h())});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var k=n("body");function l(e){i(k,c({t:"div",cn:["fixed","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2","w-11/12","max-w-md","bg-white","text-gray-800","shadow-2xl","border-l-8","border-red-600","rounded-r-lg","z-[100]","p-0","overflow-hidden"],children:[{t:"div",cn:["bg-red-50","p-4","flex","items-center","gap-3"],children:[{t:"h2",cn:["text-red-700","font-bold","text-lg","uppercase","tracking-wider"],txt:"\u26A0\uFE0F System Error"}]},{t:"div",cn:["p-6","bg-white"],children:[{t:"p",cn:["font-mono","text-sm","bg-gray-100","p-3","rounded","border","border-gray-200","break-words"],txt:e},{t:"button",cn:["mt-4","w-full","py-2","bg-gray-800","text-white","rounded","hover:bg-black","transition-colors","cursor-pointer"],txt:"Dismiss",events:{click:t=>t.target.closest(".fixed").remove()}}]}]}))}function n(e){let t=document.querySelector(e);return t||console.warn(`Element not found: ${e}`),t}function i(e,t){try{if(typeof e=="string"&&(e=n(e)),!e)throw new Error("Parent element is null or undefined");if(!t)throw new Error("Child element is null or undefined");e.appendChild(t)}catch(r){l(r)}}function S(e,t){try{if(!e)throw new Error("Element type is required");let r=document.createElement(e);return t&&r.classList.add(...t),r}catch(r){return l(r),null}}function C(e,t){if(!e){console.warn("insertText: Element is null or undefined");return}e.textContent=t}function c(e){try{if(!e)throw new Error("DOM configuration is null or undefined");if(e.nodeType===1)return e;if(!e.t)throw new Error("Element type (t) is required in DOM configuration");let t=["svg","path","circle","rect","line","polygon","polyline","g","defs","clipPath","use"].includes(e.t),r;if(t?(r=document.createElementNS("http://www.w3.org/2000/svg",e.t),e.cn&&r.classList.add(...e.cn)):r=S(e.t,e.cn),!r)throw new Error(`Failed to create element: ${e.t}`);e.txt&&C(r,e.txt);let p=new Set(["value","selected","muted","disabled","selectedIndex","volume"]);if(e.attr)for(let[o,a]of Object.entries(e.attr))try{if(t||o.startsWith("data-")||o.startsWith("aria-"))r.setAttribute(o,a);else if(o in r&&!p.has(o))try{r[o]=a===""?!0:a}catch{r.setAttribute(o,a)}else r.setAttribute(o,a)}catch(d){console.warn(`Failed to set attribute ${o}:`,d)}return e.events&&Object.entries(e.events).forEach(([o,a])=>{try{if(typeof a!="function")throw new Error(`Event handler for '${o}' must be a function`);r.addEventListener(o,a)}catch(d){console.warn(`Failed to add event listener ${o}:`,d)}}),e.children&&e.children.forEach(o=>{try{i(r,c(o))}catch(a){console.warn("Failed to append child:",a)}}),r}catch(t){return l(t),null}}var f="prod";var u=n("#main");function x(){document.querySelectorAll("a").forEach(t=>{t.addEventListener("click",r=>{r.preventDefault(),N(t.href)})}),window.addEventListener("pagehide",()=>{setTimeout(()=>{u.style.transform="translateX(0px)",setTimeout(()=>{try{n(".tempnpdiv").remove()}catch{}},200)},200)})}function N(e){i(u,c({t:"div",cn:["tempnpdiv","top-0","left-[100vw]","fixed","h-screen","w-screen"]}));let t=window.innerWidth;console.log(t),u.style.transition=".2s",u.style.transform=`translateX(-${t}px)`,setTimeout(()=>{window.location.href=e},200)}function b(){let e=n(".loader");e.style.transition=".4s",e.style.opacity="0",f!=="dev"?setTimeout(()=>e.remove(),400):e.remove()}b();x();var O=n("body");function w(e=!0){if(e){let t=c({t:"form",cn:["addpageform","fixed","left-2/5","bg-gray-200","rounded-lg","block","top-2/5","p-2","flex","flex-col","p-5","gap-2"],events:{submit:async r=>{try{r.preventDefault();let p=new FormData(r.target),o=Object.fromEntries(p.entries()),a=await fetch("/addpage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(d=>d.json());w(!1),window.location.href=`${o.page}`}catch(p){console.log(p)}}},children:[{t:"label",txt:"ENTER PATH FOR NEW PAGE"},{t:"input",attr:{name:"page"},cn:["pathinput"]}]});i(O,t),n(".pathinput").focus()}else n(".addpageform").remove()}var y=c({t:"div",cn:["fixed","bottom-20","right-4","flex","flex-col","gap-2","bg-white","shadow-lg","rounded-xl","p-3","z-50"],children:[{t:"button",cn:["px-4","py-2","bg-blue-500","text-white","rounded-lg","hover:bg-blue-600","transition"],children:[{t:"span",txt:"New Page"}],events:{click:w}},{t:"button",cn:["px-4","py-2","bg-gray-800","text-white","rounded-lg","hover:bg-gray-900","transition"],children:[{t:"span",txt:"Save Template"}],events:{click:async()=>{let t=await(await fetch("/savetemplate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n("#fileName").innerText})})).json();alert(t.message)}}}]}),m=c({t:"div",cn:["fixed","bottom-4","right-4","z-50"],events:{mouseenter:()=>i(m,y),mouseleave:()=>y.remove()},children:[{t:"span",cn:["flex","items-center","justify-center","h-14","w-14","bg-black","text-white","fixed","bottom-22","right-2","rounded-full","shadow-lg","cursor-pointer"],txt:"GR"}]});var _=n("body");var $={hotreload:!1},s,E,g=localStorage.getItem("hotreload");g===null?s=$.hotreload:g==="true"?s=!0:g==="false"&&(s=!1);function h(){let e=s,t=n("#hrcheckbox");localStorage.setItem("hotreload",e),s=!s,e?(t.style.background="#66e666",n(".hrcheckbox").checked=!0,localStorage.setItem("hotreload","true"),E=setTimeout(()=>window.location.reload(),1e3)):(t.style.background="red",n(".hrcheckbox").checked=!1,localStorage.setItem("hotreload","false"),clearTimeout(E))}function v(){return c({t:"p",cn:["bg-gray-200","fixed","bottom-0","z-100","right-0","border-b-1","p-2","rounded-md"],children:[{t:"span",txt:"Press "},{t:"span",cn:["text-green-500","font-bold"],txt:"Alt+h"},{t:"span",txt:" to toggle Hot Reload"},{t:"form",attr:{id:"hrcheckbox"},events:{click:()=>h()},cn:["p-2","bg-red-300"],children:[{t:"label",txt:"Hot Reload "},{t:"input",cn:["hrcheckbox"],attr:{type:"checkbox"}}]}]})}var T=n("body");f==="dev"&&(i(T,m),i(T,v()),h());document.addEventListener("keydown",function(e){e.altKey&&e.key.toLowerCase()==="h"&&(e.preventDefault(),h())});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var k=n("body");function l(e){i(k,c({t:"div",cn:["fixed","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2","w-11/12","max-w-md","bg-white","text-gray-800","shadow-2xl","border-l-8","border-red-600","rounded-r-lg","z-[100]","p-0","overflow-hidden"],children:[{t:"div",cn:["bg-red-50","p-4","flex","items-center","gap-3"],children:[{t:"h2",cn:["text-red-700","font-bold","text-lg","uppercase","tracking-wider"],txt:"\u26A0\uFE0F System Error"}]},{t:"div",cn:["p-6","bg-white"],children:[{t:"p",cn:["font-mono","text-sm","bg-gray-100","p-3","rounded","border","border-gray-200","break-words"],txt:e},{t:"button",cn:["mt-4","w-full","py-2","bg-gray-800","text-white","rounded","hover:bg-black","transition-colors","cursor-pointer"],txt:"Dismiss",events:{click:t=>t.target.closest(".fixed").remove()}}]}]}))}function n(e){let t=document.querySelector(e);return t||console.warn(`Element not found: ${e}`),t}function i(e,t){try{if(typeof e=="string"&&(e=n(e)),!e)throw new Error("Parent element is null or undefined");if(!t)throw new Error("Child element is null or undefined");e.appendChild(t)}catch(r){l(r)}}function S(e,t){try{if(!e)throw new Error("Element type is required");let r=document.createElement(e);return t&&r.classList.add(...t),r}catch(r){return l(r),null}}function C(e,t){if(!e){console.warn("insertText: Element is null or undefined");return}e.textContent=t}function c(e){try{if(!e)throw new Error("DOM configuration is null or undefined");if(e.nodeType===1)return e;if(!e.t)throw new Error("Element type (t) is required in DOM configuration");let t=["svg","path","circle","rect","line","polygon","polyline","g","defs","clipPath","use"].includes(e.t),r;if(t?(r=document.createElementNS("http://www.w3.org/2000/svg",e.t),e.cn&&r.classList.add(...e.cn)):r=S(e.t,e.cn),!r)throw new Error(`Failed to create element: ${e.t}`);e.txt&&C(r,e.txt);let p=new Set(["value","selected","muted","disabled","selectedIndex","volume"]);if(e.attr)for(let[o,a]of Object.entries(e.attr))try{if(t||o.startsWith("data-")||o.startsWith("aria-"))r.setAttribute(o,a);else if(o in r&&!p.has(o))try{r[o]=a===""?!0:a}catch{r.setAttribute(o,a)}else r.setAttribute(o,a)}catch(d){console.warn(`Failed to set attribute ${o}:`,d)}return e.events&&Object.entries(e.events).forEach(([o,a])=>{try{if(typeof a!="function")throw new Error(`Event handler for '${o}' must be a function`);r.addEventListener(o,a)}catch(d){console.warn(`Failed to add event listener ${o}:`,d)}}),e.children&&e.children.forEach(o=>{try{i(r,c(o))}catch(a){console.warn("Failed to append child:",a)}}),r}catch(t){return l(t),null}}var f="prod";var u=n("#main");function x(){document.querySelectorAll("a").forEach(t=>{t.addEventListener("click",r=>{r.preventDefault(),N(t.href)})}),window.addEventListener("pagehide",()=>{setTimeout(()=>{u.style.transform="translateX(0px)",setTimeout(()=>{try{n(".tempnpdiv").remove()}catch{}},200)},200)})}function N(e){i(u,c({t:"div",cn:["tempnpdiv","top-0","left-[100vw]","fixed","h-screen","w-screen"]}));let t=window.innerWidth;console.log(t),u.style.transition=".2s",u.style.transform=`translateX(-${t}px)`,setTimeout(()=>{window.location.href=e},200)}function b(){let e=n(".loader");e.style.transition=".4s",e.style.opacity="0",f!=="dev"?setTimeout(()=>e.remove(),400):e.remove()}b();x();var O=n("body");function w(e=!0){if(e){let t=c({t:"form",cn:["addpageform","fixed","left-2/5","bg-gray-200","rounded-lg","block","top-2/5","p-2","flex","flex-col","p-5","gap-2"],events:{submit:async r=>{try{r.preventDefault();let p=new FormData(r.target),o=Object.fromEntries(p.entries()),a=await fetch("/addpage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(d=>d.json());w(!1),window.location.href=`${o.page}`}catch(p){console.log(p)}}},children:[{t:"label",txt:"ENTER PATH FOR NEW PAGE"},{t:"input",attr:{name:"page"},cn:["pathinput"]}]});i(O,t),n(".pathinput").focus()}else n(".addpageform").remove()}var y=c({t:"div",cn:["fixed","bottom-20","right-4","flex","flex-col","gap-2","bg-white","shadow-lg","rounded-xl","p-3","z-50"],children:[{t:"button",cn:["px-4","py-2","bg-blue-500","text-white","rounded-lg","hover:bg-blue-600","transition"],children:[{t:"span",txt:"New Page"}],events:{click:w}},{t:"button",cn:["px-4","py-2","bg-gray-800","text-white","rounded-lg","hover:bg-gray-900","transition"],children:[{t:"span",txt:"Save Template"}],events:{click:async()=>{let t=await(await fetch("/savetemplate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n("#fileName").innerText})})).json();alert(t.message)}}}]}),m=c({t:"div",cn:["fixed","bottom-4","right-4","z-50"],events:{mouseenter:()=>i(m,y),mouseleave:()=>y.remove()},children:[{t:"span",cn:["flex","items-center","justify-center","h-14","w-14","bg-black","text-white","fixed","bottom-22","right-2","rounded-full","shadow-lg","cursor-pointer"],txt:"GR"}]});var _=n("body");var $={hotreload:!1},s,E,g=localStorage.getItem("hotreload");g===null?s=$.hotreload:g==="true"?s=!0:g==="false"&&(s=!1);function h(){let e=s,t=n("#hrcheckbox");localStorage.setItem("hotreload",e),s=!s,e?(t.style.background="#66e666",n(".hrcheckbox").checked=!0,localStorage.setItem("hotreload","true"),E=setTimeout(()=>window.location.reload(),1e3)):(t.style.background="red",n(".hrcheckbox").checked=!1,localStorage.setItem("hotreload","false"),clearTimeout(E))}function v(){return c({t:"p",cn:["bg-gray-200","fixed","bottom-0","z-100","right-0","border-b-1","p-2","rounded-md"],children:[{t:"span",txt:"Press "},{t:"span",cn:["text-green-500","font-bold"],txt:"Alt+h"},{t:"span",txt:" to toggle Hot Reload"},{t:"form",attr:{id:"hrcheckbox"},events:{click:()=>h()},cn:["p-2","bg-red-300"],children:[{t:"label",txt:"Hot Reload "},{t:"input",cn:["hrcheckbox"],attr:{type:"checkbox"}}]}]})}var T=n("body");f==="dev"&&(i(T,m),i(T,v()),h());document.addEventListener("keydown",function(e){e.altKey&&e.key.toLowerCase()==="h"&&(e.preventDefault(),h())});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var k=n("body");function l(e){i(k,c({t:"div",cn:["fixed","top-1/2","left-1/2","-translate-x-1/2","-translate-y-1/2","w-11/12","max-w-md","bg-white","text-gray-800","shadow-2xl","border-l-8","border-red-600","rounded-r-lg","z-[100]","p-0","overflow-hidden"],children:[{t:"div",cn:["bg-red-50","p-4","flex","items-center","gap-3"],children:[{t:"h2",cn:["text-red-700","font-bold","text-lg","uppercase","tracking-wider"],txt:"\u26A0\uFE0F System Error"}]},{t:"div",cn:["p-6","bg-white"],children:[{t:"p",cn:["font-mono","text-sm","bg-gray-100","p-3","rounded","border","border-gray-200","break-words"],txt:e},{t:"button",cn:["mt-4","w-full","py-2","bg-gray-800","text-white","rounded","hover:bg-black","transition-colors","cursor-pointer"],txt:"Dismiss",events:{click:t=>t.target.closest(".fixed").remove()}}]}]}))}function n(e){let t=document.querySelector(e);return t||console.warn(`Element not found: ${e}`),t}function i(e,t){try{if(typeof e=="string"&&(e=n(e)),!e)throw new Error("Parent element is null or undefined");if(!t)throw new Error("Child element is null or undefined");e.appendChild(t)}catch(r){l(r)}}function S(e,t){try{if(!e)throw new Error("Element type is required");let r=document.createElement(e);return t&&r.classList.add(...t),r}catch(r){return l(r),null}}function C(e,t){if(!e){console.warn("insertText: Element is null or undefined");return}e.textContent=t}function c(e){try{if(!e)throw new Error("DOM configuration is null or undefined");if(e.nodeType===1)return e;if(!e.t)throw new Error("Element type (t) is required in DOM configuration");let t=["svg","path","circle","rect","line","polygon","polyline","g","defs","clipPath","use"].includes(e.t),r;if(t?(r=document.createElementNS("http://www.w3.org/2000/svg",e.t),e.cn&&r.classList.add(...e.cn)):r=S(e.t,e.cn),!r)throw new Error(`Failed to create element: ${e.t}`);e.txt&&C(r,e.txt);let p=new Set(["value","selected","muted","disabled","selectedIndex","volume"]);if(e.attr)for(let[o,a]of Object.entries(e.attr))try{if(t||o.startsWith("data-")||o.startsWith("aria-"))r.setAttribute(o,a);else if(o in r&&!p.has(o))try{r[o]=a===""?!0:a}catch{r.setAttribute(o,a)}else r.setAttribute(o,a)}catch(d){console.warn(`Failed to set attribute ${o}:`,d)}return e.events&&Object.entries(e.events).forEach(([o,a])=>{try{if(typeof a!="function")throw new Error(`Event handler for '${o}' must be a function`);r.addEventListener(o,a)}catch(d){console.warn(`Failed to add event listener ${o}:`,d)}}),e.children&&e.children.forEach(o=>{try{i(r,c(o))}catch(a){console.warn("Failed to append child:",a)}}),r}catch(t){return l(t),null}}var f="prod";var u=n("#main");function x(){document.querySelectorAll("a").forEach(t=>{t.addEventListener("click",r=>{r.preventDefault(),N(t.href)})}),window.addEventListener("pagehide",()=>{setTimeout(()=>{u.style.transform="translateX(0px)",setTimeout(()=>{try{n(".tempnpdiv").remove()}catch{}},200)},200)})}function N(e){i(u,c({t:"div",cn:["tempnpdiv","top-0","left-[100vw]","fixed","h-screen","w-screen"]}));let t=window.innerWidth;console.log(t),u.style.transition=".2s",u.style.transform=`translateX(-${t}px)`,setTimeout(()=>{window.location.href=e},200)}function b(){let e=n(".loader");e.style.transition=".4s",e.style.opacity="0",f!=="dev"?setTimeout(()=>e.remove(),400):e.remove()}b();x();var O=n("body");function w(e=!0){if(e){let t=c({t:"form",cn:["addpageform","fixed","left-2/5","bg-gray-200","rounded-lg","block","top-2/5","p-2","flex","flex-col","p-5","gap-2"],events:{submit:async r=>{try{r.preventDefault();let p=new FormData(r.target),o=Object.fromEntries(p.entries()),a=await fetch("/addpage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(d=>d.json());w(!1),window.location.href=`${o.page}`}catch(p){console.log(p)}}},children:[{t:"label",txt:"ENTER PATH FOR NEW PAGE"},{t:"input",attr:{name:"page"},cn:["pathinput"]}]});i(O,t),n(".pathinput").focus()}else n(".addpageform").remove()}var y=c({t:"div",cn:["fixed","bottom-20","right-4","flex","flex-col","gap-2","bg-white","shadow-lg","rounded-xl","p-3","z-50"],children:[{t:"button",cn:["px-4","py-2","bg-blue-500","text-white","rounded-lg","hover:bg-blue-600","transition"],children:[{t:"span",txt:"New Page"}],events:{click:w}},{t:"button",cn:["px-4","py-2","bg-gray-800","text-white","rounded-lg","hover:bg-gray-900","transition"],children:[{t:"span",txt:"Save Template"}],events:{click:async()=>{let t=await(await fetch("/savetemplate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n("#fileName").innerText})})).json();alert(t.message)}}}]}),m=c({t:"div",cn:["fixed","bottom-4","right-4","z-50"],events:{mouseenter:()=>i(m,y),mouseleave:()=>y.remove()},children:[{t:"span",cn:["flex","items-center","justify-center","h-14","w-14","bg-black","text-white","fixed","bottom-22","right-2","rounded-full","shadow-lg","cursor-pointer"],txt:"GR"}]});var _=n("body");var $={hotreload:!1},s,E,g=localStorage.getItem("hotreload");g===null?s=$.hotreload:g==="true"?s=!0:g==="false"&&(s=!1);function h(){let e=s,t=n("#hrcheckbox");localStorage.setItem("hotreload",e),s=!s,e?(t.style.background="#66e666",n(".hrcheckbox").checked=!0,localStorage.setItem("hotreload","true"),E=setTimeout(()=>window.location.reload(),1e3)):(t.style.background="red",n(".hrcheckbox").checked=!1,localStorage.setItem("hotreload","false"),clearTimeout(E))}function v(){return c({t:"p",cn:["bg-gray-200","fixed","bottom-0","z-100","right-0","border-b-1","p-2","rounded-md"],children:[{t:"span",txt:"Press "},{t:"span",cn:["text-green-500","font-bold"],txt:"Alt+h"},{t:"span",txt:" to toggle Hot Reload"},{t:"form",attr:{id:"hrcheckbox"},events:{click:()=>h()},cn:["p-2","bg-red-300"],children:[{t:"label",txt:"Hot Reload "},{t:"input",cn:["hrcheckbox"],attr:{type:"checkbox"}}]}]})}var T=n("body");f==="dev"&&(i(T,m),i(T,v()),h());document.addEventListener("keydown",function(e){e.altKey&&e.key.toLowerCase()==="h"&&(e.preventDefault(),h())});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|