Skip to content

Commit

Permalink
Merge pull request #983 from mammaadDeveloper/next-generation-ts
Browse files Browse the repository at this point in the history
Next generation ts
  • Loading branch information
BaseMax authored Jan 30, 2025
2 parents 8b81a92 + 09dcb22 commit e8146d1
Show file tree
Hide file tree
Showing 15 changed files with 226 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If applicable, add screenshots to help explain your problem.
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
**Mobile phone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/make-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test make run
on:
pull_request:
branches:
- main
permissions:
contents: read
jobs:
make-run:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install build-essential
- name: 'GCC Version'
run: |
gcc --version
- name: Build salam for Linux
run: |
make run
2 changes: 1 addition & 1 deletion .github/workflows/run-sync-script.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ jobs:
env:
DEFAULT_BRANCH: main
VALIDATE_ALL_CODEBASE: true
VALIDATE_PYTHON_ISORT: false # was incompatible with pre-commit isort
VALIDATE_PYTHON_RUFF: false # was incompatible with black
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FIX_HTML_PRETTIER: true
4 changes: 1 addition & 3 deletions .github/workflows/web-assembly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ jobs:
echo "EMSDK=/home/runner/work/Salam/Salam/emsdk" >> $GITHUB_ENV
echo "PATH=$PATH:/home/runner/work/Salam/Salam/emsdk:/home/runner/work/Salam/Salam/emsdk/upstream/emscripten" >> $GITHUB_ENV
- name: Run WebAssembly build script
run: |
chmod +x build-webassembly.sh
bash build-webassembly.sh
run: bash build-webassembly.sh
- name: Clone Salam-Editor repository
run: |
FIRST_NAME="Max"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Welcome to Salam! We're glad you're interested in contributing to our open-sourc

1. **Code Contributions**: Fix bugs, add new features, or improve existing code. Please follow our coding conventions and guidelines when submitting code contributions.

2. **Documentation**: Help write or improve documentation, including README files, code comments, and user guides, to ensure others can understand and use Salam effectively.
2. **Documentation**: Help write or improve documentation, including readme files, code comments, and user guides, to ensure others can understand and use Salam effectively.

3. **Testing**: Contribute to the quality and stability of Salam by writing and running tests, identifying bugs, and preventing regressions.

Expand Down
12 changes: 12 additions & 0 deletions example/image.salam
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
صفحه:

تصویر:
منبع="https://editor.salamlang.ir/images/favicon.svg"
تمام

جعبه:
رنگ پس زمینه = «زرد»

تمام

تمام
1 change: 1 addition & 0 deletions src/runtime/data/element/mediatypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const mediatypes = ['external', 'internal', 'download'];
112 changes: 78 additions & 34 deletions src/runtime/element/a.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,80 @@
import { RuntimeElement } from './../element';
import { languages } from './../data/element/language';
import { LanguageID } from './../../common/language/language';
import { RuntimeElementAttribute } from './../element_attribute';
import { RuntimeElementAttributeType } from './../element_attribute_type';
import { RuntimeElementAttributeValue } from './../element_attribute_value';
import {RuntimeElement} from './../element';
import {languages} from '../data/element/language';
import {LanguageID} from './../../common/language/language';
import {RuntimeElementAttribute} from '../element_attribute';
import {RuntimeElementAttributeType} from './../element_attribute_type';
import {RuntimeElementAttributeValue} from './../element_attribute_value';
import { mediatypes } from '../data/element/mediatypes';

