@yannosay/sinth 0.0.5 → 0.0.7
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 +40 -9
- package/src/sinth.ts +36 -36
- package/components/Card.sinth +0 -21
- package/components/Navbar.sinth +0 -38
- package/pages/index.sinth +0 -46
- package/prod-test/pages/index.html +0 -38
- package/public/components/Card.html +0 -4
- package/public/components/Navbar.html +0 -4
- package/public/pages/index.html +0 -67
- package/public/test-project/components/Card.html +0 -4
- package/public/test-project/components/Navbar.html +0 -4
- package/public/test-project/pages/index.html +0 -67
- package/sinth.config.json +0 -7
- package/styles/reset.css +0 -3
- package/test-project/components/Card.sinth +0 -21
- package/test-project/components/Navbar.sinth +0 -38
- package/test-project/package.json +0 -13
- package/test-project/pages/index.sinth +0 -46
- package/test-project/sinth.config.json +0 -7
- package/test-project/styles/reset.css +0 -3
package/package.json
CHANGED
|
@@ -1,13 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yannosay/sinth",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "A declarative language that compiles to pure HTML, CSS, and JavaScript.",
|
|
5
|
+
"author": "Yannosay Productions",
|
|
6
|
+
"license": "AGPL-3.0",
|
|
7
|
+
"homepage": "https://sinth.yannosay.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/yannosay/sinth.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"html",
|
|
14
|
+
"css",
|
|
15
|
+
"javascript",
|
|
16
|
+
"compiler",
|
|
17
|
+
"declarative",
|
|
18
|
+
"web",
|
|
19
|
+
"components",
|
|
20
|
+
"scss"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"sinth": "bin/sinth.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"bin/",
|
|
27
|
+
"src/",
|
|
28
|
+
"assets/",
|
|
29
|
+
"tsconfig.json",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"ts-node": "^10.9.0",
|
|
35
|
+
"sass": "^1.70.0"
|
|
36
|
+
},
|
|
8
37
|
"devDependencies": {
|
|
9
|
-
"
|
|
10
|
-
"typescript": "^5.
|
|
11
|
-
|
|
12
|
-
|
|
38
|
+
"@types/node": "^20.0.0",
|
|
39
|
+
"typescript": "^5.3.0"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": "\u003e=18.0.0"
|
|
43
|
+
}
|
|
13
44
|
}
|
package/src/sinth.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Sinth Compiler v0.0.
|
|
2
|
+
// Sinth Compiler v0.0.7 — enum fix, raw-block detection, import resolution, CSS conversion, slot escaping, custom-elements, HTML5 map
|
|
3
3
|
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
import * as path from "path";
|
|
@@ -11,7 +11,7 @@ import * as http from "http";
|
|
|
11
11
|
|
|
12
12
|
interface Loc { file: string; line: number; col: number }
|
|
13
13
|
|
|
14
|
-
// === v0.0.
|
|
14
|
+
// === v0.0.7: Must be plain `enum TT`, NOT `const enum TT` — const enum breaks TT[t] string indexing ===
|
|
15
15
|
enum TT {
|
|
16
16
|
LBRACE, RBRACE, LPAREN, RPAREN, COLON, COMMA, EQUALS, DOT,
|
|
17
17
|
STRING, NUMBER, BOOL_TRUE, BOOL_FALSE, NULL_LIT,
|
|
@@ -20,7 +20,7 @@ enum TT {
|
|
|
20
20
|
KW_IMPORT, KW_AS, KW_CSS,
|
|
21
21
|
KW_COMPONENT, KW_STYLE, KW_SCRIPT,
|
|
22
22
|
KW_GLOBAL, KW_PAGE, KW_LANG,
|
|
23
|
-
// === v0.0.
|
|
23
|
+
// === v0.0.7: KW_CUSTOM_EL and KW_CUSTOM ensured present ===
|
|
24
24
|
KW_CUSTOM_EL,
|
|
25
25
|
KW_CUSTOM,
|
|
26
26
|
EOF,
|
|
@@ -102,7 +102,7 @@ class SinthError extends Error {
|
|
|
102
102
|
return s;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
// === v0.0.
|
|
105
|
+
// === v0.0.7: Attach source line to produce error preview ===
|
|
106
106
|
withSource(lines: string[]): SinthError {
|
|
107
107
|
if (!this.loc || this.sourceLine !== undefined) return this;
|
|
108
108
|
const line = lines[this.loc.line - 1] ?? "";
|
|
@@ -173,7 +173,7 @@ const KEYWORDS: Record<string, TT> = {
|
|
|
173
173
|
"true": TT.BOOL_TRUE,
|
|
174
174
|
"false": TT.BOOL_FALSE,
|
|
175
175
|
"null": TT.NULL_LIT,
|
|
176
|
-
// === v0.0.
|
|
176
|
+
// === v0.0.7: custom-element and custom lexed as hyphenated identifier ===
|
|
177
177
|
"custom-element": TT.KW_CUSTOM_EL,
|
|
178
178
|
"custom": TT.KW_CUSTOM,
|
|
179
179
|
};
|
|
@@ -221,7 +221,7 @@ export class Lexer {
|
|
|
221
221
|
|
|
222
222
|
if (this.isIdentStart(ch)) {
|
|
223
223
|
const tok = this.readIdent(loc);
|
|
224
|
-
// === v0.0.
|
|
224
|
+
// === v0.0.7: Also set rawBlockPending for component, custom-element, custom ===
|
|
225
225
|
if (
|
|
226
226
|
tok.type === TT.KW_STYLE ||
|
|
227
227
|
tok.type === TT.KW_SCRIPT ||
|
|
@@ -386,7 +386,7 @@ export class Lexer {
|
|
|
386
386
|
|
|
387
387
|
private readIdent(loc: Loc): Token {
|
|
388
388
|
let s = "";
|
|
389
|
-
// === v0.0.
|
|
389
|
+
// === v0.0.7: isIdentCont includes '-' so "custom-element" is read as one token ===
|
|
390
390
|
while (this.pos < this.src.length && this.isIdentCont(this.src[this.pos])) {
|
|
391
391
|
s += this.src[this.pos]; this.adv();
|
|
392
392
|
}
|
|
@@ -407,7 +407,7 @@ export class Lexer {
|
|
|
407
407
|
private loc(): Loc { return { file: this.file, line: this.line, col: this.col }; }
|
|
408
408
|
private isDigit(c: string) { return c >= "0" && c <= "9"; }
|
|
409
409
|
private isIdentStart(c: string) { return /[a-zA-Z_\u00C0-\uFFFF]/.test(c); }
|
|
410
|
-
// === v0.0.
|
|
410
|
+
// === v0.0.7: '-' allowed in identifiers so "custom-element" is a single token ===
|
|
411
411
|
private isIdentCont(c: string) { return /[a-zA-Z0-9_\-\u00C0-\uFFFF]/.test(c); }
|
|
412
412
|
}
|
|
413
413
|
|
|
@@ -503,14 +503,14 @@ export class Parser {
|
|
|
503
503
|
const loc = this.consume(TT.KW_COMPONENT).loc;
|
|
504
504
|
const name = this.consume(TT.IDENT).value;
|
|
505
505
|
const params = this.parseParamDecls();
|
|
506
|
-
// === v0.0.
|
|
506
|
+
// === v0.0.7: rawBlockPending was set by the lexer when KW_COMPONENT was read;
|
|
507
507
|
// the next token is therefore RAW_BLOCK, not LBRACE ===
|
|
508
508
|
const rawTok = this.consume(TT.RAW_BLOCK);
|
|
509
509
|
const { body, styles, scripts } = this.parseCompBody(rawTok.value, rawTok.loc);
|
|
510
510
|
return { name, params, body, styles, scripts, loc };
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
// === v0.0.
|
|
513
|
+
// === v0.0.7: Parse custom-element / custom declarations ===
|
|
514
514
|
private parseCustomEl(): CustomElDecl {
|
|
515
515
|
const loc = this.peek().loc;
|
|
516
516
|
if (this.check(TT.KW_CUSTOM_EL)) this.consume(TT.KW_CUSTOM_EL);
|
|
@@ -690,7 +690,7 @@ interface ResolvedImports {
|
|
|
690
690
|
// Module-level import stack for circular detection
|
|
691
691
|
const IMPORT_STACK: string[] = [];
|
|
692
692
|
|
|
693
|
-
// === v0.0.
|
|
693
|
+
// === v0.0.7: parseFile catches errors and attaches source line preview ===
|
|
694
694
|
function parseFile(filePath: string): SinthFile {
|
|
695
695
|
if (!fs.existsSync(filePath)) throw new SinthError(`File not found: ${filePath}`);
|
|
696
696
|
const src = fs.readFileSync(filePath, "utf-8");
|
|
@@ -744,7 +744,7 @@ function resolveImports(
|
|
|
744
744
|
const src = resolveLibrary(imp.name, cfg);
|
|
745
745
|
jsLinks.push({ src, attrs: {} });
|
|
746
746
|
|
|
747
|
-
// === v0.0.
|
|
747
|
+
// === v0.0.7: Auto-import companion .sinth for JS libraries (e.g. sinthui.sinth) ===
|
|
748
748
|
for (const libDir of cfg.libraryPaths) {
|
|
749
749
|
const companion = path.join(libDir, imp.name + ".sinth");
|
|
750
750
|
if (fs.existsSync(companion) && !visited.has(companion)) {
|
|
@@ -802,7 +802,7 @@ function resolveLibrary(name: string, cfg: ResolverConfig): string {
|
|
|
802
802
|
return `/libraries/${base}`;
|
|
803
803
|
}
|
|
804
804
|
|
|
805
|
-
// === v0.0.
|
|
805
|
+
// === v0.0.7: resolveSinthPath — first try relative to importing file, then library paths ===
|
|
806
806
|
function resolveSinthPath(p: string, fromFile: string, cfg: ResolverConfig): string {
|
|
807
807
|
// Explicit relative path
|
|
808
808
|
if (p.startsWith("./") || p.startsWith("../")) {
|
|
@@ -813,7 +813,7 @@ function resolveSinthPath(p: string, fromFile: string, cfg: ResolverConfig): str
|
|
|
813
813
|
throw new SinthError(`Cannot resolve import '${p}' from '${fromFile}'`);
|
|
814
814
|
}
|
|
815
815
|
|
|
816
|
-
// === v0.0.
|
|
816
|
+
// === v0.0.7: Non-relative paths (e.g. "components/Card.sinth"): try relative to importing
|
|
817
817
|
// file's directory FIRST, then fall back to library paths ===
|
|
818
818
|
const relToFile = path.resolve(path.dirname(fromFile), p);
|
|
819
819
|
if (fs.existsSync(relToFile)) return relToFile;
|
|
@@ -839,7 +839,7 @@ function resolveSinthPath(p: string, fromFile: string, cfg: ResolverConfig): str
|
|
|
839
839
|
|
|
840
840
|
interface BuiltinInfo { tag: string; defaultClass?: string; voidEl?: boolean }
|
|
841
841
|
|
|
842
|
-
// === v0.0.
|
|
842
|
+
// === v0.0.7: Complete HTML5 map; Col = void <col>; Column = grid div; added SubHeading, CardGrid ===
|
|
843
843
|
const BUILTIN_MAP: Record<string, BuiltinInfo> = {
|
|
844
844
|
// ── Structural ──────────────────────────────────────────
|
|
845
845
|
Main: { tag: "main" },
|
|
@@ -857,12 +857,12 @@ const BUILTIN_MAP: Record<string, BuiltinInfo> = {
|
|
|
857
857
|
Flex: { tag: "div", defaultClass: "flex" },
|
|
858
858
|
Stack: { tag: "div", defaultClass: "stack" },
|
|
859
859
|
Row: { tag: "div", defaultClass: "row" },
|
|
860
|
-
// === v0.0.
|
|
860
|
+
// === v0.0.7: Column = grid helper div; Col = HTML void table col ===
|
|
861
861
|
Column: { tag: "div", defaultClass: "col" },
|
|
862
862
|
// ── Typography ────────────────────────────────────────────
|
|
863
863
|
Heading: { tag: "h1" }, // resolved dynamically by level attr
|
|
864
864
|
Paragraph: { tag: "p" },
|
|
865
|
-
// === v0.0.
|
|
865
|
+
// === v0.0.7: SubHeading convenience component ===
|
|
866
866
|
SubHeading: { tag: "p", defaultClass: "subheading" },
|
|
867
867
|
Lead: { tag: "p", defaultClass: "lead" },
|
|
868
868
|
Small: { tag: "small" },
|
|
@@ -929,7 +929,7 @@ const BUILTIN_MAP: Record<string, BuiltinInfo> = {
|
|
|
929
929
|
Wbr: { tag: "wbr", voidEl: true },
|
|
930
930
|
Source: { tag: "source", voidEl: true },
|
|
931
931
|
Embed: { tag: "embed", voidEl: true },
|
|
932
|
-
// === v0.0.
|
|
932
|
+
// === v0.0.7: Col = HTML void table column (NOT the grid div) ===
|
|
933
933
|
Col: { tag: "col", voidEl: true },
|
|
934
934
|
Area: { tag: "area", voidEl: true },
|
|
935
935
|
// ── Lists ─────────────────────────────────────────────────
|
|
@@ -949,9 +949,9 @@ const BUILTIN_MAP: Record<string, BuiltinInfo> = {
|
|
|
949
949
|
Template: { tag: "template" },
|
|
950
950
|
Slot: { tag: "slot" },
|
|
951
951
|
NoScript: { tag: "noscript" },
|
|
952
|
-
// === v0.0.
|
|
952
|
+
// === v0.0.7: CardGrid convenience layout wrapper ===
|
|
953
953
|
CardGrid: { tag: "div", defaultClass: "card-grid" },
|
|
954
|
-
// === v0.0.
|
|
954
|
+
// === v0.0.7: RawHTML marker — handled specially in renderCompUse ===
|
|
955
955
|
RawHTML: { tag: "__RAW__" },
|
|
956
956
|
};
|
|
957
957
|
|
|
@@ -970,7 +970,7 @@ function eventAttrName(name: string): string | null {
|
|
|
970
970
|
// SECTION 7: STYLE PROCESSOR
|
|
971
971
|
// ═══════════════════════════════════════════════════════════
|
|
972
972
|
|
|
973
|
-
// === v0.0.
|
|
973
|
+
// === v0.0.7: Completely rewritten convertCSSProps — bulletproof line-by-line approach ===
|
|
974
974
|
// Rules:
|
|
975
975
|
// - Match lines of the form: [whitespace] camelCaseProp : "value" [;]
|
|
976
976
|
// - Convert property name camelCase → kebab-case
|
|
@@ -1022,7 +1022,7 @@ function convertCSSProps(css: string): string {
|
|
|
1022
1022
|
}).join("\n");
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
|
-
// === v0.0.
|
|
1025
|
+
// === v0.0.7: processStyleBlock — correct order: interpolate {param} → camelCase convert → SCSS → scope ===
|
|
1026
1026
|
function processStyleBlock(
|
|
1027
1027
|
block: StyleBlock,
|
|
1028
1028
|
hash: string,
|
|
@@ -1208,7 +1208,7 @@ function renderAttr(attr: Attr, paramMap: Map<string, string>): string {
|
|
|
1208
1208
|
return `${name}="${escAttr(raw)}"`;
|
|
1209
1209
|
}
|
|
1210
1210
|
|
|
1211
|
-
// === v0.0.
|
|
1211
|
+
// === v0.0.7: renderText — "$slot" protected from double-escaping via placeholder approach ===
|
|
1212
1212
|
function renderText(text: string, params: Map<string, string>): string {
|
|
1213
1213
|
// Map of placeholder → raw HTML for slot-like params
|
|
1214
1214
|
const rawSlots = new Map<string, string>();
|
|
@@ -1246,7 +1246,7 @@ function renderText(text: string, params: Map<string, string>): string {
|
|
|
1246
1246
|
// Step 5: Restore \$ → $
|
|
1247
1247
|
s = s.replace(/\x00DOLLAR\x00/g, "$");
|
|
1248
1248
|
|
|
1249
|
-
// === v0.0.
|
|
1249
|
+
// === v0.0.7: Warn about {identifier} patterns remaining after substitution ===
|
|
1250
1250
|
const braceRe = /\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g;
|
|
1251
1251
|
let m: RegExpExecArray | null;
|
|
1252
1252
|
while ((m = braceRe.exec(s)) !== null) {
|
|
@@ -1282,7 +1282,7 @@ function renderCompUse(
|
|
|
1282
1282
|
params: Map<string, string>,
|
|
1283
1283
|
depth: number,
|
|
1284
1284
|
): string {
|
|
1285
|
-
// === v0.0.
|
|
1285
|
+
// === v0.0.7: RawHTML — output content attribute verbatim, no wrapping tag, no scoping ===
|
|
1286
1286
|
if (use.name === "RawHTML") {
|
|
1287
1287
|
const ca = use.attrs.find(a => a.name === "content");
|
|
1288
1288
|
if (!ca || !ca.value) return "";
|
|
@@ -1327,7 +1327,7 @@ function renderCompUse(
|
|
|
1327
1327
|
const classes = [defaultClass, userClass].filter(Boolean).join(" ");
|
|
1328
1328
|
if (classes) attrParts.push(`class="${escAttr(classes)}"`);
|
|
1329
1329
|
|
|
1330
|
-
// === v0.0.
|
|
1330
|
+
// === v0.0.7: Default type="button" for <button> elements ===
|
|
1331
1331
|
if (tag === "button" && !use.attrs.some(a => a.name === "type")) {
|
|
1332
1332
|
attrParts.push(`type="button"`);
|
|
1333
1333
|
}
|
|
@@ -1389,7 +1389,7 @@ function expandUserComp(
|
|
|
1389
1389
|
const slotHTML = use.children.map(c => renderChild(c, ctx, params, depth)).join("");
|
|
1390
1390
|
local.set("slot", slotHTML);
|
|
1391
1391
|
|
|
1392
|
-
// === v0.0.
|
|
1392
|
+
// === v0.0.7: Process component style blocks with instance params and push to extraCSS ===
|
|
1393
1393
|
for (const block of def.styles) {
|
|
1394
1394
|
ctx.extraCSS.push(processStyleBlock(block, ctx.scopeHash, local));
|
|
1395
1395
|
}
|
|
@@ -1490,7 +1490,7 @@ function buildHeadData(meta: MetaEntry[]): HeadData {
|
|
|
1490
1490
|
return { title, fav, lang, charset, viewport, metaTags, metaProps };
|
|
1491
1491
|
}
|
|
1492
1492
|
|
|
1493
|
-
// === v0.0.
|
|
1493
|
+
// === v0.0.7: .jpg and .jpeg return "image/jpeg" ===
|
|
1494
1494
|
function faviconType(p: string): string {
|
|
1495
1495
|
const ext = path.extname(p).toLowerCase();
|
|
1496
1496
|
switch (ext) {
|
|
@@ -1553,7 +1553,7 @@ function compileFile(filePath: string, opts: CompileOptions): string | null {
|
|
|
1553
1553
|
const { allDefs, customEls, cssLinks, jsLinks } = resolveImports(file, cfg);
|
|
1554
1554
|
const hash = fnv1a(absPath);
|
|
1555
1555
|
|
|
1556
|
-
// === v0.0.
|
|
1556
|
+
// === v0.0.7: extraCSS collected during rendering (per-instance component styles) ===
|
|
1557
1557
|
const ctx: CompileCtx = {
|
|
1558
1558
|
allDefs, customEls, cssLinks, jsLinks,
|
|
1559
1559
|
scopeHash: hash, pageFile: absPath, extraCSS: [],
|
|
@@ -1624,7 +1624,7 @@ function minifyHTML(html: string): string {
|
|
|
1624
1624
|
// SECTION 12: FILE DISCOVERY & ASSET COPY
|
|
1625
1625
|
// ═══════════════════════════════════════════════════════════
|
|
1626
1626
|
|
|
1627
|
-
// === v0.0.
|
|
1627
|
+
// === v0.0.7: findSinthPages skips outDir to prevent infinite watcher loops ===
|
|
1628
1628
|
function findSinthPages(dir: string, outDir?: string): string[] {
|
|
1629
1629
|
const results: string[] = [];
|
|
1630
1630
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
@@ -1640,7 +1640,7 @@ function findSinthPages(dir: string, outDir?: string): string[] {
|
|
|
1640
1640
|
return results;
|
|
1641
1641
|
}
|
|
1642
1642
|
|
|
1643
|
-
// === v0.0.
|
|
1643
|
+
// === v0.0.7: Recursive directory copy for assets/ ===
|
|
1644
1644
|
function copyDir(src: string, dest: string): void {
|
|
1645
1645
|
if (!fs.existsSync(src)) return;
|
|
1646
1646
|
fs.mkdirSync(dest, { recursive: true });
|
|
@@ -1699,7 +1699,7 @@ async function startDevServer(opts: CompileOptions & { port: number, files?: str
|
|
|
1699
1699
|
|
|
1700
1700
|
compileAll();
|
|
1701
1701
|
|
|
1702
|
-
// === v0.0.
|
|
1702
|
+
// === v0.0.7: Watch ignores changes whose absolute path is inside outDir ===
|
|
1703
1703
|
const resolvedOut = path.resolve(opts.outDir);
|
|
1704
1704
|
// Use fs.watch with fs.watchFile fallback for Windows reliability
|
|
1705
1705
|
let watchReady = false;
|
|
@@ -1861,7 +1861,7 @@ async function main(): Promise<void> {
|
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
1863
|
|
|
1864
|
-
// === v0.0.
|
|
1864
|
+
// === v0.0.7: Copy assets/ to outDir/assets/ ===
|
|
1865
1865
|
const assetsIn = path.join(cwd, "assets");
|
|
1866
1866
|
const assetsOut = path.join(outDir, "assets");
|
|
1867
1867
|
if (fs.existsSync(assetsIn)) {
|
|
@@ -1900,11 +1900,11 @@ async function main(): Promise<void> {
|
|
|
1900
1900
|
break;
|
|
1901
1901
|
}
|
|
1902
1902
|
|
|
1903
|
-
// === v0.0.
|
|
1903
|
+
// === v0.0.7: sinth version command ===
|
|
1904
1904
|
case "version":
|
|
1905
1905
|
case "--version":
|
|
1906
1906
|
case "-v": {
|
|
1907
|
-
process.stdout.write("Sinth Compiler v0.0.
|
|
1907
|
+
process.stdout.write("Sinth Compiler v0.0.7\n");
|
|
1908
1908
|
break;
|
|
1909
1909
|
}
|
|
1910
1910
|
|
|
@@ -1917,7 +1917,7 @@ async function main(): Promise<void> {
|
|
|
1917
1917
|
|
|
1918
1918
|
default: {
|
|
1919
1919
|
process.stdout.write(`
|
|
1920
|
-
\x1b[1mSinth Compiler v0.0.
|
|
1920
|
+
\x1b[1mSinth Compiler v0.0.7\x1b[0m
|
|
1921
1921
|
|
|
1922
1922
|
\x1b[1mCommands:\x1b[0m
|
|
1923
1923
|
sinth build [--out ./dist] [--prod] Compile all .sinth pages + copy assets/
|
package/components/Card.sinth
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
-- Card component
|
|
2
|
-
|
|
3
|
-
component Card(title, color = "blue") {
|
|
4
|
-
Div(class: "card") {
|
|
5
|
-
Heading(level: 2) { "$title" }
|
|
6
|
-
Div(class: "card-body") { "$slot" }
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
style {
|
|
10
|
-
.card {
|
|
11
|
-
backgroundColor: "#f7f7f7"
|
|
12
|
-
borderRadius: "1rem"
|
|
13
|
-
padding: "1.5rem"
|
|
14
|
-
textAlign: "center"
|
|
15
|
-
marginBottom: "1rem"
|
|
16
|
-
}
|
|
17
|
-
.card-body {
|
|
18
|
-
marginTop: "0.75rem"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
package/components/Navbar.sinth
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
-- Navbar component
|
|
2
|
-
|
|
3
|
-
component Navbar {
|
|
4
|
-
Header {
|
|
5
|
-
Nav {
|
|
6
|
-
Link(href: "/", class: "logo") { "MySite" }
|
|
7
|
-
Div(class: "nav-links") {
|
|
8
|
-
NavLink(href: "/") { "Home" }
|
|
9
|
-
NavLink(href: "/about") { "About" }
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
style {
|
|
15
|
-
Header {
|
|
16
|
-
display: "flex"
|
|
17
|
-
alignItems: "center"
|
|
18
|
-
padding: "1rem 2rem"
|
|
19
|
-
backgroundColor: "#1a1a2e"
|
|
20
|
-
color: "white"
|
|
21
|
-
}
|
|
22
|
-
.logo {
|
|
23
|
-
fontSize: "1.5rem"
|
|
24
|
-
fontWeight: "700"
|
|
25
|
-
color: "white"
|
|
26
|
-
textDecoration: "none"
|
|
27
|
-
}
|
|
28
|
-
.nav-links {
|
|
29
|
-
marginLeft: "auto"
|
|
30
|
-
display: "flex"
|
|
31
|
-
gap: "1.5rem"
|
|
32
|
-
}
|
|
33
|
-
.nav-links a {
|
|
34
|
-
color: "rgba(255,255,255,0.8)"
|
|
35
|
-
textDecoration: "none"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
package/pages/index.sinth
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
-- My Sinth Site
|
|
2
|
-
|
|
3
|
-
page
|
|
4
|
-
|
|
5
|
-
import "../components/Navbar.sinth"
|
|
6
|
-
import css "../styles/reset.css"
|
|
7
|
-
|
|
8
|
-
title = "My Site"
|
|
9
|
-
fav = "assets/favicon.ico"
|
|
10
|
-
descr = "Built with Sinth."
|
|
11
|
-
|
|
12
|
-
Navbar
|
|
13
|
-
|
|
14
|
-
Hero {
|
|
15
|
-
Heading(level: 1) { "Welcome to Sinth" }
|
|
16
|
-
Paragraph { "A declarative, component-based web UI language." }
|
|
17
|
-
Button(onClick: "handleCTA") { "Get Stssssssssssssssarted" }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
Main {
|
|
21
|
-
Section {
|
|
22
|
-
Heading(level: 2) { "Features" }
|
|
23
|
-
CardGrid {
|
|
24
|
-
-- Add cards here
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
style {
|
|
30
|
-
Hero {
|
|
31
|
-
padding: "4rem 2rem"
|
|
32
|
-
textAlign: "center"
|
|
33
|
-
backgroundColor: "#f0f4ff"
|
|
34
|
-
}
|
|
35
|
-
Main {
|
|
36
|
-
maxWidth: "1100px"
|
|
37
|
-
margin: "0 auto"
|
|
38
|
-
padding: "2rem"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
script {
|
|
43
|
-
function handleCTA() {
|
|
44
|
-
alert("Hello from Sinth!")
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>My Site</title><link rel="icon" href="assets/favicon.ico" type="image/x-icon"><meta name="description" content="Built with Sinth."><link rel="stylesheet" href="../styles/reset.css"><style>
|
|
2
|
-
[data-s="931b8d90"] Hero, Hero[data-s="931b8d90"] {
|
|
3
|
-
padding: 4rem 2rem;
|
|
4
|
-
text-align: center;
|
|
5
|
-
background-color: #f0f4ff;
|
|
6
|
-
}
|
|
7
|
-
[data-s="931b8d90"] Main, Main[data-s="931b8d90"] {
|
|
8
|
-
max-width: 1100px;
|
|
9
|
-
margin: 0 auto;
|
|
10
|
-
padding: 2rem;
|
|
11
|
-
}
|
|
12
|
-
[data-s="931b8d90"] Header, Header[data-s="931b8d90"] {
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
padding: 1rem 2rem;
|
|
16
|
-
background-color: #1a1a2e;
|
|
17
|
-
color: white;
|
|
18
|
-
}
|
|
19
|
-
[data-s="931b8d90"] .logo, .logo[data-s="931b8d90"] {
|
|
20
|
-
font-size: 1.5rem;
|
|
21
|
-
font-weight: 700;
|
|
22
|
-
color: white;
|
|
23
|
-
text-decoration: none;
|
|
24
|
-
}
|
|
25
|
-
[data-s="931b8d90"] .nav-links, .nav-links[data-s="931b8d90"] {
|
|
26
|
-
margin-left: auto;
|
|
27
|
-
display: flex;
|
|
28
|
-
gap: 1.5rem;
|
|
29
|
-
}
|
|
30
|
-
[data-s="931b8d90"] .nav-links a, .nav-links a[data-s="931b8d90"] {
|
|
31
|
-
color: rgba(255,255,255,0.8);
|
|
32
|
-
text-decoration: none;
|
|
33
|
-
}
|
|
34
|
-
</style></head><body data-s="931b8d90"><header data-s="931b8d90"><nav data-s="931b8d90"><a data-s="931b8d90" href="/" class="logo">MySite</a><div data-s="931b8d90" class="nav-links"><a data-s="931b8d90" href="/">Home</a><a data-s="931b8d90" href="/about">About</a></div></nav></header><section data-s="931b8d90" class="hero"><h1 data-s="931b8d90">Welcome to Sinth</h1><p data-s="931b8d90">A declarative, component-based web UI language.</p><button data-s="931b8d90" onclick="handleCTA(event)" type="button">Get Stssssssssssssssarted</button></section><main data-s="931b8d90"><section data-s="931b8d90"><h2 data-s="931b8d90">Features</h2><div data-s="931b8d90" class="card-grid"></div></section></main><script>
|
|
35
|
-
function handleCTA() {
|
|
36
|
-
alert("Hello from Sinth!")
|
|
37
|
-
}
|
|
38
|
-
</script></body></html>
|
package/public/pages/index.html
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>My Site</title>
|
|
7
|
-
<link rel="icon" href="assets/favicon.ico" type="image/x-icon">
|
|
8
|
-
<meta name="description" content="Built with Sinth.">
|
|
9
|
-
<link rel="stylesheet" href="../styles/reset.css">
|
|
10
|
-
<style>
|
|
11
|
-
|
|
12
|
-
[data-s="931b8d90"] Hero, Hero[data-s="931b8d90"] {
|
|
13
|
-
padding: 4rem 2rem;
|
|
14
|
-
text-align: center;
|
|
15
|
-
background-color: #f0f4ff;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[data-s="931b8d90"] Main, Main[data-s="931b8d90"] {
|
|
19
|
-
max-width: 1100px;
|
|
20
|
-
margin: 0 auto;
|
|
21
|
-
padding: 2rem;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[data-s="931b8d90"] Header, Header[data-s="931b8d90"] {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
padding: 1rem 2rem;
|
|
30
|
-
background-color: #1a1a2e;
|
|
31
|
-
color: white;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[data-s="931b8d90"] .logo, .logo[data-s="931b8d90"] {
|
|
35
|
-
font-size: 1.5rem;
|
|
36
|
-
font-weight: 700;
|
|
37
|
-
color: white;
|
|
38
|
-
text-decoration: none;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
[data-s="931b8d90"] .nav-links, .nav-links[data-s="931b8d90"] {
|
|
42
|
-
margin-left: auto;
|
|
43
|
-
display: flex;
|
|
44
|
-
gap: 1.5rem;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
[data-s="931b8d90"] .nav-links a, .nav-links a[data-s="931b8d90"] {
|
|
48
|
-
color: rgba(255,255,255,0.8);
|
|
49
|
-
text-decoration: none;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</style>
|
|
54
|
-
</head>
|
|
55
|
-
<body data-s="931b8d90">
|
|
56
|
-
<header data-s="931b8d90"><nav data-s="931b8d90"><a data-s="931b8d90" href="/" class="logo">MySite</a><div data-s="931b8d90" class="nav-links"><a data-s="931b8d90" href="/">Home</a><a data-s="931b8d90" href="/about">About</a></div></nav></header>
|
|
57
|
-
<section data-s="931b8d90" class="hero"><h1 data-s="931b8d90">Welcome to Sinth</h1><p data-s="931b8d90">A declarative, component-based web UI language.</p><button data-s="931b8d90" onclick="handleCTA(event)" type="button">Get Stssssssssssssssarted</button></section>
|
|
58
|
-
<main data-s="931b8d90"><section data-s="931b8d90"><h2 data-s="931b8d90">Features</h2><div data-s="931b8d90" class="card-grid"></div></section></main>
|
|
59
|
-
<script>
|
|
60
|
-
|
|
61
|
-
function handleCTA() {
|
|
62
|
-
alert("Hello from Sinth!")
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
</script>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>My Site</title>
|
|
7
|
-
<link rel="icon" href="assets/favicon.ico" type="image/x-icon">
|
|
8
|
-
<meta name="description" content="Built with Sinth.">
|
|
9
|
-
<link rel="stylesheet" href="../styles/reset.css">
|
|
10
|
-
<style>
|
|
11
|
-
|
|
12
|
-
[data-s="8cfc97e4"] Hero, Hero[data-s="8cfc97e4"] {
|
|
13
|
-
padding: 4rem 2rem;
|
|
14
|
-
text-align: center;
|
|
15
|
-
background-color: #f0f4ff;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[data-s="8cfc97e4"] Main, Main[data-s="8cfc97e4"] {
|
|
19
|
-
max-width: 1100px;
|
|
20
|
-
margin: 0 auto;
|
|
21
|
-
padding: 2rem;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[data-s="8cfc97e4"] Header, Header[data-s="8cfc97e4"] {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
padding: 1rem 2rem;
|
|
30
|
-
background-color: #1a1a2e;
|
|
31
|
-
color: white;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[data-s="8cfc97e4"] .logo, .logo[data-s="8cfc97e4"] {
|
|
35
|
-
font-size: 1.5rem;
|
|
36
|
-
font-weight: 700;
|
|
37
|
-
color: white;
|
|
38
|
-
text-decoration: none;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
[data-s="8cfc97e4"] .nav-links, .nav-links[data-s="8cfc97e4"] {
|
|
42
|
-
margin-left: auto;
|
|
43
|
-
display: flex;
|
|
44
|
-
gap: 1.5rem;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
[data-s="8cfc97e4"] .nav-links a, .nav-links a[data-s="8cfc97e4"] {
|
|
48
|
-
color: rgba(255,255,255,0.8);
|
|
49
|
-
text-decoration: none;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</style>
|
|
54
|
-
</head>
|
|
55
|
-
<body data-s="8cfc97e4">
|
|
56
|
-
<header data-s="8cfc97e4"><nav data-s="8cfc97e4"><a data-s="8cfc97e4" href="/" class="logo">MySite</a><div data-s="8cfc97e4" class="nav-links"><a data-s="8cfc97e4" href="/">Home</a><a data-s="8cfc97e4" href="/about">About</a></div></nav></header>
|
|
57
|
-
<section data-s="8cfc97e4" class="hero"><h1 data-s="8cfc97e4">Welcome to Sinth</h1><p data-s="8cfc97e4">A declarative, component-based web UI language.</p><button data-s="8cfc97e4" onclick="handleCTA(event)" type="button">Get Started</button></section>
|
|
58
|
-
<main data-s="8cfc97e4"><section data-s="8cfc97e4"><h2 data-s="8cfc97e4">Features</h2><div data-s="8cfc97e4" class="card-grid"></div></section></main>
|
|
59
|
-
<script>
|
|
60
|
-
|
|
61
|
-
function handleCTA() {
|
|
62
|
-
alert("Hello from Sinth!")
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
</script>
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
package/sinth.config.json
DELETED
package/styles/reset.css
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
-- Card component
|
|
2
|
-
|
|
3
|
-
component Card(title, color = "blue") {
|
|
4
|
-
Div(class: "card") {
|
|
5
|
-
Heading(level: 2) { "$title" }
|
|
6
|
-
Div(class: "card-body") { "$slot" }
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
style {
|
|
10
|
-
.card {
|
|
11
|
-
backgroundColor: "#f7f7f7"
|
|
12
|
-
borderRadius: "1rem"
|
|
13
|
-
padding: "1.5rem"
|
|
14
|
-
textAlign: "center"
|
|
15
|
-
marginBottom: "1rem"
|
|
16
|
-
}
|
|
17
|
-
.card-body {
|
|
18
|
-
marginTop: "0.75rem"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
-- Navbar component
|
|
2
|
-
|
|
3
|
-
component Navbar {
|
|
4
|
-
Header {
|
|
5
|
-
Nav {
|
|
6
|
-
Link(href: "/", class: "logo") { "MySite" }
|
|
7
|
-
Div(class: "nav-links") {
|
|
8
|
-
NavLink(href: "/") { "Home" }
|
|
9
|
-
NavLink(href: "/about") { "About" }
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
style {
|
|
15
|
-
Header {
|
|
16
|
-
display: "flex"
|
|
17
|
-
alignItems: "center"
|
|
18
|
-
padding: "1rem 2rem"
|
|
19
|
-
backgroundColor: "#1a1a2e"
|
|
20
|
-
color: "white"
|
|
21
|
-
}
|
|
22
|
-
.logo {
|
|
23
|
-
fontSize: "1.5rem"
|
|
24
|
-
fontWeight: "700"
|
|
25
|
-
color: "white"
|
|
26
|
-
textDecoration: "none"
|
|
27
|
-
}
|
|
28
|
-
.nav-links {
|
|
29
|
-
marginLeft: "auto"
|
|
30
|
-
display: "flex"
|
|
31
|
-
gap: "1.5rem"
|
|
32
|
-
}
|
|
33
|
-
.nav-links a {
|
|
34
|
-
color: "rgba(255,255,255,0.8)"
|
|
35
|
-
textDecoration: "none"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
-- My Sinth Site
|
|
2
|
-
|
|
3
|
-
page
|
|
4
|
-
|
|
5
|
-
import "../components/Navbar.sinth"
|
|
6
|
-
import css "../styles/reset.css"
|
|
7
|
-
|
|
8
|
-
title = "My Site"
|
|
9
|
-
fav = "assets/favicon.ico"
|
|
10
|
-
descr = "Built with Sinth."
|
|
11
|
-
|
|
12
|
-
Navbar
|
|
13
|
-
|
|
14
|
-
Hero {
|
|
15
|
-
Heading(level: 1) { "Welcome to Sinth" }
|
|
16
|
-
Paragraph { "A declarative, component-based web UI language." }
|
|
17
|
-
Button(onClick: "handleCTA") { "Get Started" }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
Main {
|
|
21
|
-
Section {
|
|
22
|
-
Heading(level: 2) { "Features" }
|
|
23
|
-
CardGrid {
|
|
24
|
-
-- Add cards here
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
style {
|
|
30
|
-
Hero {
|
|
31
|
-
padding: "4rem 2rem"
|
|
32
|
-
textAlign: "center"
|
|
33
|
-
backgroundColor: "#f0f4ff"
|
|
34
|
-
}
|
|
35
|
-
Main {
|
|
36
|
-
maxWidth: "1100px"
|
|
37
|
-
margin: "0 auto"
|
|
38
|
-
padding: "2rem"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
script {
|
|
43
|
-
function handleCTA() {
|
|
44
|
-
alert("Hello from Sinth!")
|
|
45
|
-
}
|
|
46
|
-
}
|