sheel-deer 1.0.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/.vscode/launch.json +51 -0
- package/.vscode/settings.json +94 -0
- package/.vscode/tasks.json +57 -0
- package/App.elen +70 -0
- package/README.MD +0 -0
- package/Test.elen +24 -0
- package/compile-all-ts.js +76 -0
- package/dist/index.es.js +1 -0
- package/dist/index.umd.js +1 -0
- package/elen/App.elen +7 -0
- package/elen/LICENSE +15 -0
- package/elen/dist/extension.js +130 -0
- package/elen/dist/init.js +28 -0
- package/elen/elen-1.0.0.vsix +0 -0
- package/elen/extension.ts +122 -0
- package/elen/icon-theme.json +2423 -0
- package/elen/icon.svg +1 -0
- package/elen/images/icon.svg +1 -0
- package/elen/init.ts +28 -0
- package/elen/language-configuration.json +26 -0
- package/elen/package-lock.json +549 -0
- package/elen/package.json +52 -0
- package/elen/seti.woff +0 -0
- package/elen/src/App.elen +0 -0
- package/elen/syntaxes/elen.tmLanguage.json +312 -0
- package/elen/tsconfig.json +14 -0
- package/elen-icon-theme/LICENSE +15 -0
- package/elen-icon-theme/README.md +18 -0
- package/elen-icon-theme/elen-icon-theme-1.0.0.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.1.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.13.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.15.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.16.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.17.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.18.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.19.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.2.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.20.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.3.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.4.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.5.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.6.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.7.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.8.vsix +0 -0
- package/elen-icon-theme/elen-icon-theme-1.0.9.vsix +0 -0
- package/elen-icon-theme/extension.js +226 -0
- package/elen-icon-theme/icon-theme.json +2425 -0
- package/elen-icon-theme/icon.svg +1 -0
- package/elen-icon-theme/images/icon.svg +1 -0
- package/elen-icon-theme/package.json +36 -0
- package/elen-icon-theme/seti.woff +0 -0
- package/icon.svg +8 -0
- package/index.html +11 -0
- package/init-start-page.ts +59 -0
- package/logo.html +15 -0
- package/package.json +42 -0
- package/server.ts +31 -0
- package/shells/data-page/Elen.ts +23 -0
- package/squarings/.json +132 -0
- package/squarings/App.json +59 -0
- package/squarings/Test.json +27 -0
- package/src/base/Component.ts +113 -0
- package/src/classes/BinaryData.ts +81 -0
- package/src/classes/DataModel.ts +386 -0
- package/src/classes/DataTypes.ts +116 -0
- package/src/components/squaring.ts +226 -0
- package/src/components/vtm.ts +231 -0
- package/src/data/ascii.ts +134 -0
- package/src/data/binary-resources.ts +209 -0
- package/src/events/event-handler.js +34 -0
- package/src/index.ts +1 -0
- package/src/methods/app-template.ts +7 -0
- package/src/methods/array-helpers.ts +176 -0
- package/src/methods/css-template.ts +5 -0
- package/src/methods/errors-helpers.ts +26 -0
- package/src/methods/html-template.ts +22 -0
- package/src/methods/parsers.ts +1012 -0
- package/src/methods/square.ts +80 -0
- package/src/methods/ts-template.ts +36 -0
- package/src/methods/using-template.ts +3 -0
- package/src/models/ascii.ts +26 -0
- package/src/models/data-stream.ts +5 -0
- package/src/models/data-type-model.ts +22 -0
- package/src/models/template-binary-model.ts +5 -0
- package/src/routes.ts +9 -0
- package/syntaxes/enel.tmLanguage.json +28 -0
- package/tsconfig.json +68 -0
- package/viewController/Inital.elen +8 -0
- package/vite.config.ts +25 -0
- package/vue.config.js +30 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Run Elen Icon Theme",
|
|
6
|
+
"type": "extensionHost",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"preLaunchTask": "build: elen-icon-theme",
|
|
9
|
+
"args": [
|
|
10
|
+
"--extensionDevelopmentPath=${workspaceFolder}/elen-icon-theme",
|
|
11
|
+
"${workspaceFolder}"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "Run Elen Language Extension",
|
|
16
|
+
"type": "extensionHost",
|
|
17
|
+
"request": "launch",
|
|
18
|
+
"preLaunchTask": "build: elen",
|
|
19
|
+
"args": [
|
|
20
|
+
"--extensionDevelopmentPath=${workspaceFolder}/elen",
|
|
21
|
+
"${workspaceFolder}"
|
|
22
|
+
],
|
|
23
|
+
"outFiles": [
|
|
24
|
+
"${workspaceFolder}/elen/dist/**/*.js"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "Run Elen Language + Icon Theme",
|
|
29
|
+
"type": "extensionHost",
|
|
30
|
+
"request": "launch",
|
|
31
|
+
"preLaunchTask": "build: extensions",
|
|
32
|
+
"args": [
|
|
33
|
+
"--extensionDevelopmentPath=${workspaceFolder}/elen",
|
|
34
|
+
"--extensionDevelopmentPath=${workspaceFolder}/elen-icon-theme",
|
|
35
|
+
"${workspaceFolder}"
|
|
36
|
+
],
|
|
37
|
+
"outFiles": [
|
|
38
|
+
"${workspaceFolder}/elen/dist/**/*.js"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"compounds": [
|
|
43
|
+
{
|
|
44
|
+
"name": "Watch Elen Extension",
|
|
45
|
+
"configurations": [
|
|
46
|
+
"Run Elen Language Extension"
|
|
47
|
+
],
|
|
48
|
+
"preLaunchTask": "watch: elen"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"workbench.iconTheme": "elen-icons-v2",
|
|
3
|
+
"files.associations": {
|
|
4
|
+
"*.elen": "elen"
|
|
5
|
+
},
|
|
6
|
+
"debug.onTaskErrors": "showErrors",
|
|
7
|
+
"[elen]": {
|
|
8
|
+
"editor.semanticHighlighting.enabled": false
|
|
9
|
+
},
|
|
10
|
+
"editor.tokenColorCustomizations": {
|
|
11
|
+
"textMateRules": [
|
|
12
|
+
{
|
|
13
|
+
"scope": [
|
|
14
|
+
"entity.name.tag.template.elen",
|
|
15
|
+
"meta.tag.template.elen entity.name.tag.template.elen"
|
|
16
|
+
],
|
|
17
|
+
"settings": {
|
|
18
|
+
"foreground": "#ffb86c"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"scope": [
|
|
23
|
+
"entity.name.tag.shell.elen",
|
|
24
|
+
"meta.tag.shell.elen entity.name.tag.shell.elen"
|
|
25
|
+
],
|
|
26
|
+
"settings": {
|
|
27
|
+
"foreground": "#15c01d"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"scope": [
|
|
32
|
+
"entity.name.tag.routes.elen",
|
|
33
|
+
"meta.tag.routes.elen entity.name.tag.routes.elen"
|
|
34
|
+
],
|
|
35
|
+
"settings": {
|
|
36
|
+
"foreground": "#ff79c6"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"scope": [
|
|
41
|
+
"meta.tag.shell.elen source.ts entity.name.function",
|
|
42
|
+
"meta.tag.shell.elen source.ts entity.name.function.ts"
|
|
43
|
+
],
|
|
44
|
+
"settings": {
|
|
45
|
+
"foreground": "#f8f8f2"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"scope": [
|
|
50
|
+
"meta.tag.shell.elen source.ts variable.other.property",
|
|
51
|
+
"meta.tag.shell.elen source.ts variable.other.property.ts"
|
|
52
|
+
],
|
|
53
|
+
"settings": {
|
|
54
|
+
"foreground": "#50fa7b"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"scope": [
|
|
59
|
+
"meta.tag.shell.elen source.ts storage.type",
|
|
60
|
+
"meta.tag.shell.elen source.ts storage.type.ts"
|
|
61
|
+
],
|
|
62
|
+
"settings": {
|
|
63
|
+
"foreground": "#000000"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"scope": [
|
|
68
|
+
"meta.decorator.annotation.elen"
|
|
69
|
+
],
|
|
70
|
+
"settings": {
|
|
71
|
+
"foreground": "#000000",
|
|
72
|
+
"fontStyle": "bold"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"scope": [
|
|
77
|
+
"support.type.decorator-target.elen"
|
|
78
|
+
],
|
|
79
|
+
"settings": {
|
|
80
|
+
"foreground": "#f1fa8c"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"scope": [
|
|
85
|
+
"entity.name.tag.style.elen",
|
|
86
|
+
"meta.tag.style.elen entity.name.tag.style.elen"
|
|
87
|
+
],
|
|
88
|
+
"settings": {
|
|
89
|
+
"foreground": "#55a7ff"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "build: elen",
|
|
6
|
+
"type": "shell",
|
|
7
|
+
"command": "npm",
|
|
8
|
+
"args": [
|
|
9
|
+
"run",
|
|
10
|
+
"compile"
|
|
11
|
+
],
|
|
12
|
+
"options": {
|
|
13
|
+
"cwd": "${workspaceFolder}/elen"
|
|
14
|
+
},
|
|
15
|
+
"problemMatcher": [
|
|
16
|
+
"$tsc"
|
|
17
|
+
],
|
|
18
|
+
"group": "build"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"label": "build: elen-icon-theme",
|
|
22
|
+
"type": "shell",
|
|
23
|
+
"command": "node",
|
|
24
|
+
"args": [
|
|
25
|
+
"-e",
|
|
26
|
+
"console.log('elen-icon-theme has no build step')"
|
|
27
|
+
],
|
|
28
|
+
"problemMatcher": []
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"label": "build: extensions",
|
|
32
|
+
"dependsOrder": "sequence",
|
|
33
|
+
"dependsOn": [
|
|
34
|
+
"build: elen",
|
|
35
|
+
"build: elen-icon-theme"
|
|
36
|
+
],
|
|
37
|
+
"problemMatcher": []
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"label": "watch: elen",
|
|
41
|
+
"type": "shell",
|
|
42
|
+
"command": "npm",
|
|
43
|
+
"args": [
|
|
44
|
+
"run",
|
|
45
|
+
"watch"
|
|
46
|
+
],
|
|
47
|
+
"options": {
|
|
48
|
+
"cwd": "${workspaceFolder}/elen"
|
|
49
|
+
},
|
|
50
|
+
"isBackground": true,
|
|
51
|
+
"problemMatcher": [
|
|
52
|
+
"$tsc-watch"
|
|
53
|
+
],
|
|
54
|
+
"group": "build"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
package/App.elen
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<h1>TEST</h1>
|
|
5
|
+
<view></view>
|
|
6
|
+
|
|
7
|
+
//// Those are events, you can write anything here, it will not be compiled.
|
|
8
|
+
//// @click, @change, @input, @blur,
|
|
9
|
+
//// @focus, @mouseenter, @mouseleave => event => squaring => writting squaring updates
|
|
10
|
+
//// reading squaring from template to template track changes and update the template.
|
|
11
|
+
//// join events with notations to create dynamic templates.
|
|
12
|
+
|
|
13
|
+
//// Those are events, you can write anything here, it will not be compiled.
|
|
14
|
+
//// @click, @change, @input, @blur,
|
|
15
|
+
//// @focus, @mouseenter, @mouseleave => event => squaring => writing squaring updates
|
|
16
|
+
//// reading squaring from template to template track changes and update the template.
|
|
17
|
+
//// join events with notations to create dynamic templates.
|
|
18
|
+
|
|
19
|
+
//// Event-to-Component Binding Example
|
|
20
|
+
//// This section dynamically binds events to component methods and properties.
|
|
21
|
+
//// Events update the Squaring class data model.
|
|
22
|
+
|
|
23
|
+
<button @click="handleClick($event)">Click Me</button>
|
|
24
|
+
<input @input="updateProperty" placeholder="Type here..." />
|
|
25
|
+
<Test></Test>
|
|
26
|
+
<shell>
|
|
27
|
+
import Test from './Test.elen';
|
|
28
|
+
|
|
29
|
+
public class App extends Component {
|
|
30
|
+
string title = "";
|
|
31
|
+
boolean exsist = false;
|
|
32
|
+
|
|
33
|
+
///read only
|
|
34
|
+
Component<Test> cmp;
|
|
35
|
+
|
|
36
|
+
///read only
|
|
37
|
+
Notation<boolean> notation;
|
|
38
|
+
|
|
39
|
+
///read only
|
|
40
|
+
Event<boolean> event;
|
|
41
|
+
|
|
42
|
+
override void init() {
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override void loaded() {
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override void beforeInit(){
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override void computed() {
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override string test() {
|
|
58
|
+
return "test";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</shell>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<visual>
|
|
65
|
+
.test{
|
|
66
|
+
background: red;
|
|
67
|
+
width: 100px;
|
|
68
|
+
height: 100px;
|
|
69
|
+
}
|
|
70
|
+
</visual>
|
package/README.MD
ADDED
|
File without changes
|
package/Test.elen
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="test">
|
|
3
|
+
Test component
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<shell>
|
|
7
|
+
public class Test extends Component {
|
|
8
|
+
override void init() {
|
|
9
|
+
}
|
|
10
|
+
override void loaded() {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
</shell>
|
|
14
|
+
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<visual>
|
|
18
|
+
.test {
|
|
19
|
+
background: blue;
|
|
20
|
+
width: 120px;
|
|
21
|
+
height: 120px;
|
|
22
|
+
color: white;
|
|
23
|
+
}
|
|
24
|
+
</visual>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// This script recursively finds all .ts files in the workspace and compiles them using the TypeScript compiler API.
|
|
2
|
+
// It can be run with `ts-node` or as a Node.js script after compilation.
|
|
3
|
+
|
|
4
|
+
const ts = require('typescript');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
process.on('uncaughtException', (err) => {
|
|
9
|
+
console.error('Uncaught Exception:', err);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
});
|
|
12
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
13
|
+
console.error('Unhandled Rejection:', reason);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
function findAllTsFiles(dir, fileList = []) {
|
|
18
|
+
const files = fs.readdirSync(dir);
|
|
19
|
+
files.forEach(file => {
|
|
20
|
+
const filePath = path.join(dir, file);
|
|
21
|
+
const stat = fs.statSync(filePath);
|
|
22
|
+
if (stat.isDirectory()) {
|
|
23
|
+
findAllTsFiles(filePath, fileList);
|
|
24
|
+
} else if (file.endsWith('.ts')) {
|
|
25
|
+
fileList.push(filePath);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return fileList;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function compileTsFile(filePath, rootDir, outDir) {
|
|
32
|
+
const program = ts.createProgram([filePath], {
|
|
33
|
+
outDir,
|
|
34
|
+
module: ts.ModuleKind.CommonJS,
|
|
35
|
+
target: ts.ScriptTarget.ES2020,
|
|
36
|
+
esModuleInterop: true,
|
|
37
|
+
strict: true,
|
|
38
|
+
skipLibCheck: true,
|
|
39
|
+
types: ['node'],
|
|
40
|
+
});
|
|
41
|
+
const emitResult = program.emit();
|
|
42
|
+
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
43
|
+
allDiagnostics.forEach(diagnostic => {
|
|
44
|
+
if (diagnostic.file) {
|
|
45
|
+
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
46
|
+
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
|
47
|
+
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
48
|
+
} else {
|
|
49
|
+
console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (emitResult.emitSkipped) {
|
|
53
|
+
throw new Error(`Failed to compile ${filePath}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function main() {
|
|
58
|
+
const rootDir = path.resolve(__dirname, '.');
|
|
59
|
+
const outDir = path.resolve(rootDir, 'dist');
|
|
60
|
+
const tsFiles = findAllTsFiles(rootDir);
|
|
61
|
+
if (tsFiles.length === 0) {
|
|
62
|
+
console.log('No TypeScript files found.');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
tsFiles.forEach(tsFile => {
|
|
66
|
+
compileTsFile(tsFile, rootDir, outDir);
|
|
67
|
+
});
|
|
68
|
+
console.log('All TypeScript files compiled successfully.');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
main();
|
|
73
|
+
} catch (err) {
|
|
74
|
+
console.error('Error during TypeScript compilation:', err);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n){typeof define=="function"&&define.amd?define(n):n()})(function(){"use strict"});
|
package/elen/App.elen
ADDED
package/elen/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 koick
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.deactivate = exports.activate = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const vscode = __importStar(require("vscode"));
|
|
29
|
+
const hoverDocs = {
|
|
30
|
+
"shell": "<shell> contains Elen component code and is highlighted as TypeScript inside .elen files.",
|
|
31
|
+
"routes": "<routes> defines route-aware components and navigation targets in index.html.",
|
|
32
|
+
"Component": "Component is the base Elen component class used by all shell components.",
|
|
33
|
+
"@input": "@input declares a data input property for the component.",
|
|
34
|
+
"@output": "@output declares an event output emitted by the component.",
|
|
35
|
+
"@component": "@component imports a component into the current shell component as a directive.",
|
|
36
|
+
"@components": "@components imports multiple component directives into the current shell component.",
|
|
37
|
+
"override": "override marks lifecycle hooks and methods that replace a parent implementation.",
|
|
38
|
+
"void": "void is the Elen/TypeScript return type for functions without a value.",
|
|
39
|
+
"string": "string is a primitive Elen/TypeScript type for text.",
|
|
40
|
+
"boolean": "boolean is a primitive Elen/TypeScript type for true/false values.",
|
|
41
|
+
"number": "number is a primitive Elen/TypeScript type for numeric values."
|
|
42
|
+
};
|
|
43
|
+
const decoratorCompletions = [
|
|
44
|
+
"@input",
|
|
45
|
+
"@output",
|
|
46
|
+
"@component",
|
|
47
|
+
"@components"
|
|
48
|
+
].map((label) => {
|
|
49
|
+
const item = new vscode.CompletionItem(label, vscode.CompletionItemKind.Keyword);
|
|
50
|
+
item.detail = "Elen decorator";
|
|
51
|
+
item.insertText = label;
|
|
52
|
+
return item;
|
|
53
|
+
});
|
|
54
|
+
function activate(context) {
|
|
55
|
+
context.subscriptions.push(vscode.languages.registerHoverProvider({ language: 'elen' }, {
|
|
56
|
+
provideHover(document, position) {
|
|
57
|
+
const wordRange = document.getWordRangeAtPosition(position, /[@A-Za-z0-9_]+/);
|
|
58
|
+
if (!wordRange) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const word = document.getText(wordRange);
|
|
62
|
+
const text = hoverDocs[word];
|
|
63
|
+
if (text) {
|
|
64
|
+
return new vscode.Hover(text);
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
const extractComponentClasses = async (files) => {
|
|
70
|
+
const names = new Set();
|
|
71
|
+
for (const uri of files) {
|
|
72
|
+
const doc = await vscode.workspace.openTextDocument(uri);
|
|
73
|
+
const text = doc.getText();
|
|
74
|
+
for (const match of text.matchAll(/\bclass\s+([A-Z][a-zA-Z0-9_]*)\s+extends\s+Component\b/g)) {
|
|
75
|
+
names.add(match[1]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return Array.from(names).sort();
|
|
79
|
+
};
|
|
80
|
+
const importFileCompletionItems = async (currentPrefix, currentDir) => {
|
|
81
|
+
const items = [];
|
|
82
|
+
const files = await vscode.workspace.findFiles('**/*.elen', '**/{dist,node_modules}/**', 100);
|
|
83
|
+
for (const uri of files) {
|
|
84
|
+
const relativePath = path.relative(currentDir, uri.fsPath).replace(/\\/g, '/');
|
|
85
|
+
const candidate = relativePath.startsWith('.') ? relativePath : `./${relativePath}`;
|
|
86
|
+
if (candidate.startsWith(currentPrefix)) {
|
|
87
|
+
const completionItem = new vscode.CompletionItem(candidate, vscode.CompletionItemKind.File);
|
|
88
|
+
completionItem.detail = 'Elen component file';
|
|
89
|
+
completionItem.insertText = candidate;
|
|
90
|
+
items.push(completionItem);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return items;
|
|
94
|
+
};
|
|
95
|
+
context.subscriptions.push(vscode.languages.registerCompletionItemProvider({ language: 'elen' }, {
|
|
96
|
+
async provideCompletionItems(document, position) {
|
|
97
|
+
const items = [];
|
|
98
|
+
const line = document.lineAt(position).text.substring(0, position.character);
|
|
99
|
+
const currentDir = path.dirname(document.uri.fsPath);
|
|
100
|
+
if (/\bimport\s+[A-Za-z0-9_]*$/.test(line)) {
|
|
101
|
+
['Component', 'string', 'boolean', 'number', 'void'].forEach((label) => {
|
|
102
|
+
const item = new vscode.CompletionItem(label, vscode.CompletionItemKind.Keyword);
|
|
103
|
+
item.detail = 'Elen type or keyword';
|
|
104
|
+
items.push(item);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (/@(?:input|output|component|components)?$/.test(line)) {
|
|
108
|
+
items.push(...decoratorCompletions);
|
|
109
|
+
}
|
|
110
|
+
if (/\b@components?\s+[A-Za-z0-9_]*$/.test(line)) {
|
|
111
|
+
const files = await vscode.workspace.findFiles('**/*.elen', '**/{dist,node_modules}/**', 100);
|
|
112
|
+
const names = await extractComponentClasses(files);
|
|
113
|
+
names.forEach((name) => {
|
|
114
|
+
const completionItem = new vscode.CompletionItem(name, vscode.CompletionItemKind.Class);
|
|
115
|
+
completionItem.detail = 'Elen component class';
|
|
116
|
+
items.push(completionItem);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const importPathMatch = /from\s+["']([^"']*)$/.exec(line);
|
|
120
|
+
if (importPathMatch) {
|
|
121
|
+
items.push(...await importFileCompletionItems(importPathMatch[1], currentDir));
|
|
122
|
+
}
|
|
123
|
+
return items.length ? items : undefined;
|
|
124
|
+
}
|
|
125
|
+
}, '.', '/', '@'));
|
|
126
|
+
}
|
|
127
|
+
exports.activate = activate;
|
|
128
|
+
function deactivate() {
|
|
129
|
+
}
|
|
130
|
+
exports.deactivate = deactivate;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const icon = path_1.default.join(__dirname, '..', 'icon.svg');
|
|
9
|
+
// Always resolve src directory relative to project root, not dist
|
|
10
|
+
const srcDir = path_1.default.resolve(__dirname, '../src');
|
|
11
|
+
function addIconToElenFiles(dir) {
|
|
12
|
+
const files = fs_1.default.readdirSync(dir);
|
|
13
|
+
files.forEach(file => {
|
|
14
|
+
const fullPath = path_1.default.join(dir, file);
|
|
15
|
+
const stat = fs_1.default.statSync(fullPath);
|
|
16
|
+
if (stat.isDirectory()) {
|
|
17
|
+
addIconToElenFiles(fullPath);
|
|
18
|
+
}
|
|
19
|
+
else if (file.endsWith('.elen')) {
|
|
20
|
+
fs_1.default.readFile(file, 'utf-8', (err, data) => {
|
|
21
|
+
console.log(data);
|
|
22
|
+
console.log(err);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
addIconToElenFiles(srcDir);
|
|
28
|
+
exports.default = addIconToElenFiles;
|
|
Binary file
|