@yannosay/sinth 0.13.0 → 0.13.2
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/README.md +17 -0
- package/package.json +2 -2
- package/src/core/builtins.ts +117 -0
- package/src/core/compiler.ts +118 -911
- package/src/core/expr.ts +6 -2
- package/src/core/head-builder.ts +86 -0
- package/src/core/parser.ts +8 -10
- package/src/core/runtime/functions.ts +33 -0
- package/src/core/runtime/helpers.ts +296 -0
- package/src/core/runtime/render.ts +82 -0
- package/src/core/style-processor.ts +299 -0
- package/src/resolver.ts +1 -1
- package/src/utils.ts +40 -1
package/README.md
CHANGED
|
@@ -148,6 +148,8 @@ Main {
|
|
|
148
148
|
|
|
149
149
|
- Mixed logic — if, for, and expressions right in your UI
|
|
150
150
|
- Two-way binding — Input(bind: variable) in one line
|
|
151
|
+
- Reactivity
|
|
152
|
+
- Import own Components
|
|
151
153
|
- Expression-based delays ("delay: index * 300") for staggered animations
|
|
152
154
|
- Object support: var obj with dot notation (user.name)
|
|
153
155
|
- Object iteration: for key, value, index in object
|
|
@@ -185,7 +187,22 @@ Sinth's reactive runtime does not use eval(). Every expression is pre-compiled i
|
|
|
185
187
|
- sinth check — lint without output
|
|
186
188
|
- sinth version — print version
|
|
187
189
|
|
|
190
|
+
## Imports
|
|
188
191
|
|
|
192
|
+
Importing made easy!
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
page
|
|
196
|
+
|
|
197
|
+
import components/MyComponent.sinth as Navbar
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
Navbar
|
|
201
|
+
|
|
202
|
+
Main {
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
```
|
|
189
206
|
|
|
190
207
|
## Links
|
|
191
208
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yannosay/sinth",
|
|
3
|
-
"version": "0.13.
|
|
4
|
-
"description": "A declarative language that compiles to pure HTML, CSS, and JavaScript.",
|
|
3
|
+
"version": "0.13.2",
|
|
4
|
+
"description": "A declarative & reactive language that compiles to pure HTML, CSS, and JavaScript.",
|
|
5
5
|
"author": "Yannosay Productions",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
7
7
|
"homepage": "https://sinth.yannosay.com",
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export interface BuiltinInfo { tag: string; defaultClass?: string; voidEl?: boolean }
|
|
2
|
+
|
|
3
|
+
export const BUILTIN_MAP: Record<string, BuiltinInfo> = {
|
|
4
|
+
// structural
|
|
5
|
+
Main: { tag: "main" },
|
|
6
|
+
Header: { tag: "header" },
|
|
7
|
+
Footer: { tag: "footer" },
|
|
8
|
+
Nav: { tag: "nav" },
|
|
9
|
+
Section: { tag: "section" },
|
|
10
|
+
Article: { tag: "article" },
|
|
11
|
+
Aside: { tag: "aside" },
|
|
12
|
+
Div: { tag: "div" },
|
|
13
|
+
Span: { tag: "span" },
|
|
14
|
+
Hero: { tag: "section", defaultClass: "hero" },
|
|
15
|
+
Container: { tag: "div", defaultClass: "container" },
|
|
16
|
+
Grid: { tag: "div", defaultClass: "grid" },
|
|
17
|
+
Flex: { tag: "div", defaultClass: "flex" },
|
|
18
|
+
Stack: { tag: "div", defaultClass: "stack" },
|
|
19
|
+
Row: { tag: "div", defaultClass: "row" },
|
|
20
|
+
Column: { tag: "div", defaultClass: "col" },
|
|
21
|
+
CardGrid: { tag: "div", defaultClass: "card-grid" },
|
|
22
|
+
// typography
|
|
23
|
+
Heading: { tag: "h1" },
|
|
24
|
+
SubHeading: { tag: "p", defaultClass: "subheading" },
|
|
25
|
+
Paragraph: { tag: "p" },
|
|
26
|
+
Lead: { tag: "p", defaultClass: "lead" },
|
|
27
|
+
Small: { tag: "small" },
|
|
28
|
+
Strong: { tag: "strong" },
|
|
29
|
+
Em: { tag: "em" },
|
|
30
|
+
Code: { tag: "code" },
|
|
31
|
+
Pre: { tag: "pre" },
|
|
32
|
+
Blockquote: { tag: "blockquote" },
|
|
33
|
+
Mark: { tag: "mark" },
|
|
34
|
+
Label: { tag: "label" },
|
|
35
|
+
Abbr: { tag: "abbr" },
|
|
36
|
+
Del: { tag: "del" },
|
|
37
|
+
Ins: { tag: "ins" },
|
|
38
|
+
Sub: { tag: "sub" },
|
|
39
|
+
Sup: { tag: "sup" },
|
|
40
|
+
Data: { tag: "data" },
|
|
41
|
+
Time: { tag: "time" },
|
|
42
|
+
Bdi: { tag: "bdi" },
|
|
43
|
+
Bdo: { tag: "bdo" },
|
|
44
|
+
Cite: { tag: "cite" },
|
|
45
|
+
Dfn: { tag: "dfn" },
|
|
46
|
+
Kbd: { tag: "kbd" },
|
|
47
|
+
Samp: { tag: "samp" },
|
|
48
|
+
Var: { tag: "var" },
|
|
49
|
+
Address: { tag: "address" },
|
|
50
|
+
Ruby: { tag: "ruby" },
|
|
51
|
+
Rt: { tag: "rt" },
|
|
52
|
+
Rp: { tag: "rp" },
|
|
53
|
+
// interactive
|
|
54
|
+
Button: { tag: "button" },
|
|
55
|
+
Link: { tag: "a" },
|
|
56
|
+
NavLink: { tag: "a" },
|
|
57
|
+
Select: { tag: "select" },
|
|
58
|
+
Form: { tag: "form" },
|
|
59
|
+
Fieldset: { tag: "fieldset" },
|
|
60
|
+
Legend: { tag: "legend" },
|
|
61
|
+
Details: { tag: "details" },
|
|
62
|
+
Summary: { tag: "summary" },
|
|
63
|
+
Dialog: { tag: "dialog" },
|
|
64
|
+
Textarea: { tag: "textarea" },
|
|
65
|
+
Datalist: { tag: "datalist" },
|
|
66
|
+
Optgroup: { tag: "optgroup" },
|
|
67
|
+
Option: { tag: "option" },
|
|
68
|
+
Progress: { tag: "progress" },
|
|
69
|
+
Meter: { tag: "meter" },
|
|
70
|
+
Output: { tag: "output" },
|
|
71
|
+
Map: { tag: "map" },
|
|
72
|
+
// media
|
|
73
|
+
Picture: { tag: "picture" },
|
|
74
|
+
Video: { tag: "video" },
|
|
75
|
+
Audio: { tag: "audio" },
|
|
76
|
+
Figure: { tag: "figure" },
|
|
77
|
+
Figcaption: { tag: "figcaption" },
|
|
78
|
+
Canvas: { tag: "canvas" },
|
|
79
|
+
Svg: { tag: "svg" },
|
|
80
|
+
IFrame: { tag: "iframe" },
|
|
81
|
+
Object: { tag: "object" },
|
|
82
|
+
// void elements
|
|
83
|
+
Img: { tag: "img", voidEl: true },
|
|
84
|
+
Logo: { tag: "img", voidEl: true },
|
|
85
|
+
Input: { tag: "input", voidEl: true },
|
|
86
|
+
Checkbox: { tag: "input", voidEl: true },
|
|
87
|
+
Hr: { tag: "hr", voidEl: true },
|
|
88
|
+
Br: { tag: "br", voidEl: true },
|
|
89
|
+
Wbr: { tag: "wbr", voidEl: true },
|
|
90
|
+
Source: { tag: "source", voidEl: true },
|
|
91
|
+
Embed: { tag: "embed", voidEl: true },
|
|
92
|
+
Col: { tag: "col", voidEl: true },
|
|
93
|
+
Area: { tag: "area", voidEl: true },
|
|
94
|
+
// lists
|
|
95
|
+
Ul: { tag: "ul" }, Ol: { tag: "ol" }, Li: { tag: "li" },
|
|
96
|
+
Dl: { tag: "dl" }, Dt: { tag: "dt" }, Dd: { tag: "dd" },
|
|
97
|
+
// tables
|
|
98
|
+
Table: { tag: "table" },
|
|
99
|
+
Caption: { tag: "caption" },
|
|
100
|
+
Thead: { tag: "thead" },
|
|
101
|
+
Tbody: { tag: "tbody" },
|
|
102
|
+
Tfoot: { tag: "tfoot" },
|
|
103
|
+
Tr: { tag: "tr" },
|
|
104
|
+
Th: { tag: "th" },
|
|
105
|
+
Td: { tag: "td" },
|
|
106
|
+
Colgroup: { tag: "colgroup" },
|
|
107
|
+
// utility
|
|
108
|
+
Template: { tag: "template" },
|
|
109
|
+
Slot: { tag: "slot" },
|
|
110
|
+
NoScript: { tag: "noscript" },
|
|
111
|
+
RawHTML: { tag: "__RAW__" },
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const VOID_TAGS = new Set([
|
|
115
|
+
"area","base","br","col","embed","hr","img","input",
|
|
116
|
+
"link","meta","param","source","track","wbr",
|
|
117
|
+
]);
|