Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Small-JS/SmallJS
Browse files Browse the repository at this point in the history
  • Loading branch information
FunctionPoint committed Jul 22, 2024
2 parents 549bc2e + 3465a99 commit e7dbed7
Show file tree
Hide file tree
Showing 34 changed files with 101 additions and 103 deletions.
14 changes: 7 additions & 7 deletions Compiler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"dependencies": {
"@types/node": "^20.14.9",
"@types/node": "^20.14.10",
"source-map": "^0.7.4"
}
}
10 changes: 5 additions & 5 deletions Examples/Benchmark/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
<thead>
<tr class="tableHeader">
<th scope="col">
<label>Name</label>
Name
</th>
<th scope="col">
<label>Size</label>
Size
</th>
<th scope="col">
<label>Time JS</label>
Time JS
</th>
<th scope="col">
<label>Time ST</label>
Time ST
</th>
<th scope="col">
<label>Factor</label>
Factor
</th>
</tr>
</thead>
Expand Down
10 changes: 5 additions & 5 deletions Examples/Counter/src/CounterApp.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS CounterApp EXTENDS BrowserApp MODULE CounterApp CLASSVARS ''
VARS 'counter counterLabel incrementButton resetButton'
VARS 'counter counterSpan incrementButton resetButton'

start
counter := Counter new.
Expand All @@ -12,7 +12,7 @@ start
bindElements
"Bind HTML elements to vars, set defaults, set event listeners."

counterLabel := Document getElementById: 'counterLabel' class: HtmlLabelElement.
counterSpan := Document getElementById: 'counterSpan' class: HtmlSpanElement.

incrementButton := Document getElementById: 'incrementButton' class: HtmlButtonElement.
incrementButton onClick: [ self increment ].
Expand All @@ -23,7 +23,7 @@ bindElements
update
"Update counter in HTML page."

counterLabel textContent: counter value toString.
counterSpan textContent: counter value toString.
!
increment
"Increase the counter and update the view."
Expand All @@ -40,8 +40,8 @@ reset

"Accessing (used by tests)"

counterLabel
^ counterLabel.
counterSpan
^ counterSpan.
!
incrementButton
^ incrementButton.
Expand Down
2 changes: 1 addition & 1 deletion Examples/Counter/src/Test/TestCounterApp.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ testButton: button result: result then: block
"Press argument button and check result in counter label."
button click.
Timer timeout: 500 then: [
self assert: [ counterApp counterLabel textContent = result ].
self assert: [ counterApp counterSpan textContent = result ].
block value ].
!
2 changes: 1 addition & 1 deletion Examples/Counter/web/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
margin-bottom: 0px;
}

#counterLabel {
#counterSpan {
font-family: Garamond;
font-size: 100px;
font-weight: bold;
Expand Down
Binary file modified Examples/Counter/web/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion Examples/Counter/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</tr>
<tr>
<td>
<label id="counterLabel"></label>
<span id="counterSpan"></span>
</td>
</tr>
<tr>
Expand Down
8 changes: 4 additions & 4 deletions Examples/Shop/Client/src/App/LoginApp.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS LoginApp EXTENDS BrowserApp MODULE ShopClient CLASSVARS ''
VARS 'userNameInput passwordInput loginButton loginErrorLabel'
VARS 'userNameInput passwordInput loginButton loginErrorSpan'

METHODS

Expand Down Expand Up @@ -27,7 +27,7 @@ bindElements
loginButton := Document getElementById: 'loginButton' class: HtmlButtonElement.
loginButton onClick: [ :event | self onLogin ].

loginErrorLabel := Document getElementById: 'loginErrorLabel' class: HtmlLabelElement.
loginErrorSpan := Document getElementById: 'loginErrorSpan' class: HtmlSpanElement.
!
onLogin
| userName password loginApi |
Expand All @@ -50,10 +50,10 @@ onLoginResponse: object

