From c81b559ff0ec68b2b879dc4a2cad05b6f44bbb3d Mon Sep 17 00:00:00 2001 From: zodiacfireworks Date: Tue, 17 Jun 2025 17:22:58 -0500 Subject: [PATCH 001/219] Update: github action workflow --- .github/workflows/github-pages.yml | 55 ++++++++++++++++++++++++++++++ .github/workflows/main.yml | 26 -------------- 2 files changed, 55 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/github-pages.yml delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 0000000..26b9a8f --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -0,0 +1,55 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - master + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install Dependencies + run: | + npm ci + + - name: Build Project + run: | + npm run build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: "build" + + + + deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 18797a9..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Build and Deploy -on: - push: - branches: - - master -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Use Node.js '12.x' - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm ci - - run: npm run build - - run: ls -l build - - name: Build and Deploy - uses: JamesIves/github-pages-deploy-action@4.1.1 - with: - branch: gh-pages # The branch the action should deploy to. - folder: build # The folder the action should deploy. From 9e26b55b8dddcb56a9d57c75c7776d5a7c9888f6 Mon Sep 17 00:00:00 2001 From: zodiacfireworks Date: Tue, 17 Jun 2025 17:25:44 -0500 Subject: [PATCH 002/219] Update: .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 6635cf5..a746381 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ node_modules !.env.example vite.config.js.timestamp-* vite.config.ts.timestamp-* + +.github/copilot-instructions.md +.vscode/ From e3b3ac871beb3c3e3f4f05ac8b7666ba8604f9a1 Mon Sep 17 00:00:00 2001 From: zodiacfireworks Date: Tue, 17 Jun 2025 17:31:04 -0500 Subject: [PATCH 003/219] Add: .editorconfig --- .editorconfig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f2a6127 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +indent_size = 4 +max_line_length = 80 + +[*.svelte] +quote_type = single + +[*.yml] +indent_size = 2 + +[*.html] +indent_size = 2 + +[*.md] +indent_size = 2 From cada61a5f0cea25a9309c38f9bfc40dd48e77286 Mon Sep 17 00:00:00 2001 From: zodiacfireworks Date: Tue, 17 Jun 2025 17:37:18 -0500 Subject: [PATCH 004/219] Update: use spaces instead of tabs and enforce it in .pretierrc, apply format to all files --- .editorconfig | 6 + .eslintrc.cjs | 56 +-- .github/workflows/github-pages.yml | 108 +++--- .prettierrc | 21 +- package.json | 78 ++--- playwright.config.ts | 12 +- src/app.d.ts | 12 +- src/app.html | 20 +- src/index.test.ts | 6 +- src/lib/EditInput.svelte | 79 ++--- src/lib/Editor.svelte | 298 ++++++++-------- src/lib/Options.svelte | 125 +++---- src/lib/Tree.svelte | 170 ++++----- src/python.js | 40 +-- src/routes/+layout.svelte | 149 ++++---- src/routes/+page.svelte | 534 +++++++++++++++-------------- src/routes/app.css | 152 ++++---- static/grammars/lark.lark | 2 +- svelte.config.js | 18 +- tsconfig.json | 30 +- vite.config.ts | 8 +- 21 files changed, 967 insertions(+), 957 deletions(-) diff --git a/.editorconfig b/.editorconfig index f2a6127..74a78ea 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,9 @@ max_line_length = 80 [*.svelte] quote_type = single +[*.json] +indent_size = 2 + [*.yml] indent_size = 2 @@ -20,3 +23,6 @@ indent_size = 2 [*.md] indent_size = 2 + +[*.lark] +indent_size = 4 diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ebc1958..77a3369 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,30 +1,30 @@ module.exports = { - root: true, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:svelte/recommended', - 'prettier' - ], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020, - extraFileExtensions: ['.svelte'] - }, - env: { - browser: true, - es2017: true, - node: true - }, - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser' - } - } - ] + root: true, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:svelte/recommended', + 'prettier' + ], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + parserOptions: { + sourceType: 'module', + ecmaVersion: 2020, + extraFileExtensions: ['.svelte'] + }, + env: { + browser: true, + es2017: true, + node: true + }, + overrides: [ + { + files: ['*.svelte'], + parser: 'svelte-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser' + } + } + ] }; diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index 26b9a8f..cf28768 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -1,55 +1,53 @@ -name: Deploy to GitHub Pages - -on: - push: - branches: - - master - -permissions: - contents: read - pages: write - id-token: write - -concurrency: - group: "pages" - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - - - name: Install Dependencies - run: | - npm ci - - - name: Build Project - run: | - npm run build - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: "build" - - - - deploy: - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 +name: Deploy to GitHub Pages + +on: + push: + branches: + - master + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: 'pages' + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install Dependencies + run: | + npm ci + + - name: Build Project + run: | + npm run build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'build' + + deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.prettierrc b/.prettierrc index a77fdde..3d15d65 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,9 +1,16 @@ { - "useTabs": true, - "singleQuote": true, - "trailingComma": "none", - "printWidth": 100, - "plugins": ["prettier-plugin-svelte"], - "pluginSearchDirs": ["."], - "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] + "useTabs": false, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "pluginSearchDirs": ["."], + "overrides": [ + { + "files": "*.svelte", + "options": { + "parser": "svelte" + } + } + ] } diff --git a/package.json b/package.json index 6223af7..8e7113c 100644 --- a/package.json +++ b/package.json @@ -1,41 +1,41 @@ { - "name": "lark-ide", - "version": "0.0.1", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "test": "playwright test", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "test:unit": "vitest", - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." - }, - "devDependencies": { - "@playwright/test": "^1.28.1", - "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/adapter-static": "^2.0.2", - "@sveltejs/kit": "^1.5.0", - "@typescript-eslint/eslint-plugin": "^5.45.0", - "@typescript-eslint/parser": "^5.45.0", - "eslint": "^8.28.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-svelte": "^2.26.0", - "monaco-types": "^0.1.0", - "prettier": "^2.8.0", - "prettier-plugin-svelte": "^2.8.1", - "svelte": "^3.54.0", - "svelte-check": "^3.0.1", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "vite": "^4.3.0", - "vitest": "^0.25.3" - }, - "type": "module", - "dependencies": { - "@fontsource/fira-mono": "^5.0.2", - "bulma": "^0.9.4" - } + "name": "lark-ide", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "test": "playwright test", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "test:unit": "vitest", + "lint": "prettier --plugin-search-dir . --check . && eslint .", + "format": "prettier --plugin-search-dir . --write ." + }, + "devDependencies": { + "@playwright/test": "^1.28.1", + "@sveltejs/adapter-auto": "^2.0.0", + "@sveltejs/adapter-static": "^2.0.2", + "@sveltejs/kit": "^1.5.0", + "@typescript-eslint/eslint-plugin": "^5.45.0", + "@typescript-eslint/parser": "^5.45.0", + "eslint": "^8.28.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-svelte": "^2.26.0", + "monaco-types": "^0.1.0", + "prettier": "^2.8.0", + "prettier-plugin-svelte": "^2.8.1", + "svelte": "^3.54.0", + "svelte-check": "^3.0.1", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^4.3.0", + "vitest": "^0.25.3" + }, + "type": "module", + "dependencies": { + "@fontsource/fira-mono": "^5.0.2", + "bulma": "^0.9.4" + } } diff --git a/playwright.config.ts b/playwright.config.ts index 1c5d7a1..62187d0 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,12 +1,12 @@ import type { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { - webServer: { - command: 'npm run build && npm run preview', - port: 4173 - }, - testDir: 'tests', - testMatch: /(.+\.)?(test|spec)\.[jt]s/ + webServer: { + command: 'npm run build && npm run preview', + port: 4173 + }, + testDir: 'tests', + testMatch: /(.+\.)?(test|spec)\.[jt]s/ }; export default config; diff --git a/src/app.d.ts b/src/app.d.ts index f59b884..addc02a 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -1,12 +1,12 @@ // See https://kit.svelte.dev/docs/types#app // for information about these interfaces declare global { - namespace App { - // interface Error {} - // interface Locals {} - // interface PageData {} - // interface Platform {} - } + namespace App { + // interface Error {} + // interface Locals {} + // interface PageData {} + // interface Platform {} + } } export {}; diff --git a/src/app.html b/src/app.html index f127699..2e81fc0 100644 --- a/src/app.html +++ b/src/app.html @@ -1,14 +1,14 @@ - - - - - %sveltekit.head% - - -
%sveltekit.body%
+ + + + + %sveltekit.head% + + +
%sveltekit.body%
- - + + diff --git a/src/index.test.ts b/src/index.test.ts index e07cbbd..701fbe0 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,7 +1,7 @@ import { describe, it, expect } from 'vitest'; describe('sum test', () => { - it('adds 1 + 2 to equal 3', () => { - expect(1 + 2).toBe(3); - }); + it('adds 1 + 2 to equal 3', () => { + expect(1 + 2).toBe(3); + }); }); diff --git a/src/lib/EditInput.svelte b/src/lib/EditInput.svelte index 2a136fb..076d8c3 100644 --- a/src/lib/EditInput.svelte +++ b/src/lib/EditInput.svelte @@ -1,45 +1,40 @@ -
- +
diff --git a/src/lib/Editor.svelte b/src/lib/Editor.svelte index de2b23a..af1c6a8 100644 --- a/src/lib/Editor.svelte +++ b/src/lib/Editor.svelte @@ -1,153 +1,145 @@ - - -
- + + +
diff --git a/src/lib/Options.svelte b/src/lib/Options.svelte index d223c14..5d27820 100644 --- a/src/lib/Options.svelte +++ b/src/lib/Options.svelte @@ -1,61 +1,64 @@ - - -
-
-
- -
-
- -
- -
-
- - \ No newline at end of file + + +
+
+
+ +
+
+ +
+ +
+
+ + diff --git a/src/lib/Tree.svelte b/src/lib/Tree.svelte index ddafe92..6d5240d 100644 --- a/src/lib/Tree.svelte +++ b/src/lib/Tree.svelte @@ -1,85 +1,85 @@ - - - -
    -
  • -{#if tree['type'] === 'Tree'} - {#if tree.children.length > 0} - - - - {tree.data} - - - {#if expanded} -
    - {#each [...tree.children] as child} - {#if child} - - {:else} - - {/if} - {/each} -
    - {/if} - {:else} - - - - {tree.data} - - - {/if} - -{:else} - -{tree} - -{/if} -
  • -
- - - + + +
    + +
  • + {#if tree['type'] === 'Tree'} + {#if tree.children.length > 0} + + + + {tree.data} + + + {#if expanded} +
    + {#each [...tree.children] as child} + {#if child} + + {:else} + + {/if} + {/each} +
    + {/if} + {:else} + + + + {tree.data} + + + {/if} + {:else} + {tree} + {/if} +
  • +
+ + diff --git a/src/python.js b/src/python.js index cadf2f4..df062ff 100644 --- a/src/python.js +++ b/src/python.js @@ -1,20 +1,20 @@ - -export default function init(callback, log) { - log && log("Loading Pyodide") - - require(['https://cdn.jsdelivr.net/pyodide/v0.18.0/full/pyodide.js'], (mod) => { - mod.loadPyodide({ indexURL : "https://cdn.jsdelivr.net/pyodide/v0.18.0/full/" }).then( async (pyodide) => { - console.log("Pyodide loaded", pyodide) - - log && log("Installing micropip") - await pyodide.loadPackage('micropip') - log && log("Downloading & Installing Lark") - await pyodide.runPythonAsync( "import micropip; await micropip.install('lark');" ); - pyodide.runPython( "import lark" ); - - callback(pyodide) - console.log('Ready!', pyodide) - - }) - }) -} \ No newline at end of file +export default function init(callback, log) { + log && log('Loading Pyodide'); + + require(['https://cdn.jsdelivr.net/pyodide/v0.18.0/full/pyodide.js'], (mod) => { + mod.loadPyodide({ indexURL: 'https://cdn.jsdelivr.net/pyodide/v0.18.0/full/' }).then( + async (pyodide) => { + console.log('Pyodide loaded', pyodide); + + log && log('Installing micropip'); + await pyodide.loadPackage('micropip'); + log && log('Downloading & Installing Lark'); + await pyodide.runPythonAsync("import micropip; await micropip.install('lark');"); + pyodide.runPython('import lark'); + + callback(pyodide); + console.log('Ready!', pyodide); + } + ); + }); +} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 6b229d0..773a1d3 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,93 +1,90 @@
- +
- +
-
-
+
\ No newline at end of file + #home { + margin-top: var(--base-margin); + margin-left: var(--base-margin); + } + #home img { + height: 50px; + } + nav { + display: flex; + align-items: center; + justify-content: space-between; + } + #title { + font-size: 40px; + font-family: sans-serif; + } + #right-panel { + width: 200px; + text-align: right; + margin: var(--base-margin); + } + diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 9179ddd..146e9e1 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,274 +1,288 @@ - Lark IDE + Lark IDE
- -
-
-
-
- - -
-
-
- -
-
- -
- -
-
- -
- -
- -
- {#if pyodide} - {#await parser_promise} - Building Parser... - {:then} - {#await result_promise} - Parsing... - {:then result} - {#if result} - - {:else} - No result - {/if} - {:catch e} -
+    
+
+
+
+