export class RuntimeElementA extends RuntimeElement {
constructor() {
super(true, "a");
this.addText(LanguageID.LanguageEnglish, "link");
this.addText(LanguageID.LanguagePersian, "لینک");
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.StringNoEmpty, "download")
.addText(LanguageID.LanguagePersian, "دانلود")
.addText(LanguageID.LanguageEnglish, "download")
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Url, "href")
.addText(LanguageID.LanguagePersian, "منبع")
.addText(LanguageID.LanguageEnglish, "source")
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.String, "hreflang")
.addText(LanguageID.LanguagePersian, "language")
.addText(LanguageID.LanguageEnglish, "زبان")
.addReservedValues(
languages.map((language: any) =>
new RuntimeElementAttributeValue(language.code.toUpperCase())
.addAllText(language.name)
.addAllText(language.code)
)
)
);
}
};
constructor() {
super(true, 'a');
this.addText(LanguageID.LanguageEnglish, 'link');
this.addText(LanguageID.LanguagePersian, 'لینک');
this.addAttribute(
new RuntimeElementAttribute(
RuntimeElementAttributeType.StringNoEmpty,
'download'
)
.addText(LanguageID.LanguagePersian, 'دانلود')
.addText(LanguageID.LanguageEnglish, 'download')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Url, 'href')
.addText(LanguageID.LanguagePersian, 'منبع')
.addText(LanguageID.LanguageEnglish, 'source')
);
this.addAttribute(
new RuntimeElementAttribute(
RuntimeElementAttributeType.String,
'hreflang'
)
.addText(LanguageID.LanguagePersian, 'language')
.addText(LanguageID.LanguageEnglish, 'زبان')
.addReservedValues(
languages.map((language) =>
new RuntimeElementAttributeValue(language.code.toUpperCase())
.addAllText(language.name)
.addAllText(language.code)
)
)
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.CSSMedia, 'media')
.addText(LanguageID.LanguageEnglish, 'media')
.addText(LanguageID.LanguagePersian, 'رسانه')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Urls, 'ping')
.addText(LanguageID.LanguageEnglish, 'ping')
.addText(LanguageID.LanguagePersian, 'پینگ')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.String, 'referrerpolicy')
.addText(LanguageID.LanguageEnglish, 'referrerpolicy')
.addText(LanguageID.LanguagePersian, 'سیاست ارجاع')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.String, 'rel')
.addText(LanguageID.LanguageEnglish, 'rel')
.addText(LanguageID.LanguagePersian, 'رابطه')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.String, 'target')
.addText(LanguageID.LanguageEnglish, 'target')
.addText(LanguageID.LanguagePersian, 'هدف')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.String, 'type')
.addText(LanguageID.LanguageEnglish, 'type')
.addText(LanguageID.LanguagePersian, 'نوع')
.addReservedValues(
mediatypes.map(mediatype =>
new RuntimeElementAttributeValue(mediatype)
.addAllText(mediatype)
)
)
);

}
}
24 changes: 16 additions & 8 deletions src/runtime/element/area.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { LanguageID } from "./../../common/language/language";
import { RuntimeElement } from "./../element";
import { RuntimeElementAttribute } from "./../element_attribute";
import { RuntimeElementAttributeType } from "./../element_attribute_type";
import { RuntimeElementAttributeValue } from "./../element_attribute_value";
import { languages } from './../data/element/language';
import { LanguageID } from "../../common/language/language";
import { RuntimeElement } from "../element";
import { RuntimeElementAttribute } from "../element_attribute";
import { RuntimeElementAttributeType } from "../element_attribute_type";
import { RuntimeElementAttributeValue } from "../element_attribute_value";

export class RuntimeElementArea extends RuntimeElement {
constructor() {
super(true, "area");
this.addText(LanguageID.LanguageEnglish, "area");
this.addText(LanguageID.LanguagePersian, "منطقه");
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.StringNoEmpty, "alt")
new RuntimeElementAttribute(RuntimeElementAttributeType.AnyNoEmpty, "alt")
.addText(LanguageID.LanguagePersian, "متن جایگزین")
.addText(LanguageID.LanguageEnglish, "alternative text")
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.StringNoEmpty, "download")
new RuntimeElementAttribute(RuntimeElementAttributeType.AnyNoEmpty, "download")
.addText(LanguageID.LanguagePersian, "دانلود")
.addText(LanguageID.LanguageEnglish, "download")
);
Expand All @@ -31,9 +32,16 @@ export class RuntimeElementArea extends RuntimeElement {
);
// Todo: Fix this
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.StringNoEmpty, "hreflang")
new RuntimeElementAttribute(RuntimeElementAttributeType.String, "hreflang")
.addText(LanguageID.LanguagePersian, "زبان")
.addText(LanguageID.LanguageEnglish, "source language")
.addReservedValues(
languages.map(language =>
new RuntimeElementAttributeValue(language.code)
.addAllText(language.name)
.addAllText(language.code)
)
)
);
}
}
18 changes: 11 additions & 7 deletions src/runtime/element/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ export class RuntimeElementAudio extends RuntimeElement {
new RuntimeElementAttribute(RuntimeElementAttributeType.String, 'preload')
.addText(LanguageID.LanguageEnglish, 'preload')
.addText(LanguageID.LanguagePersian, 'پیش‌بارگذاری')
.addReservedValues(
languages.map((language: any) =>
new RuntimeElementAttributeValue(language.code.toUpperCase())
.addAllText(language.name)
.addAllText(language.code)
)
)
.addReservedValues([
new RuntimeElementAttributeValue('auto')
.addText(LanguageID.LanguageEnglish, 'auto')
.addText(LanguageID.LanguagePersian, 'خودکار'),
new RuntimeElementAttributeValue('metadata')
.addText(LanguageID.LanguageEnglish, 'metadata')
.addText(LanguageID.LanguagePersian, 'داده'),
new RuntimeElementAttributeValue('none')
.addText(LanguageID.LanguageEnglish, 'none')
.addText(LanguageID.LanguagePersian, 'پیشفرض'),
])
);
}
}
10 changes: 10 additions & 0 deletions src/runtime/element/em.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { LanguageID } from "../../common/language/language";
import { RuntimeElement } from "../element";