success
ifTrue: [ self navigateTo: '../Product/Product.html' ]
ifFalse: [ loginErrorLabel textContent: message ].
ifFalse: [ loginErrorSpan textContent: message ].
!
onLoginError: error
loginErrorLabel textContent: error message.
loginErrorSpan textContent: error message.
!

"Accessing (used by tests)"
Expand Down
2 changes: 1 addition & 1 deletion Examples/Shop/Client/web/Login/Login.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</tr>
<tr>
<td>
<label id="loginErrorLabel"></label>
<span id="loginErrorSpan"></soan>
</td>
</tr>
</table>
Expand Down
2 changes: 1 addition & 1 deletion Examples/Shop/Client/web/NavBar/NavBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
justify-content: center;
}

#navBarLabel {
#navBarSpan {
font-weight: bold;
}

Expand Down
2 changes: 1 addition & 1 deletion Examples/Shop/Client/web/NavBar/NavBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<img id="shopLogo" src="../ShopLogo.png" alt="Shop logo" width="32" height="32"/>
</td>
<td>
<label id="navBarLabel">Shop</label>
<span id="navBarSpan">Shop</span>
</td>
<td>
<a id="productsLink" href="../Product/Product.html">Products</a>
Expand Down
6 changes: 3 additions & 3 deletions Examples/Shop/Client/web/Order/Order.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
<thead>
<tr>
<th scope="col">
<label id="productLabel" class="orderTableHeader">Product</label>
<span id="productSpan" class="orderTableHeader">Product</span>
</th>
<th scope="col">
<label id="amountLabel" class="orderTableHeader">Amount</label>
<span id="amountSpan" class="orderTableHeader">Amount</span>
</th>
<th scope="col">
<label id="priceLabel" class="orderTableHeader">Price</label>
<span id="priceSpan" class="orderTableHeader">Price</span>
</th>
</tr>
</thead>
Expand Down
4 changes: 2 additions & 2 deletions Examples/Shop/Client/web/Product/Product.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
<thead>
<tr>
<th scope="col">
<label id="productNameLabel" class="productTableHeader">Name</label>
<span id="productNameSpan" class="productTableHeader">Name</span>
</th>
<th scope="col">
<label id="productNameLabel" class="productTableHeader">Price</label>
<span id="productNameSpan" class="productTableHeader">Price</span>
</th>
</tr>
</thead>
Expand Down
8 changes: 4 additions & 4 deletions Examples/Shop/ClientSpa/src/Component/LoginComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS LoginComponent EXTENDS Component MODULE ShopClient CLASSVARS ''
VARS 'userNameInput passwordInput loginButton loginErrorLabel'
VARS 'userNameInput passwordInput loginButton loginErrorSpan'

htmlPath
^ 'Login/Login.html'.
Expand All @@ -21,7 +21,7 @@ bindElements
loginButton := Document getElementById: 'loginButton' class: HtmlButtonElement.
loginButton onClick: [ :event | self onLogin ].

loginErrorLabel := Document getElementById: 'loginErrorLabel' class: HtmlLabelElement.
loginErrorSpan := Document getElementById: 'loginErrorSpan' class: HtmlSpanElement.
!
onLogin
| userName password loginApi |
Expand All @@ -44,10 +44,10 @@ onLoginResponse: object

success
ifTrue: [ self app loadComponent: ProductComponent ]
ifFalse: [ loginErrorLabel textContent: message ].
ifFalse: [ loginErrorSpan textContent: message ].
!
onLoginError: error
loginErrorLabel textContent: error message.
loginErrorSpan textContent: error message.
!

"Accessing (used by tests)"
Expand Down
10 changes: 5 additions & 5 deletions Examples/Shop/ClientSpa/src/Component/NavBarComponent.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CLASS NavBarComponent EXTENDS Component MODULE ShopClient CLASSVARS ''
VARS 'productsLabel ordersLabel'
VARS 'productsSpan ordersSpan'

