-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from x0k/runtimes-info
Runtimes info
- Loading branch information
Showing
17 changed files
with
327 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
16 changes: 16 additions & 0 deletions
16
apps/ppp/src/adapters/workers/go-worker-description.svelte
This file contains 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,16 @@ | ||
<script lang="ts"> | ||
import { version } from "testing-go/version"; | ||
</script> | ||
|
||
<p> | ||
Go {version}. | ||
</p> | ||
|
||
<p> | ||
Your code is interpreted by <a | ||
target="_blank" | ||
class="link" | ||
href="https://github.com/WordPress/wordpress-playground/tree/trunk/packages/go-wasm/web" | ||
>Yaegi</a | ||
> (compiled to WebAssembly with stdlib) in a web worker environment. | ||
</p> |
This file contains 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,20 @@ | ||
import type { ComponentType, SvelteComponent } from "svelte"; | ||
|
||
import { Language } from "@/shared/languages"; | ||
|
||
import JsWorkerDescription from "./js-worker-description.svelte"; | ||
import TsWorkerDescription from "./ts-worker-description.svelte"; | ||
import PhpWorkerDescription from "./php-worker-description.svelte"; | ||
import PyWorkerDescription from "./python-worker-description.svelte"; | ||
import GoWorkerDescription from "./go-worker-description.svelte"; | ||
|
||
export const WORKER_DESCRIPTIONS: Record< | ||
Language, | ||
ComponentType<SvelteComponent<Record<string, never>>> | ||
> = { | ||
[Language.JavaScript]: JsWorkerDescription, | ||
[Language.TypeScript]: TsWorkerDescription, | ||
[Language.PHP]: PhpWorkerDescription, | ||
[Language.Python]: PyWorkerDescription, | ||
[Language.Go]: GoWorkerDescription, | ||
}; |
11 changes: 11 additions & 0 deletions
11
apps/ppp/src/adapters/workers/js-worker-description.svelte
This file contains 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,11 @@ | ||
<p>Your code is executed in a web worker environment.</p> | ||
|
||
<p> | ||
<a | ||
class="link" | ||
target="_blank" | ||
href="https://compat-table.github.io/compat-table/es2016plus/" | ||
> | ||
Check supported features in your browser | ||
</a>. | ||
</p> |
16 changes: 16 additions & 0 deletions
16
apps/ppp/src/adapters/workers/php-worker-description.svelte
This file contains 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,16 @@ | ||
<script lang="ts"> | ||
import { version } from "testing-php/version"; | ||
</script> | ||
|
||
<p> | ||
PHP {version}. | ||
</p> | ||
|
||
<p> | ||
Your code is executed by <a | ||
target="_blank" | ||
class="link" | ||
href="https://github.com/WordPress/wordpress-playground/tree/trunk/packages/php-wasm/web" | ||
>WebAssembly PHP</a | ||
> in a web worker environment. | ||
</p> |
16 changes: 16 additions & 0 deletions
16
apps/ppp/src/adapters/workers/python-worker-description.svelte
This file contains 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,16 @@ | ||
<script lang="ts"> | ||
import { version } from "testing-python/version"; | ||
</script> | ||
|
||
<p> | ||
Python {version}. | ||
</p> | ||
|
||
<p> | ||
Your code is executed by <a | ||
target="_blank" | ||
class="link" | ||
href="https://pyodide.org/en/stable/" | ||
>Pyodide</a | ||
> (Python distribution based on WebAssembly) in a web worker environment. | ||
</p> |
26 changes: 26 additions & 0 deletions
26
apps/ppp/src/adapters/workers/ts-worker-description.svelte
This file contains 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,26 @@ | ||
<script lang="ts"> | ||
import { version } from "testing-typescript/version"; | ||
</script> | ||
|
||
<p>TypeScript {version}. Transpilation options:</p> | ||
|
||
<pre> | ||
<code> | ||
target: ScriptTarget.ES2022, | ||
strict: true, | ||
strictBindCallApply: true, | ||
strictFunctionTypes: true, | ||
</code> | ||
</pre> | ||
|
||
<p>Your code is executed in a web worker environment.</p> | ||
|
||
<p> | ||
<a | ||
class="link" | ||
target="_blank" | ||
href="https://compat-table.github.io/compat-table/es2016plus/" | ||
> | ||
Check supported features in your browser | ||
</a>. | ||
</p> |
This file contains 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,87 @@ | ||
<script lang="ts" generics="T extends string"> | ||
import type { Snippet } from 'svelte'; | ||
interface Props { | ||
value: T; | ||
options: T[]; | ||
label?: Snippet<[T]>; | ||
preLabel?: Snippet<[T]>; | ||
postLabel?: Snippet<[T]>; | ||
} | ||
let { | ||
value = $bindable(), | ||
options, | ||
label, | ||
preLabel, | ||
postLabel, | ||
}: Props = $props(); | ||
let detailsElement: HTMLDetailsElement; | ||
$effect(() => { | ||
const handler = (event: MouseEvent) => { | ||
const withinBoundaries = event.composedPath().includes(detailsElement) | ||
if (!withinBoundaries) { | ||
detailsElement.open = false | ||
} | ||
} | ||
document.addEventListener('click', handler) | ||
return () => document.removeEventListener('click', handler) | ||
}) | ||
</script> | ||
|
||
<details bind:this={detailsElement} class="dropdown dropdown-top dropdown-end"> | ||
<summary class="btn btn-sm btn-ghost font-normal"> | ||
{#if label} | ||
{@render label(value)} | ||
{:else} | ||
{value} | ||
{/if} | ||
</summary> | ||
<!-- svelte-ignore a11y_no_noninteractive_tabindex --> | ||
<div | ||
tabindex="0" | ||
class="dropdown-content bg-base-200 text-base-content rounded-box max-h-[calc(100vh-10rem)] w-43 overflow-y-auto border border-white/5 shadow-2xl outline outline-1 outline-black/5" | ||
> | ||
<ul class="menu menu-sm gap-1"> | ||
{#each options as option (option)} | ||
<li> | ||
<button | ||
class="group" | ||
class:active={value == option} | ||
onclick={() => { | ||
value = option; | ||
detailsElement.open = false | ||
}} | ||
> | ||
<!-- {#if $t("__code", {}, option, false) !== "__code"} | ||
<span | ||
class="badge badge-sm badge-outline !pl-1.5 !pr-1 pt-px font-mono !text-[.6rem] font-bold tracking-widest opacity-50"> | ||
{$t("__code", {}, option)} | ||
</span> | ||
{/if} --> | ||
{#if preLabel} | ||
{@render preLabel(option)} | ||
{/if} | ||
<span class="font-[sans-serif]"> | ||
{#if label} | ||
{@render label(option)} | ||
{:else} | ||
{option} | ||
{/if} | ||
</span> | ||
{#if postLabel} | ||
{@render postLabel(option)} | ||
{/if} | ||
<!-- {#if $t("__status", {}, option) !== "__status" && $t("__status", {}, option) !== ""} | ||
<span class="badge badge-sm badge-ghost"> | ||
{$t("__status", {}, option)} | ||
</span> | ||
{/if} --> | ||
</button> | ||
</li> | ||
{/each} | ||
</ul> | ||
</div> | ||
</details> |
This file contains 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 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 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
Oops, something went wrong.