Skip to content

Commit

Permalink
Merge pull request #5 from aabounegm/playground
Browse files Browse the repository at this point in the history
Playground
  • Loading branch information
aabounegm authored Jan 8, 2025
2 parents 1c9eacd + 83e9941 commit c719bf6
Show file tree
Hide file tree
Showing 16 changed files with 3,652 additions and 1,770 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy playground

permissions:
pages: write
id-token: write

on:
push:
branches: [main]
workflow_dispatch:

jobs:
docs:
name: Build and deploy playground
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Build API docs
run: |
npm ci
npm run langium:generate
npm run build
npm run bundle
- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ out/
src/language/generated/
syntaxes/
*.tsbuildinfo
dist/
29 changes: 20 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Langium Web</title>
<link href="./static/styles.css" rel="stylesheet"/>
<title>Stella Playground</title>
<link href="./static/styles.css" rel="stylesheet" />
<script defer src="https://fizruk.github.io/stella/playground/stella.js"></script>
</head>

<body>
<div style="padding: 5px">
<h1>Stella in Langium</h1>
Please select which grammar definition you want to use with monaco-editor:
<br>
<a href="./static/monacoClassic.html">Stella + Monarch (Classic monaco-editor config)</a>
<br>
<a href="./static/monacoExtended.html">Stella + Textmate (Extended Vscode Extension Config)</a>
<header id="header">
<h1 style="font-size: 1.5em;">Stella Playground</h1>
<ul class="links">
<li><a href="https://fizruk.github.io/stella">Docs</a></li>
</ul>
</header>
<div id="wrapper">
<div id="monaco-editor-root"></div>
<div id="actions">
<div>
<button id="typecheck">Typecheck</button>
<button id="compile">Compile</button>
</div>
<div id="result">Loading...</div>
</div>
</div>

<script defer type="module" src="./src/web/main.ts"></script>
</body>

</html>
4,693 changes: 3,245 additions & 1,448 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"vscode-languageserver": "~9.0.1",
"chalk": "~5.3.0",
"commander": "~11.0.0",
"@codingame/monaco-vscode-editor-service-override": "~3.2.3",
"@codingame/monaco-vscode-keybindings-service-override": "~3.2.3",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~3.2.3",
"monaco-editor-wrapper": "~4.0.2",
"monaco-languageclient": "~8.1.1",
"vscode": "npm:@codingame/monaco-vscode-api@~3.2.3"
"@codingame/monaco-vscode-editor-service-override": "~11.1.2",
"@codingame/monaco-vscode-keybindings-service-override": "~11.1.2",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~11.1.2",
"monaco-editor-wrapper": "~6.0.0",
"monaco-languageclient": "~9.0.0",
"vscode": "npm:@codingame/monaco-vscode-api@~11.1.2"
},
"devDependencies": {
"@types/node": "^18.0.0",
Expand All @@ -46,11 +46,11 @@
"typescript": "~5.7.2",
"@types/vscode": "~1.67.0",
"concurrently": "~8.2.1",
"esbuild": "~0.20.2",
"esbuild": "~0.24.2",
"@codingame/esbuild-import-meta-url-plugin": "~1.0.2",
"vite": "~5.2.7",
"vite": "~6.0.7",
"http-server": "~14.1.1",
"vitest": "~1.4.0"
"vitest": "~2.1.8"
},
"volta": {
"node": "18.19.1",
Expand Down
33 changes: 0 additions & 33 deletions src/setupClassic.ts

This file was deleted.

86 changes: 0 additions & 86 deletions src/setupCommon.ts

This file was deleted.

71 changes: 0 additions & 71 deletions src/setupExtended.ts

This file was deleted.

18 changes: 18 additions & 0 deletions src/web/compiler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export type Result = { status: string; result: string };

declare function stellaTypecheck_(tmp: { input: string }): void;
declare function stellaCompile_(tmp: { input: string }): void;

export function typecheck(input: string): Result {
const tmp = { input };
stellaTypecheck_(tmp);
const result: Result = tmp as unknown as Result;
return result;
}

export function compile(input: string) {
const tmp = { input };
stellaCompile_(tmp);
const result: Result = tmp as unknown as Result;
return result;
}
12 changes: 12 additions & 0 deletions src/web/iframe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const isInIframe = window.self !== window.top;

export function hideHeaderInIframe() {
if (!isInIframe) return;

document.getElementById("header")?.remove();

const wrapper = document.getElementById("wrapper");
if (wrapper) {
wrapper.style.height = "100vh"; // account for the removed header
}
}
Loading

0 comments on commit c719bf6

Please sign in to comment.