-
Notifications
You must be signed in to change notification settings - Fork 12
Add sample projects to code editor test page #1294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3dc96b6
Allow an 'initialProject' to be set
zetter-rpf 71d3410
Setup sample projects for the web component test page
zetter-rpf f3dc985
Add changelog
zetter-rpf 0f015e4
Try turning on test isolation to fix failing test
zetter-rpf 187f850
Try clicking buttons the same way as the other tests
zetter-rpf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "identifier": "blank-html-starter", | ||
| "project_type": "html", | ||
| "locale": "en", | ||
| "name": "Blank HTML & CSS Starter", | ||
| "user_id": null, | ||
| "instructions": null, | ||
| "components": [ | ||
| { | ||
| "id": "42b4cdc9-d935-4a3d-b39a-32eb44c5ebfd", | ||
| "name": "index", | ||
| "extension": "html", | ||
| "content": "" | ||
| }, | ||
| { | ||
| "id": "3b6e4869-5873-4782-8764-7bf844578a22", | ||
| "name": "styles", | ||
| "extension": "css", | ||
| "content": "" | ||
| } | ||
| ], | ||
| "image_list": [], | ||
| "videos": [], | ||
| "audio": [] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "identifier": "blank-python-starter", | ||
| "project_type": "python", | ||
| "locale": "en", | ||
| "name": "Blank Python Starter", | ||
| "user_id": null, | ||
| "instructions": null, | ||
| "components": [ | ||
| { | ||
| "id": "42b4cdc9-d935-4a3d-b39a-32eb44c5ebfe", | ||
| "name": "main", | ||
| "extension": "py", | ||
| "content": "" | ||
| } | ||
| ], | ||
| "image_list": [], | ||
| "videos": [], | ||
| "audio": [] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "identifier": "cool-html", | ||
| "project_type": "html", | ||
| "locale": "en", | ||
| "name": "Cool HTML: Spotlight Gradient", | ||
| "user_id": null, | ||
| "instructions": { | ||
| "content": "## Cool HTML: Spotlight Gradient\n\nA tiny project with **one** cool trick: an animated gradient background with a mouse/touch **spotlight** that follows you.\n\n### Controls\n- Move cursor / drag: move the spotlight\n- Click: cycle color palettes\n\nFiles: `index.html`, `styles.css`, `script.js`\n", | ||
| "permitOverride": false | ||
| }, | ||
| "components": [ | ||
| { | ||
| "id": "1c7ab1a8-5f09-4b3e-9d0d-6c8c2f2d2a8a", | ||
| "name": "index", | ||
| "extension": "html", | ||
| "content": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>Spotlight Gradient</title>\n <link rel=\"stylesheet\" href=\"styles.css\" />\n </head>\n <body>\n <main class=\"wrap\">\n <h1>Spotlight Gradient</h1>\n <p>Move your mouse. Click to change colors.</p>\n <button id=\"next\" type=\"button\">Next palette</button>\n </main>\n\n <script src=\"script.js\"></script>\n </body>\n</html>\n" | ||
| }, | ||
| { | ||
| "id": "d9d292e1-20c8-4e55-bad8-2b2c7a4b5f9b", | ||
| "name": "styles", | ||
| "extension": "css", | ||
| "content": ":root {\n --a: #7c3aed;\n --b: #22d3ee;\n --c: #a3ff12;\n --x: 50%;\n --y: 50%;\n}\n\n* {\n box-sizing: border-box;\n}\n\nhtml,\nbody {\n height: 100%;\n}\n\nbody {\n margin: 0;\n color: rgba(255, 255, 255, 0.92);\n font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;\n\n /* Animated gradient layer */\n background: radial-gradient(900px 600px at 20% 20%, rgba(255, 255, 255, 0.07), transparent 60%),\n conic-gradient(from 180deg, var(--a), var(--b), var(--c), var(--a));\n background-size: 100% 100%, 140% 140%;\n animation: drift 10s ease-in-out infinite;\n\n /* Spotlight (follows pointer via CSS vars) */\n position: relative;\n overflow: hidden;\n}\n\nbody::before {\n content: \"\";\n position: absolute;\n inset: -30%;\n pointer-events: none;\n background: radial-gradient(300px 300px at var(--x) var(--y), rgba(255, 255, 255, 0.22), transparent 60%);\n mix-blend-mode: screen;\n filter: blur(6px);\n}\n\nbody::after {\n content: \"\";\n position: absolute;\n inset: 0;\n pointer-events: none;\n background: radial-gradient(800px 500px at var(--x) var(--y), rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.72));\n}\n\n@keyframes drift {\n 0% {\n background-position: 0% 0%, 30% 50%;\n }\n 50% {\n background-position: 0% 0%, 70% 40%;\n }\n 100% {\n background-position: 0% 0%, 30% 50%;\n }\n}\n\n.wrap {\n position: relative;\n z-index: 1;\n height: 100%;\n display: grid;\n place-content: center;\n gap: 10px;\n padding: 24px;\n text-align: center;\n}\n\nh1 {\n margin: 0;\n font-size: clamp(30px, 5vw, 54px);\n letter-spacing: -0.03em;\n}\n\np {\n margin: 0;\n color: rgba(255, 255, 255, 0.70);\n}\n\nbutton {\n justify-self: center;\n padding: 10px 14px;\n border-radius: 12px;\n border: 1px solid rgba(255, 255, 255, 0.22);\n background: rgba(0, 0, 0, 0.28);\n color: rgba(255, 255, 255, 0.92);\n cursor: pointer;\n}\n\n@media (prefers-reduced-motion: reduce) {\n body {\n animation: none;\n }\n}\n" | ||
| }, | ||
| { | ||
| "id": "a4a5c67c-4bdb-4c9d-94de-0d4b15b093f2", | ||
| "name": "script", | ||
| "extension": "js", | ||
| "content": "(() => {\n const root = document.documentElement;\n const palettes = [\n ['#7c3aed', '#22d3ee', '#a3ff12'],\n ['#fb7185', '#38bdf8', '#fbbf24'],\n ['#34d399', '#60a5fa', '#a78bfa'],\n ];\n let idx = 0;\n\n function setPalette(i) {\n const [a, b, c] = palettes[i % palettes.length];\n root.style.setProperty('--a', a);\n root.style.setProperty('--b', b);\n root.style.setProperty('--c', c);\n }\n\n function setSpotlight(clientX, clientY) {\n root.style.setProperty('--x', `${(clientX / innerWidth) * 100}%`);\n root.style.setProperty('--y', `${(clientY / innerHeight) * 100}%`);\n }\n\n addEventListener('mousemove', (e) => setSpotlight(e.clientX, e.clientY));\n addEventListener(\n 'touchmove',\n (e) => {\n const t = e.touches && e.touches[0];\n if (t) setSpotlight(t.clientX, t.clientY);\n },\n { passive: true },\n );\n\n function next() {\n idx = (idx + 1) % palettes.length;\n setPalette(idx);\n }\n\n document.getElementById('next')?.addEventListener('click', next);\n addEventListener('click', (e) => {\n if (e.target?.id !== 'next') next();\n });\n\n setPalette(idx);\n setSpotlight(innerWidth * 0.5, innerHeight * 0.5);\n})();\n" | ||
| } | ||
| ], | ||
| "image_list": [], | ||
| "videos": [], | ||
| "audio": [] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "identifier": "cool-python", | ||
| "project_type": "python", | ||
| "locale": "en", | ||
| "name": "Cool Python: ASCII Orb", | ||
| "user_id": null, | ||
| "instructions": { | ||
| "content": "## Cool Python: ASCII Orb\n\nA minimal project that prints a single shaded **ASCII orb** (a circle with simple lighting).\n\n### Try this\n- Change `WIDTH` / `HEIGHT` in `main.py`\n- Change the `light_dx` / `light_dy` values to move the highlight\n- Swap the `SHADES` string in `ascii_orb.py` to change the look\n\nFiles:\n- `main.py` (entry point)\n- `ascii_orb.py` (helper that renders the orb)\n", | ||
| "permitOverride": false | ||
| }, | ||
| "components": [ | ||
| { | ||
| "id": "9b5a24a8-7d15-4a34-8a59-7b0a1f1b19b2", | ||
| "name": "main", | ||
| "extension": "py", | ||
| "content": "from ascii_orb import render_orb\n\n\ndef main():\n # Keep this reasonably small so it fits nicely in the output panel\n WIDTH = 48\n HEIGHT = 24\n\n art = render_orb(width=WIDTH, height=HEIGHT, light_dx=-0.35, light_dy=-0.25)\n print(art)\n\n\nif __name__ == \"__main__\":\n main()\n" | ||
| }, | ||
| { | ||
| "id": "5e0a8f3d-3c54-44f9-9fd9-75d41c1bb447", | ||
| "name": "ascii_orb", | ||
| "extension": "py", | ||
| "content": "import math\n\n\n# Dark -> light. Try: \" .:-=+*#%@\"\nSHADES = \" .:-=+*#%@\"\n\n\ndef render_orb(width=48, height=24, light_dx=-0.35, light_dy=-0.25):\n \"\"\"Render a shaded ASCII circle (an \"orb\") as a multiline string.\n\n light_dx/light_dy shift the highlight direction (-1..1 range feels good).\n \"\"\"\n\n w = int(width)\n h = int(height)\n cx = (w - 1) / 2.0\n cy = (h - 1) / 2.0\n\n # Keep the circle round-ish in terminal characters\n aspect = 2.0\n r = min(cx, cy) * 0.95\n\n lines = []\n for y in range(h):\n row = []\n for x in range(w):\n nx = (x - cx) / r\n ny = ((y - cy) / r) * aspect\n d2 = nx * nx + ny * ny\n\n if d2 > 1.0:\n row.append(' ')\n continue\n\n # Simple fake lighting: brighter near the light direction\n # and darker toward the edges (a bit of \"rim\" shading).\n edge = math.sqrt(max(0.0, 1.0 - d2))\n light = 0.6 + 0.4 * (-(nx * light_dx + ny * light_dy))\n value = (0.65 * edge + 0.35 * light)\n\n idx = int(value * (len(SHADES) - 1))\n idx = max(0, min(len(SHADES) - 1, idx))\n row.append(SHADES[idx])\n\n lines.append(''.join(row).rstrip())\n\n return '\\n'.join(lines)\n" | ||
| } | ||
| ], | ||
| "image_list": [], | ||
| "videos": [], | ||
| "audio": [] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.