tjs-lang 0.2.0
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/CONTEXT.md +594 -0
- package/LICENSE +190 -0
- package/README.md +220 -0
- package/bin/benchmarks.ts +351 -0
- package/bin/dev.ts +205 -0
- package/bin/docs.js +170 -0
- package/bin/install-cursor.sh +71 -0
- package/bin/install-vscode.sh +71 -0
- package/bin/select-local-models.d.ts +1 -0
- package/bin/select-local-models.js +28 -0
- package/bin/select-local-models.ts +31 -0
- package/demo/autocomplete.test.ts +232 -0
- package/demo/docs.json +186 -0
- package/demo/examples.test.ts +598 -0
- package/demo/index.html +91 -0
- package/demo/src/autocomplete.ts +482 -0
- package/demo/src/capabilities.ts +859 -0
- package/demo/src/demo-nav.ts +2097 -0
- package/demo/src/examples.test.ts +161 -0
- package/demo/src/examples.ts +476 -0
- package/demo/src/imports.test.ts +196 -0
- package/demo/src/imports.ts +421 -0
- package/demo/src/index.ts +639 -0
- package/demo/src/module-store.ts +635 -0
- package/demo/src/module-sw.ts +132 -0
- package/demo/src/playground.ts +949 -0
- package/demo/src/service-host.ts +389 -0
- package/demo/src/settings.ts +440 -0
- package/demo/src/style.ts +280 -0
- package/demo/src/tjs-playground.ts +1605 -0
- package/demo/src/ts-examples.ts +478 -0
- package/demo/src/ts-playground.ts +1092 -0
- package/demo/static/favicon.svg +30 -0
- package/demo/static/photo-1.jpg +0 -0
- package/demo/static/photo-2.jpg +0 -0
- package/demo/static/texts/ai-history.txt +9 -0
- package/demo/static/texts/coffee-origins.txt +9 -0
- package/demo/static/texts/renewable-energy.txt +9 -0
- package/dist/index.js +256 -0
- package/dist/index.js.map +37 -0
- package/dist/tjs-batteries.js +4 -0
- package/dist/tjs-batteries.js.map +15 -0
- package/dist/tjs-full.js +256 -0
- package/dist/tjs-full.js.map +37 -0
- package/dist/tjs-transpiler.js +220 -0
- package/dist/tjs-transpiler.js.map +21 -0
- package/dist/tjs-vm.js +4 -0
- package/dist/tjs-vm.js.map +14 -0
- package/docs/CNAME +1 -0
- package/docs/favicon.svg +30 -0
- package/docs/index.html +91 -0
- package/docs/index.js +10468 -0
- package/docs/index.js.map +92 -0
- package/docs/photo-1.jpg +0 -0
- package/docs/photo-1.webp +0 -0
- package/docs/photo-2.jpg +0 -0
- package/docs/photo-2.webp +0 -0
- package/docs/texts/ai-history.txt +9 -0
- package/docs/texts/coffee-origins.txt +9 -0
- package/docs/texts/renewable-energy.txt +9 -0
- package/docs/tjs-lang.svg +31 -0
- package/docs/tosijs-agent.svg +31 -0
- package/editors/README.md +325 -0
- package/editors/ace/ajs-mode.js +328 -0
- package/editors/ace/ajs-mode.ts +269 -0
- package/editors/ajs-syntax.ts +212 -0
- package/editors/build-grammars.ts +510 -0
- package/editors/codemirror/ajs-language.js +287 -0
- package/editors/codemirror/ajs-language.ts +1447 -0
- package/editors/codemirror/autocomplete.test.ts +531 -0
- package/editors/codemirror/component.ts +404 -0
- package/editors/monaco/ajs-monarch.js +243 -0
- package/editors/monaco/ajs-monarch.ts +225 -0
- package/editors/tjs-syntax.ts +115 -0
- package/editors/vscode/language-configuration.json +37 -0
- package/editors/vscode/package.json +65 -0
- package/editors/vscode/syntaxes/ajs-injection.tmLanguage.json +107 -0
- package/editors/vscode/syntaxes/ajs.tmLanguage.json +252 -0
- package/editors/vscode/syntaxes/tjs.tmLanguage.json +333 -0
- package/package.json +83 -0
- package/src/cli/commands/check.ts +41 -0
- package/src/cli/commands/convert.ts +133 -0
- package/src/cli/commands/emit.ts +260 -0
- package/src/cli/commands/run.ts +68 -0
- package/src/cli/commands/test.ts +194 -0
- package/src/cli/commands/types.ts +20 -0
- package/src/cli/create-app.ts +236 -0
- package/src/cli/playground.ts +250 -0
- package/src/cli/tjs.ts +166 -0
- package/src/cli/tjsx.ts +160 -0
- package/tjs-lang.svg +31 -0
package/docs/photo-1.jpg
ADDED
|
Binary file
|
|
Binary file
|
package/docs/photo-2.jpg
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
A Brief History of Artificial Intelligence
|
|
2
|
+
|
|
3
|
+
The field of artificial intelligence was formally founded at a workshop at Dartmouth College in 1956, where John McCarthy coined the term. Early pioneers believed that human-level AI was just decades away, leading to significant government funding and optimism.
|
|
4
|
+
|
|
5
|
+
The 1970s and 1980s saw the rise of expert systems, which encoded human knowledge into rule-based programs. Companies like Digital Equipment Corporation saved millions using these systems, but their brittleness and maintenance costs eventually led to the "AI Winter" of the late 1980s.
|
|
6
|
+
|
|
7
|
+
The modern AI renaissance began around 2012 when deep learning achieved breakthrough results in image recognition. Neural networks, an idea dating back to the 1940s, finally became practical thanks to large datasets, GPU computing, and algorithmic improvements like dropout and batch normalization.
|
|
8
|
+
|
|
9
|
+
The 2020s brought large language models like GPT and Claude, trained on vast amounts of text data. These models demonstrated surprising emergent capabilities, from code generation to reasoning, sparking both excitement about AI's potential and debates about safety and alignment. The technology continues to advance rapidly, with new architectures and training methods appearing regularly.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The Origins of Coffee
|
|
2
|
+
|
|
3
|
+
Legend has it that coffee was discovered by an Ethiopian goat herder named Kaldi around 850 AD. He noticed his goats became unusually energetic after eating berries from a certain tree. Curious, he tried the berries himself and experienced a similar stimulating effect.
|
|
4
|
+
|
|
5
|
+
The practice of roasting coffee beans and brewing them as a beverage developed in Yemen during the 15th century. Sufi monks used coffee to stay awake during nighttime devotions, and the drink spread through the Islamic world via trade routes. Coffee houses, called qahveh khaneh, became important social centers in cities like Constantinople, Cairo, and Damascus.
|
|
6
|
+
|
|
7
|
+
Coffee arrived in Europe in the 17th century, initially meeting resistance from some who called it the "bitter invention of Satan." Pope Clement VIII reportedly settled the matter by tasting the beverage and giving it papal approval. Coffee houses soon proliferated across Europe, becoming hubs for intellectual discussion and business dealings.
|
|
8
|
+
|
|
9
|
+
Today, coffee is the world's second most traded commodity after oil. Over 2.25 billion cups are consumed daily, supporting the livelihoods of approximately 125 million people worldwide. The specialty coffee movement has transformed the industry, with consumers increasingly interested in origin, processing methods, and sustainable farming practices.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Renewable Energy: A Path Forward
|
|
2
|
+
|
|
3
|
+
The global transition to renewable energy sources represents one of the most significant technological and economic shifts in human history. Solar power capacity has grown exponentially, with costs dropping by over 89% since 2010. Wind energy now provides over 7% of global electricity, with offshore wind farms becoming increasingly viable in deeper waters.
|
|
4
|
+
|
|
5
|
+
Battery storage technology has emerged as a crucial enabler, with lithium-ion costs falling 97% since 1991. Grid-scale storage projects are now being deployed worldwide, helping to address the intermittency challenges that have historically limited renewable adoption.
|
|
6
|
+
|
|
7
|
+
Emerging technologies like green hydrogen production, advanced geothermal systems, and next-generation nuclear reactors promise to fill gaps where traditional renewables struggle. Meanwhile, smart grid technology and demand response systems are making energy distribution more efficient and resilient.
|
|
8
|
+
|
|
9
|
+
The economic case for renewables has become compelling. In most regions, new solar and wind installations are now cheaper than new fossil fuel plants, even without subsidies. This cost advantage, combined with growing climate concerns and energy security considerations, is accelerating the transition across both developed and developing nations.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg x="0pt" y="0pt" width="48pt" height="48pt" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<!--Generated by AMDN-->
|
|
4
|
+
<g id="Layer_1">
|
|
5
|
+
<g id="Layer_1-1">
|
|
6
|
+
<g id="Layer_1_1">
|
|
7
|
+
<g id="Group">
|
|
8
|
+
<path id="Path" style="fill:#ff1c24;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:none;" d="M1,9 C1,4.58172,4.58172,1,9,1 C9,1,39,1,39,1 C43.4183,1,47,4.58172,47,9 C47,9,47,39,47,39 C47,43.4183,43.4183,47,39,47 C39,47,9,47,9,47 C4.58172,47,1,43.4183,1,39 C1,39,1,9,1,9 z"/>
|
|
9
|
+
<g id="Group_1">
|
|
10
|
+
<path id="Path_1" style="fill:#9e9e9e;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M16,29 C16,29,10,31,10,35 C10,39,16,39,16,39"/>
|
|
11
|
+
<path id="Path_Copy" style="fill:#9e9e9e;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M32.0002,29 C32.0002,29,38.0002,31,38.0002,35 C38.0002,39,32.0002,39,32.0002,39"/>
|
|
12
|
+
<path id="Path_2" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M9,10.1818 C9,7.87226,10.7909,6,13,6 C13,6,35,6,35,6 C37.2091,6,39,7.87226,39,10.1818 C39,10.1818,39,24.8182,39,24.8182 C39,27.1277,37.2091,29,35,29 C35,29,13,29,13,29 C10.7909,29,9,27.1277,9,24.8182 C9,24.8182,9,10.1818,9,10.1818 z"/>
|
|
13
|
+
<path id="Path_3" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M24,11 C24,11,24,23,24,23"/>
|
|
14
|
+
<path id="Path_4" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M28,15 C28,15,28,17,28,17"/>
|
|
15
|
+
<path id="Path_Copy_1" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M20,15 C20,15,20,17,20,17"/>
|
|
16
|
+
<path id="Path_5" style="fill:none;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M32,43 C32,43,30,41,30,41 C30,41,28,43,28,43"/>
|
|
17
|
+
<path id="Path_Copy_2" style="fill:none;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M20,43 C20,43,18,41,18,41 C18,41,16,43,16,43"/>
|
|
18
|
+
<path id="Path_6" style="fill:#e4e4e4;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M16,29 C16,29,32,29,32,29 C32,29,32,39,32,39 C32,39,16,39,16,39 C16,39,16,29,16,29 z"/>
|
|
19
|
+
</g>
|
|
20
|
+
</g>
|
|
21
|
+
</g>
|
|
22
|
+
</g>
|
|
23
|
+
<path id="Path-1" style="fill:#006736;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M27,17 C27,17,34,17,34,17 C34,17,34,22,34,22 C34,22,27,22,27,22 C27,22,27,17,27,17 z"/>
|
|
24
|
+
<path id="Path-2" style="fill:none;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M21,19 C21,19,21,19,21,19 C21,17.8954,21.8954,17,23,17 C23,17,25,17,25,17 C26.1046,17,27,17.8954,27,19 C27,19,27,19,27,19"/>
|
|
25
|
+
<path id="Path_Copy-1" style="fill:#006736;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M14,17 C14,17,21,17,21,17 C21,17,21,22,21,22 C21,22,14,22,14,22 C14,22,14,17,14,17 z"/>
|
|
26
|
+
<path id="Path_Copy-2" style="fill:#8e7f6d;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M7.31734,20.5867 C7.14208,19.7104,7.71038,18.8579,8.58668,18.6827 C8.58668,18.6827,10.4133,18.3173,10.4133,18.3173 C11.2896,18.1421,12.1421,18.7104,12.3173,19.5867 C12.3173,19.5867,12.6405,21.2026,12.6405,21.2026 C12.8314,22.157,13.8156,22.7281,14.7389,22.4204 C14.7389,22.4204,15.1785,22.2738,15.1785,22.2738 C15.6917,22.1028,16.2565,22.1995,16.6836,22.5317 C16.6836,22.5317,24.3753,28.5141,24.3753,28.5141 C24.7695,28.8207,25,29.2921,25,29.7914 C25,29.7914,25,40.3298,25,40.3298 C25,40.7589,24.8295,41.1705,24.5261,41.4739 C24.5261,41.4739,23.4739,42.5261,23.4739,42.5261 C23.1705,42.8295,22.7589,43,22.3298,43 C22.3298,43,9,43,9,43 C7.34315,43,6,41.6569,6,40 C6,40,6,26,6,26 C6,25.3871,6.3463,24.8268,6.89452,24.5527 C6.89452,24.5527,6.89452,24.5527,6.89452,24.5527 C7.5472,24.2264,7.90073,23.5036,7.75762,22.7881 C7.75762,22.7881,7.31734,20.5867,7.31734,20.5867 z"/>
|
|
27
|
+
<path id="Compound_Group" style="fill:#c6b199;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M21.118,26.0132 C21.118,26.0132,29.4076,27.8928,29.4076,27.8928 C30.2155,28.076,30.722,28.8794,30.5388,29.6874 C30.5388,29.6874,28.3275,39.4398,28.3275,39.4398 C28.1443,40.2477,27.3409,40.7542,26.5329,40.571 C26.5329,40.571,10.929,37.0329,10.929,37.0329 C10.1211,36.8498,9.61466,36.0463,9.79785,35.2384 C9.79785,35.2384,12.2302,24.5107,12.2302,24.5107 C12.2302,24.5107,12.6725,22.5602,12.6725,22.5602 C12.8557,21.7523,13.6591,21.2458,14.4671,21.429 C14.4671,21.429,20.3185,22.7558,20.3185,22.7558 C21.1264,22.939,21.6329,23.7424,21.4497,24.5503 C21.4497,24.5503,21.118,26.0132,21.118,26.0132 z"/>
|
|
28
|
+
<path id="Path-3" style="fill:#8e7f6d;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M41,19 C41,19,36,18,36,18 C36,18,35,23,35,23 C35,23,32,22,32,22 C32,22,23,29,23,29 C23,29,23,41,23,41 C23,41,25,43,25,43 C25,43,39,43,39,43 C40.6569,43,42,41.6569,42,40 C42,40,42,25,42,25 C42,25,40,24,40,24 C40,24,41,19,41,19 z"/>
|
|
29
|
+
<path id="Path-4" style="fill:#8e7f6d;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M13.2766,3.05029 C13.1062,3.01931,12.9326,3.08429,12.8244,3.21952 C12.8244,3.21952,9,8,9,8 C9,8,6.05462,8.58908,6.05462,8.58908 C5.56174,8.68765,5.54512,9.38628,6.03275,9.50819 C6.03275,9.50819,24,14,24,14 C24,14,41.9672,9.50819,41.9672,9.50819 C42.4549,9.38628,42.4383,8.68765,41.9454,8.58908 C41.9454,8.58908,39,8,39,8 C39,8,35.1756,3.21952,35.1756,3.21952 C35.0674,3.08429,34.8938,3.01931,34.7234,3.05029 C34.7234,3.05029,24,5,24,5 C24,5,13.2766,3.05029,13.2766,3.05029 z"/>
|
|
30
|
+
</g>
|
|
31
|
+
</svg>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg x="0pt" y="0pt" width="48pt" height="48pt" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<!--Generated by AMDN-->
|
|
4
|
+
<g id="Layer_1">
|
|
5
|
+
<g id="Layer_1-1">
|
|
6
|
+
<g id="Layer_1_1">
|
|
7
|
+
<g id="Group">
|
|
8
|
+
<path id="Path" style="fill:#ff1c24;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:none;" d="M1,9 C1,4.58172,4.58172,1,9,1 C9,1,39,1,39,1 C43.4183,1,47,4.58172,47,9 C47,9,47,39,47,39 C47,43.4183,43.4183,47,39,47 C39,47,9,47,9,47 C4.58172,47,1,43.4183,1,39 C1,39,1,9,1,9 z"/>
|
|
9
|
+
<g id="Group_1">
|
|
10
|
+
<path id="Path_1" style="fill:#9e9e9e;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M16,29 C16,29,10,31,10,35 C10,39,16,39,16,39"/>
|
|
11
|
+
<path id="Path_Copy" style="fill:#9e9e9e;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M32.0002,29 C32.0002,29,38.0002,31,38.0002,35 C38.0002,39,32.0002,39,32.0002,39"/>
|
|
12
|
+
<path id="Path_2" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M9,10.1818 C9,7.87226,10.7909,6,13,6 C13,6,35,6,35,6 C37.2091,6,39,7.87226,39,10.1818 C39,10.1818,39,24.8182,39,24.8182 C39,27.1277,37.2091,29,35,29 C35,29,13,29,13,29 C10.7909,29,9,27.1277,9,24.8182 C9,24.8182,9,10.1818,9,10.1818 z"/>
|
|
13
|
+
<path id="Path_3" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M24,11 C24,11,24,23,24,23"/>
|
|
14
|
+
<path id="Path_4" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M28,15 C28,15,28,17,28,17"/>
|
|
15
|
+
<path id="Path_Copy_1" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M20,15 C20,15,20,17,20,17"/>
|
|
16
|
+
<path id="Path_5" style="fill:none;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M32,43 C32,43,30,41,30,41 C30,41,28,43,28,43"/>
|
|
17
|
+
<path id="Path_Copy_2" style="fill:none;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M20,43 C20,43,18,41,18,41 C18,41,16,43,16,43"/>
|
|
18
|
+
<path id="Path_6" style="fill:#e4e4e4;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M16,29 C16,29,32,29,32,29 C32,29,32,39,32,39 C32,39,16,39,16,39 C16,39,16,29,16,29 z"/>
|
|
19
|
+
</g>
|
|
20
|
+
</g>
|
|
21
|
+
</g>
|
|
22
|
+
</g>
|
|
23
|
+
<path id="Path-1" style="fill:#006736;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M27,17 C27,17,34,17,34,17 C34,17,34,22,34,22 C34,22,27,22,27,22 C27,22,27,17,27,17 z"/>
|
|
24
|
+
<path id="Path-2" style="fill:none;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M21,19 C21,19,21,19,21,19 C21,17.8954,21.8954,17,23,17 C23,17,25,17,25,17 C26.1046,17,27,17.8954,27,19 C27,19,27,19,27,19"/>
|
|
25
|
+
<path id="Path_Copy-1" style="fill:#006736;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M14,17 C14,17,21,17,21,17 C21,17,21,22,21,22 C21,22,14,22,14,22 C14,22,14,17,14,17 z"/>
|
|
26
|
+
<path id="Path_Copy-2" style="fill:#8e7f6d;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M7.31734,20.5867 C7.14208,19.7104,7.71038,18.8579,8.58668,18.6827 C8.58668,18.6827,10.4133,18.3173,10.4133,18.3173 C11.2896,18.1421,12.1421,18.7104,12.3173,19.5867 C12.3173,19.5867,12.6405,21.2026,12.6405,21.2026 C12.8314,22.157,13.8156,22.7281,14.7389,22.4204 C14.7389,22.4204,15.1785,22.2738,15.1785,22.2738 C15.6917,22.1028,16.2565,22.1995,16.6836,22.5317 C16.6836,22.5317,24.3753,28.5141,24.3753,28.5141 C24.7695,28.8207,25,29.2921,25,29.7914 C25,29.7914,25,40.3298,25,40.3298 C25,40.7589,24.8295,41.1705,24.5261,41.4739 C24.5261,41.4739,23.4739,42.5261,23.4739,42.5261 C23.1705,42.8295,22.7589,43,22.3298,43 C22.3298,43,9,43,9,43 C7.34315,43,6,41.6569,6,40 C6,40,6,26,6,26 C6,25.3871,6.3463,24.8268,6.89452,24.5527 C6.89452,24.5527,6.89452,24.5527,6.89452,24.5527 C7.5472,24.2264,7.90073,23.5036,7.75762,22.7881 C7.75762,22.7881,7.31734,20.5867,7.31734,20.5867 z"/>
|
|
27
|
+
<path id="Compound_Group" style="fill:#c6b199;fill-opacity:1;fill-rule:evenodd;opacity:1;stroke:#000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M21.118,26.0132 C21.118,26.0132,29.4076,27.8928,29.4076,27.8928 C30.2155,28.076,30.722,28.8794,30.5388,29.6874 C30.5388,29.6874,28.3275,39.4398,28.3275,39.4398 C28.1443,40.2477,27.3409,40.7542,26.5329,40.571 C26.5329,40.571,10.929,37.0329,10.929,37.0329 C10.1211,36.8498,9.61466,36.0463,9.79785,35.2384 C9.79785,35.2384,12.2302,24.5107,12.2302,24.5107 C12.2302,24.5107,12.6725,22.5602,12.6725,22.5602 C12.8557,21.7523,13.6591,21.2458,14.4671,21.429 C14.4671,21.429,20.3185,22.7558,20.3185,22.7558 C21.1264,22.939,21.6329,23.7424,21.4497,24.5503 C21.4497,24.5503,21.118,26.0132,21.118,26.0132 z"/>
|
|
28
|
+
<path id="Path-3" style="fill:#8e7f6d;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M41,19 C41,19,36,18,36,18 C36,18,35,23,35,23 C35,23,32,22,32,22 C32,22,23,29,23,29 C23,29,23,41,23,41 C23,41,25,43,25,43 C25,43,39,43,39,43 C40.6569,43,42,41.6569,42,40 C42,40,42,25,42,25 C42,25,40,24,40,24 C40,24,41,19,41,19 z"/>
|
|
29
|
+
<path id="Path-4" style="fill:#8e7f6d;fill-opacity:1;fill-rule:nonzero;opacity:1;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-width:2;" d="M13.2766,3.05029 C13.1062,3.01931,12.9326,3.08429,12.8244,3.21952 C12.8244,3.21952,9,8,9,8 C9,8,6.05462,8.58908,6.05462,8.58908 C5.56174,8.68765,5.54512,9.38628,6.03275,9.50819 C6.03275,9.50819,24,14,24,14 C24,14,41.9672,9.50819,41.9672,9.50819 C42.4549,9.38628,42.4383,8.68765,41.9454,8.58908 C41.9454,8.58908,39,8,39,8 C39,8,35.1756,3.21952,35.1756,3.21952 C35.0674,3.08429,34.8938,3.01931,34.7234,3.05029 C34.7234,3.05029,24,5,24,5 C24,5,13.2766,3.05029,13.2766,3.05029 z"/>
|
|
30
|
+
</g>
|
|
31
|
+
</svg>
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# Editor Integration for AsyncJS
|
|
2
|
+
|
|
3
|
+
This directory contains syntax highlighting definitions for AsyncJS (the JavaScript subset used by tjs-lang).
|
|
4
|
+
|
|
5
|
+
## Quick Install
|
|
6
|
+
|
|
7
|
+
After installing `tjs-lang`, run one of these commands:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# VS Code
|
|
11
|
+
npx ajs-install-vscode
|
|
12
|
+
|
|
13
|
+
# Cursor
|
|
14
|
+
npx ajs-install-cursor
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If npx has issues resolving paths, run directly from node_modules:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
./node_modules/tjs-lang/bin/install-vscode.sh
|
|
21
|
+
./node_modules/tjs-lang/bin/install-cursor.sh
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then restart your editor.
|
|
25
|
+
|
|
26
|
+
## VS Code / Cursor Extension
|
|
27
|
+
|
|
28
|
+
The `vscode/` directory contains an extension that provides:
|
|
29
|
+
|
|
30
|
+
- Syntax highlighting for `.ajs` files
|
|
31
|
+
- Embedded highlighting in `ajs`...`` template literals within TypeScript/JavaScript files
|
|
32
|
+
- Red squiggly highlighting for forbidden syntax (`new`, `class`, `async`, etc.)
|
|
33
|
+
|
|
34
|
+
### Manual Installation
|
|
35
|
+
|
|
36
|
+
1. Open VS Code / Cursor
|
|
37
|
+
2. Press `Ctrl+Shift+P` / `Cmd+Shift+P`
|
|
38
|
+
3. Type "Developer: Install Extension from Location..."
|
|
39
|
+
4. Select the `editors/vscode` directory
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
**Forbidden syntax is highlighted as an error:**
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
// These will show red squiggles
|
|
47
|
+
new Date() // Use Date.now() or Date.parse()
|
|
48
|
+
class Foo {} // Use functions and objects
|
|
49
|
+
async function x() {} // Not needed, all calls are implicitly async
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Template literal injection:**
|
|
53
|
+
|
|
54
|
+
When you write `ajs`...`` in a TypeScript file, the content gets AsyncJS highlighting:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { ajs } from 'tjs-lang'
|
|
58
|
+
|
|
59
|
+
const agent = ajs`
|
|
60
|
+
function search(query: 'string', limit = 10) {
|
|
61
|
+
let results = storeSearch({ query })
|
|
62
|
+
return { results }
|
|
63
|
+
}
|
|
64
|
+
`
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Monaco Editor (Web)
|
|
68
|
+
|
|
69
|
+
The `monaco/` directory contains Monarch tokenizer definitions for the Monaco Editor (used in VS Code Web, CodeSandbox, etc.).
|
|
70
|
+
|
|
71
|
+
### Usage (TypeScript)
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import * as monaco from 'monaco-editor'
|
|
75
|
+
import { registerAjsLanguage } from 'tjs-lang/editors/monaco/ajs-monarch'
|
|
76
|
+
|
|
77
|
+
// Register the language
|
|
78
|
+
registerAjsLanguage(monaco)
|
|
79
|
+
|
|
80
|
+
// Create an editor with AsyncJS
|
|
81
|
+
monaco.editor.create(document.getElementById('container'), {
|
|
82
|
+
value: `function agent(topic: 'string') {
|
|
83
|
+
let results = storeSearch({ query: topic })
|
|
84
|
+
return { results }
|
|
85
|
+
}`,
|
|
86
|
+
language: 'ajs',
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Usage (Browser)
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<script src="https://unpkg.com/monaco-editor/min/vs/loader.js"></script>
|
|
94
|
+
<script src="path/to/ajs-monarch.js"></script>
|
|
95
|
+
<script>
|
|
96
|
+
require(['vs/editor/editor.main'], function () {
|
|
97
|
+
registerAjsLanguage(monaco)
|
|
98
|
+
monaco.editor.create(document.getElementById('container'), {
|
|
99
|
+
value: 'function agent(topic: "string") { ... }',
|
|
100
|
+
language: 'ajs',
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
</script>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Syntax Highlighting Rules
|
|
107
|
+
|
|
108
|
+
### Keywords (blue/purple)
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
function, return, if, else, while, for, of, in,
|
|
112
|
+
try, catch, finally, throw, let, const
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Literals (orange/green)
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
true, false, null, numbers, strings
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Forbidden (red/error)
|
|
122
|
+
|
|
123
|
+
These are JavaScript features not allowed in AsyncJS:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
new, class, async, await, var, this, super,
|
|
127
|
+
extends, implements, interface, type, yield,
|
|
128
|
+
import, export, require
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Type Constructors (teal)
|
|
132
|
+
|
|
133
|
+
Used as factories, not with `new`:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
Date, Set, Map, Array, Object
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## CodeMirror 6 (Web)
|
|
140
|
+
|
|
141
|
+
The `codemirror/` directory extends CodeMirror's JavaScript language with AsyncJS error highlighting.
|
|
142
|
+
|
|
143
|
+
### Usage (TypeScript)
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import { EditorState } from '@codemirror/state'
|
|
147
|
+
import { EditorView, basicSetup } from 'codemirror'
|
|
148
|
+
import { ajs } from 'tjs-lang/editors/codemirror/ajs-language'
|
|
149
|
+
|
|
150
|
+
new EditorView({
|
|
151
|
+
state: EditorState.create({
|
|
152
|
+
doc: `function agent(topic: 'string') {
|
|
153
|
+
let results = storeSearch({ query: topic })
|
|
154
|
+
return { results }
|
|
155
|
+
}`,
|
|
156
|
+
extensions: [basicSetup, ajs()],
|
|
157
|
+
}),
|
|
158
|
+
parent: document.getElementById('editor'),
|
|
159
|
+
})
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### How It Works
|
|
163
|
+
|
|
164
|
+
CodeMirror 6 uses Lezer grammars (compiled parsers). Rather than creating a full AsyncJS grammar, we:
|
|
165
|
+
|
|
166
|
+
1. Use the standard JavaScript language
|
|
167
|
+
2. Add a view plugin that marks forbidden keywords as errors
|
|
168
|
+
3. Apply custom styling to show red squiggly underlines
|
|
169
|
+
|
|
170
|
+
This gives you full JS syntax highlighting with AsyncJS-specific error marking.
|
|
171
|
+
|
|
172
|
+
## Ace Editor (Web)
|
|
173
|
+
|
|
174
|
+
The `ace/` directory contains a custom mode for the Ace Editor.
|
|
175
|
+
|
|
176
|
+
### Usage (ES Module)
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import ace from 'ace-builds'
|
|
180
|
+
import { registerAjsMode } from 'tjs-lang/editors/ace/ajs-mode'
|
|
181
|
+
|
|
182
|
+
// Register the mode
|
|
183
|
+
registerAjsMode(ace)
|
|
184
|
+
|
|
185
|
+
// Create an editor with AsyncJS
|
|
186
|
+
const editor = ace.edit('editor')
|
|
187
|
+
editor.session.setMode('ace/mode/ajs')
|
|
188
|
+
editor.setValue(`function agent(topic: 'string') {
|
|
189
|
+
let results = storeSearch({ query: topic })
|
|
190
|
+
return { results }
|
|
191
|
+
}`)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Usage (Browser CDN)
|
|
195
|
+
|
|
196
|
+
```html
|
|
197
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.2/ace.js"></script>
|
|
198
|
+
<script src="path/to/ajs-mode.js"></script>
|
|
199
|
+
<script>
|
|
200
|
+
// Mode auto-registers when ace is global
|
|
201
|
+
const editor = ace.edit('editor')
|
|
202
|
+
editor.session.setMode('ace/mode/ajs')
|
|
203
|
+
</script>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Features
|
|
207
|
+
|
|
208
|
+
- Full JavaScript syntax highlighting
|
|
209
|
+
- Forbidden keywords (`new`, `class`, `async`, etc.) highlighted as errors
|
|
210
|
+
- Template literal support with embedded expression highlighting
|
|
211
|
+
- Auto-indent and brace matching
|
|
212
|
+
- Code folding
|
|
213
|
+
|
|
214
|
+
## Tree-sitter Editors (Zed, Nova, Helix)
|
|
215
|
+
|
|
216
|
+
These editors use Tree-sitter grammars, which require compiled C/WASM parsers. Since AsyncJS is a JavaScript subset, we recommend:
|
|
217
|
+
|
|
218
|
+
### Option 1: Use JavaScript Mode
|
|
219
|
+
|
|
220
|
+
Associate `.ajs` files with JavaScript syntax:
|
|
221
|
+
|
|
222
|
+
**Zed** (`~/.config/zed/settings.json`):
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"file_types": {
|
|
227
|
+
"JavaScript": ["ajs"]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Nova**: In Preferences → Languages, add `.ajs` to JavaScript extensions.
|
|
233
|
+
|
|
234
|
+
**Helix** (`~/.config/helix/languages.toml`):
|
|
235
|
+
|
|
236
|
+
```toml
|
|
237
|
+
[[language]]
|
|
238
|
+
name = "javascript"
|
|
239
|
+
file-types = ["js", "mjs", "cjs", "ajs"]
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Option 2: Custom Highlighting Queries (Advanced)
|
|
243
|
+
|
|
244
|
+
If you want forbidden keywords highlighted as errors, you can override the JavaScript highlights query. This varies by editor and requires knowledge of Tree-sitter queries.
|
|
245
|
+
|
|
246
|
+
Example query addition for `highlights.scm`:
|
|
247
|
+
|
|
248
|
+
```scheme
|
|
249
|
+
; Mark forbidden keywords as errors
|
|
250
|
+
((identifier) @error
|
|
251
|
+
(#match? @error "^(new|class|async|await|var|this|super)$"))
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Why Not a Full Tree-sitter Grammar?
|
|
255
|
+
|
|
256
|
+
Tree-sitter grammars require:
|
|
257
|
+
|
|
258
|
+
- Writing a grammar DSL that compiles to C
|
|
259
|
+
- Building WASM binaries for web editors
|
|
260
|
+
- Maintaining compatibility with each editor's Tree-sitter version
|
|
261
|
+
- Complex injection queries for template literals
|
|
262
|
+
|
|
263
|
+
Since AsyncJS is JavaScript with restrictions (not additions), the effort doesn't pay off. The JavaScript grammar already parses everything correctly—we just want to mark certain constructs as errors, which is better done at the linting/transpiler level.
|
|
264
|
+
|
|
265
|
+
## Syntax Highlighting Rules
|
|
266
|
+
|
|
267
|
+
### Keywords (blue/purple)
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
function, return, if, else, while, for, of, in,
|
|
271
|
+
try, catch, finally, throw, let, const
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Literals (orange/green)
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
true, false, null, numbers, strings
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Forbidden (red/error)
|
|
281
|
+
|
|
282
|
+
These are JavaScript features not allowed in AsyncJS:
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
new, class, async, await, var, this, super,
|
|
286
|
+
extends, implements, interface, type, yield,
|
|
287
|
+
import, export, require
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Type Constructors (teal)
|
|
291
|
+
|
|
292
|
+
Used as factories, not with `new`:
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
Date, Set, Map, Array, Object
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Contributing
|
|
299
|
+
|
|
300
|
+
The grammars are defined in:
|
|
301
|
+
|
|
302
|
+
- `vscode/syntaxes/ajs-injection.tmLanguage.json` - TextMate injection grammar (VS Code, Cursor)
|
|
303
|
+
- `vscode/syntaxes/ajs.tmLanguage.json` - Standalone .ajs file grammar
|
|
304
|
+
- `monaco/ajs-monarch.ts` - Monarch tokenizer (Monaco Editor)
|
|
305
|
+
- `codemirror/ajs-language.ts` - CodeMirror 6 extension
|
|
306
|
+
|
|
307
|
+
### Keeping Grammars in Sync
|
|
308
|
+
|
|
309
|
+
When modifying AsyncJS syntax, update **all** grammar files:
|
|
310
|
+
|
|
311
|
+
1. **Forbidden keywords** - If you add/remove keywords from the transpiler's forbidden list, update:
|
|
312
|
+
|
|
313
|
+
- `vscode/syntaxes/ajs-injection.tmLanguage.json` → `forbidden` pattern
|
|
314
|
+
- `monaco/ajs-monarch.ts` → `forbidden` array
|
|
315
|
+
- `codemirror/ajs-language.ts` → `FORBIDDEN_KEYWORDS` set
|
|
316
|
+
|
|
317
|
+
2. **New syntax** - If you add new syntax constructs, add corresponding patterns to each grammar.
|
|
318
|
+
|
|
319
|
+
3. **Test after changes** - Reinstall the VS Code extension and verify highlighting works.
|
|
320
|
+
|
|
321
|
+
### Testing Changes
|
|
322
|
+
|
|
323
|
+
1. VS Code: Use "Developer: Inspect TM Scopes" to debug token scopes
|
|
324
|
+
2. Monaco: Use the [Monaco Playground](https://microsoft.github.io/monaco-editor/playground.html)
|
|
325
|
+
3. CodeMirror: Use the [CodeMirror Try](https://codemirror.net/try/) page
|