htmlPath
^ 'NavBar/NavBar.html'.
Expand All @@ -8,9 +8,9 @@ start
self bindElements.
!
bindElements
productsLabel := Document getElementById: 'navBarProductsLabel' class: HtmlLabelElement.
productsLabel onClick: [ :event | self app loadComponent: ProductComponent ].
productsSpan := Document getElementById: 'navBarProductsSpan' class: HtmlSpanElement.
productsSpan onClick: [ :event | self app loadComponent: ProductComponent ].

ordersLabel := Document getElementById: 'navBarOrdersLabel' class: HtmlLabelElement.
ordersLabel onClick: [ :event | self app loadComponent: OrderComponent ].
ordersSpan := Document getElementById: 'navBarOrdersSpan' class: HtmlSpanElement.
ordersSpan onClick: [ :event | self app loadComponent: OrderComponent ].
!
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ testProductFields
self assert: [ ( cells at: 1 ) textContent = '1.00' ].
!
navigateToOrders
| ordersLabel |
| ordersSpan |

ordersLabel := Document getElementById: 'navBarOrdersLabel' class: HtmlLabelElement.
ordersLabel click.
ordersSpan := Document getElementById: 'navBarOrdersSpan' class: HtmlSpanElement.
ordersSpan click.
!
2 changes: 1 addition & 1 deletion Examples/Shop/ClientSpa/web/Login/Login.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</tr>
<tr>
<td>
<label id="loginErrorLabel"></label>
<span id="loginErrorSpan"></span>
</td>
</tr>
</table>
2 changes: 1 addition & 1 deletion Examples/Shop/ClientSpa/web/NavBar/NavBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
justify-content: center;
}

#navBarLabel {
#navBarSpan {
font-weight: bold;
}

Expand Down
6 changes: 3 additions & 3 deletions Examples/Shop/ClientSpa/web/NavBar/NavBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<img id="shopLogo" src="../ShopLogo.png" alt="Shop logo" width="32" height="32"/>
</td>
<td>
<label id="navBarLabel">Shop</label>
<span id="navBarSpan">Shop</span>
</td>
<td>
<label id="navBarProductsLabel" class="navBarMenuItem">Products</label>
<span id="navBarProductsSpan" class="navBarMenuItem">Products</span>
<td>
<label id="navBarOrdersLabel" class="navBarMenuItem">Orders</label>
<span id="navBarOrdersSpan" class="navBarMenuItem">Orders</span>
</td>
</tr>
</table>
4 changes: 1 addition & 3 deletions Examples/Shop/ClientSpa/web/Order/Order.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@import "../App.css";

#orderTable {
#orderTable {
margin-left: auto;
margin-right: auto;
border: 2px solid grey;
Expand Down
6 changes: 3 additions & 3 deletions Examples/Shop/ClientSpa/web/Order/Order.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<thead>
<tr>
<th scope="col">
<label id="productLabel" class="orderTableHeader">Product</label>
<span id="productSpan" class="orderTableHeader">Product</span>
</th>
<th scope="col">
<label id="amountLabel" class="orderTableHeader">Amount</label>
<span id="amountSpan" class="orderTableHeader">Amount</span>
</th>
<th scope="col">
<label id="priceLabel" class="orderTableHeader">Price</label>
<span id="priceSpan" class="orderTableHeader">Price</span>
</th>
</tr>
</thead>
Expand Down
4 changes: 2 additions & 2 deletions Examples/Shop/ClientSpa/web/Product/Product.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<thead>
<tr>
<th scope="col">
<label id="productNameLabel" class="productTableHeader">Name</label>
<span id="productNameSpan" class="productTableHeader">Name</span>
</th>
<th scope="col">
<label id="productNameLabel" class="productTableHeader">Price</label>
<span id="productNameSpan" class="productTableHeader">Price</span>
</th>
</tr>
</thead>
Expand Down
14 changes: 7 additions & 7 deletions Examples/Shop/Server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Examples/Shop/Server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"dependencies": {
"@types/node": "^20.14.9",
"@types/node": "^20.14.10",
"express": "^4.19.2",
"express-session": "^1.18.0",
"http-terminator": "^3.2.0",
Expand Down
Loading

0 comments on commit e7dbed7

Please sign in to comment.