export class RuntimeElementEm extends RuntimeElement{
constructor(){
super(true, 'em');
this.addText(LanguageID.LanguagePersian, 'em');
this.addText(LanguageID.LanguagePersian, 'ای ام');
}
}
10 changes: 10 additions & 0 deletions src/runtime/element/footer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { LanguageID } from "../../common/language/language";
import { RuntimeElement } from "../element";

export class RuntimeElementFooter extends RuntimeElement{
constructor(){
super(true, 'footer');
this.addText(LanguageID.LanguageEnglish, 'footer');
this.addText(LanguageID.LanguagePersian, 'فوتر');
}
}
1 change: 1 addition & 0 deletions src/runtime/element/form.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// ToDo: Form tag
60 changes: 60 additions & 0 deletions src/runtime/element/img.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { LanguageID } from './../../common/language/language';
import { RuntimeElementAttribute } from './../element_attribute';
import { RuntimeElementAttributeType } from './../element_attribute_type';
import { crossorigins } from './../data/element/values/crossorigin';
import { RuntimeElementAttributeValue } from '../element_attribute_value';

export class RuntimeElementA extends RuntimeElement {
constructor() {
Expand All @@ -20,5 +21,64 @@ export class RuntimeElementA extends RuntimeElement {
.addText(LanguageID.LanguageEnglish, "کراس اوریجن")
.addReservedValues(crossorigins)
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Size, 'height')
.addText(LanguageID.LanguageEnglish, 'height')
.addText(LanguageID.LanguagePersian, 'ارتفاع')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Boolean, 'ismap')
.addText(LanguageID.LanguageEnglish, 'ismap')
.addText(LanguageID.LanguagePersian, 'ایز مپ')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Size, 'loading')
.addText(LanguageID.LanguageEnglish, 'loading')
.addText(LanguageID.LanguagePersian, 'لودینگ')
.addReservedValues([
new RuntimeElementAttributeValue('eager')
.addText(LanguageID.LanguageEnglish, 'eager')
.addText(LanguageID.LanguagePersian, 'مشتاق'),
new RuntimeElementAttributeValue('lazy')
.addText(LanguageID.LanguageEnglish, 'lazy')
.addText(LanguageID.LanguagePersian, 'لیزی')
])
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Url, 'longdesc')
.addText(LanguageID.LanguageEnglish, 'longdesc')
.addText(LanguageID.LanguagePersian, 'توضیح طولانی')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.String, 'referrerpolicy')
.addText(LanguageID.LanguageEnglish, 'referrerpolicy')
.addText(LanguageID.LanguagePersian, 'ریفر پالیسی')
// ToDo: referrerpolicy values
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Sizes, 'sizes')
.addText(LanguageID.LanguageEnglish, 'sizes')
.addText(LanguageID.LanguagePersian, 'اسایز ها')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Url, 'src')
.addText(LanguageID.LanguageEnglish, 'src')
.addText(LanguageID.LanguagePersian, 'منبع')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Urls, 'secret')
.addText(LanguageID.LanguageEnglish, 'secret')
.addText(LanguageID.LanguagePersian, 'ست منبع')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.ID, 'usemap')
.addText(LanguageID.LanguageEnglish, 'usemap')
.addText(LanguageID.LanguagePersian, 'یوز مپ')
);
this.addAttribute(
new RuntimeElementAttribute(RuntimeElementAttributeType.Size, 'width')
.addText(LanguageID.LanguageEnglish, 'width')
.addText(LanguageID.LanguagePersian, 'عرض')
);
}
};

0 comments on commit e8146d1

Please sign in to comment.