GithubHelp home page GithubHelp logo

solidjs / solid-playground Goto Github PK

View Code? Open in Web Editor NEW
183.0 183.0 60.0 11.08 MB

Quickly discover what the solid compiler will generate from your JSX template

Home Page: https://playground.solidjs.com

License: MIT License

HTML 0.61% TypeScript 97.44% CSS 0.54% JavaScript 1.41%
compiler repl solid-js

solid-playground's People

Contributors

alexandre-mb-airweb avatar amoutonbrady avatar aquaductape avatar arindampal-0 avatar aylosrd avatar bigmistqke avatar birkskyum avatar boturyna avatar chiefcll avatar davedbase avatar edemaine avatar fiveawe avatar frenzzy avatar istareatscreens avatar joshwilsonvu avatar jutanium avatar m4rvr avatar milomg avatar nberlette avatar non25 avatar shannonrothe avatar spiffytech avatar surunzi avatar sytzez avatar titobouzout avatar tommypop2 avatar trivikr avatar trusktr avatar visualfanatic avatar yacinehmito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solid-playground's Issues

[Bug]: console.log rendering coma

Bug description

When you use console.log with a coma to have multiple args the coma is also displayed in the logs.

Possible solution

I just quickly watched the code and it seems to happen because there is no parsing done to remove ,
The args are just a string

interface LogPayload {
level: 'log' | 'warn' | 'error';
args: string;

used here:
<code class="whitespace-pre-wrap">{log.args}</code>

Other related Issue

It would be a good idea to patch this together with #31

Playground link

Playground

Fix some responsive styles

I've been adding more and more feature in the header which eventually led to the playground not properly fitting on mobile. You can see on the screenshot below that the header is a bit jammed because there's too much content.

image

It'd be cool to fix these silly responsive issues. Perhaps hiding some buttons on mobile or making that area scrollable. That'd be the easy path. The harder path would be to hide those features in a dropdown or a sidebar of some sort (that would only be displayed on mobile). The tricky part is making all of this accessible which is always something that I try to keep in mind.

Dark mode should apply to the Result too

Describe the bug

The dark mode does not apply to result.

Steps to reproduce

Solid Playground link: https://playground.solidjs.com/?hash=-596780144&version=1.1.0

Observed behavior

The dark mode is not applied to Result.

Screenshot: Light mode light-mode
Screenshot: Dark mode dark-mode

Expected behavior

Dark mode should apply to contents in the result too.

Additional context

First pointed out in Discord https://discord.com/channels/722131463138705510/722167449251741798/874957933346193469

Import/Drag Solid Component(.jsx/.tsx) files directly from files storage into Playground.

Feature Request..
Allow component files to be loaded and renamed automatically in a new tab when user drags and drop file(s) into the playground editor..

Also button to import them either in json format or file format (Level.jsx) in the nav menu should be nice ๐Ÿ™‚..

Bonus.. Allow multiple files being dragged into code playground to be treated the same.. loaded automatically and renamed by their original component file names eg(Root.jsx)..

Typescript lib

Today I've seen this error popup in the playground, when using Array.prototype.includes().
image
Is the typescript setup correctly?

Run prettier formatting during build/precommit

Is your feature request related to a problem? Please describe.

The format script is not run during build/precommit stage, so it might get missed.
For example #49

Describe the solution you'd like

  • Run format as a prebuild step.
  • Run prettier on precommit

Make the pane resizable on mobile

At the moment the left and right pane are resizable on desktop view via a simple drag and drop mechanism base on mouseDown, mouseUp and mouseMove events. It woks by updating a CSS variable that dictate the width of the grids columns.

The logic is visible here: https://github.com/ryansolid/solid-playground/blob/master/src/app.tsx#L121-L141

On mobile the panes are stacked vertically and I manually disabled the resizing. It'd be cool to be able to apply a similar logic for vertical resize.

Adding a refresh button

I'd love to have a refresh button above the preview pane which would essentially refresh the iframe and clear the console.

Playground broken in Firefox (88.0 stable and 89.0b2 beta)

The playground stopped working for me in Firefox (both stable and beta). Earlier today I've been prototyping on the playground without any issues, but as of tonight the playground seems broken. Chromium based browsers still seem to be working correctly. This happens immediately to the default sample of the playground.

To reproduce, simply open the playground in the stable or beta release of Firefox and open the devtools console. Errors will be logged and no content is show in the result pane of the playground.

Please find attached the devtools console output:
console-export-2021-4-21_21-5-23.txt

Reset/Solve button in Solidjs Tutorial cause issues with tab state

I was going through the tutorial and found this buggy interaction between the Reset/Solve button and Playground.

solid-tutorial (1)

Investigated it in solidjs/solid-site but it seems like the issue might be the Playground itself. I wanted to poke around some more but was hoping for some direction of what would be causing this issue.

Less hacky output pane

Right now the output is the file that is generated by rollup (with the imports having been changed to skypack and then back to regular imports). Instead, we might consider taking inspiration from the svelte repl and showing the babel compiled version of the currently active tab or actually displaying the skypack imports so that we can show the actual code that is run.

Add a button to login with GitHub

Context

At the moment 100% of the shared playground are store in a Cloudflare KV store.
We would like to slowly transition away from that and store it on our own infrastructure based on Supabase.
The first part to do that is to implement authentication which would allow to save the REPL.

User Stories

  • As an unauthenticated user, I load the playground page and click the "Sign In" button. I then proceed to authorize Github to communicate my information and I'm redirected to the playground. I see my username, indicating that the connexion is indeed made between the playground and my Solid account.

Functional rules

Given When Then
I'm on the playground I click on the "Sign In" button at the top right corner I'm redirected to a GitHub page that ask me if I allow Solid to use my information
I'm on the GitHub page that asks me about my information I click on the "authorize button" I'm redirected on the playground and I see my username on the top right corner in place of the Sign In button

Technical details

Playground - Counter example: change version to make counter increment 2 times instead of 1

Title: Double increment upon version change
Note: Possible bug in playground (not sure)

Steps:

  1. On Solid JS - Playground, goto counter Example,
  2. as soon as the HTML button is visible, change the version of Solid JS,
  3. Click the Counter Button to observe double increments (increment by 2)

Expected:
After changing the version of SolidJS on Playground, the button should increment by 1

An option to use solid-styled-jsx

It'd be nice to be able to use solid-styled-jsx in the editor.

Maybe there can be an option for it. More generally (merits a new issue) there could be an option system.

Compiler doesn't work offline neither in PWA.

Shifting compilation from online to client side is very crucial..
Otherwise it makes the PWA app useless...

Please allow the Service worker to handle compilation offline on the Client side once the resources are loaded..

Bottom header bar removed

Bottom header bar got removed or not visible. It contained formatter icon, when clicking it formatted/prettied code. Also I can't seem find it in the source code, did it get removed? I looked through all imports of solid-heroicons and only see icons that are found at top header and right panel.

Screen Shot 2022-01-20 at 2 00 46 PM

Add a way to disable automatic compilation or/and customize the delay

As of today the compilation of the JSX to JS happens as you type it with a debounced function of 250ms.

Watching people code in real time, this can be annoying because it yells errors all around before you are done typing.
One thing I'd like to see is an option to toggle automatic compilation and have a button to manually compile it.

Additionally what would be good is if we'd have a customized delay for the debounce function if automatic compilation is on.

DOM doesn't update until mouse is moved in the playground Counter Example

Congrats on version 1.0.0 release.

I would like to present two scenarios:

  1. On Solid JS - Playground, the button text does not get updated until mouse is moved. This happens once every couple of button clicks.
  2. I tried the same code on CSB using the link on Playground itself, used TAB key on keyboard to focus on the HTML button object in ouput window, pressed SPACEBAR few times (while mouse pointer was outside the button), and observed the same behaviour as on playground.

Is this behaviour by design or bug in implementation code?

Should there be a central store for playground?

Is your feature request related to a problem? Please describe.

While working on the dark mode in the following PRs, I noticed that lot of props are passed around.

Should there be a central store for these signals, so that they're not required to be passed between components?
PR for an attempt to create a store for dark signal in #57

Describe the solution you'd like

A better project structure where all TypeScript code is under src folder, and there's a central store from which values can be read.

Describe alternatives you've considered

Keep passing values of signals between components as props.

Adding a (hacky) way to disable TS checking

In order to make the playground as easy as possible for people to share bug repro, we early on made sure TSX was supported (although everything is stripped away via @babel/preset-typescript).

Later on we switched from codemirror to monaco editor which added real time feedback related to typescript.

The issue is, due to the fact we use a virtual file system, some types doesn't work properly and may come in as annoying. Unfortunately, as of today there's no way to disable that at the monaco editor level.

That being said, adding a // @ts-nocheck at the top of the file do exactly that. Types still work as intended but they do not yell an error if there's some missing types.

I'd like to see a button to toggle that comment automatically while we look for a better solution.

v1.3.14

Seems the playground is behind the latest tagged version (1.3.14).

Is the upgrade here manual?

Lazy load Monaco Editor to unblock SSR process

I'd really love the ability to include Solid REPL in Solid Site's SSR process. Unfortunately Monaco introduces side-effects when I attempt to do so. You can experience this on https://github.com/solidjs/solid-site/tree/solid-start-migration. A solution discussed on Discord is to lazy load Monaco itself but that might apparently pose some trouble for the top-level await.

Either way it would be really nice to get support for this. I'm hoping someone has some spare time to sink their teeth into it.

Thanks!

Scrubbing the history of .yarn

I just cloned the repository, and it took a while because it weighs close to 300MB.
I realise that this is due to yarn v2 zero-installs. The tradeoff is that, for a larger repo, we don't waste time installing dependencies.
However, since the switch to pnpm, we are now getting the downside of yarn v2 zero-installs without the upside.

Would you be keen on scrubbing the git history for the .yarn folder in order to reduce the size of the repository?
This is likely to affect the whole history and will require a push --force, so currently cloned repositories won't mesh well.
However, if this is to be done at some point, then the earlier the better.

I can provide a script to perform the operation if you welcome it.

Issues when browsing through the examples on solid-js site

The issue can be observed when user picks one of the examples that have a css file included, switches to tab with CSS, and then picks another example which also has a css file in it. The tab changes to main.tsx for the second example, but in it are the contents of css file of that example.
image
image

Add a page that lists all of the user REPL

Context

At the moment 100% of the shared playground are store in a Cloudflare KV store.
That means that every REPL that's being shared are anonymous.
The issue is that people can't get a list of all of their REPL.
Implementing the Solid account strategy would allow us and our users to bypass this limitation.

User Stories

  • As an authenticated user, when I load the playground, a modal with a list of all of my REPL is displayed, I can either pick one which loads the code or create a new one.

Functional rules

Given When Then
I'm on the playground - I have a modal with a list of all of my past saved REPLs
I'm on the modal with the REPLs I click on one of my REPL The code of this REPL is loaded into the playground
I'm on the modal with the REPLs I click on "Create a new REPL" A new REPL with the default template is loaded

Technical details

Provide a way to inject links/metadata in the head and script in the footer

Often time you want to have a simple setup that's already made, especially for the style. Or you want to reproduce a very specific case with weird metadata.

Maybe this could be part of the settings page mentioned in #15 but I'd like to have stupid simple way of just writing links, metadata and script to the iframe.

This would probably be just a text area for head and one for footer than we would then read and inject in the iframe code.

Better virtual console support

In order to showcase Solid's output and capabilities, it's often interesting to log stuff in the console.

One thing that'd be really nice is that the virtual console would be able to show a bit more complex types such as dom elements, proxies, deep object, etc..

RFC: Review the default styles of the preview pane

At the moment, the styles are custom made (and to be totally transparent, mostly copied from svelte REPL) in combination with the tailwind typography plugin, but doesn't always play nice I feel like. Especially when it comes to dark theme.

The default can be viewed here: https://github.com/solidui/solid-playground/blob/master/src/components/preview.tsx#L52-L94

We could either craft our own stuff completely or we could just rely on some sort of reset css. Or maybe both. I don't have a strong opinion other than the fact that I really enjoy tailwind styles.

I'm open for any feedback or even PR to improve on what already exists.

Add a button to save/share my REPL

Context

At the moment 100% of the shared playground are store in a Cloudflare KV store.
That means that every REPL that's being shared are anonymous.
The issue is that people can't get a list of all of their REPL.
Implementing the Solid account strategy would allow us and our users to bypass this limitation.

User Stories

  • As an authenticated user, when I'm done with my REPL, I can click on the save button which saves the REPL and copy the URL of this REPL in my clipboard.

Functional rules

Given When Then
I'm on the playground I click on the "Save" button I get a success message indicating me that my playground has been saved and that the URL has been copied to my clipboard

Technical details

We'll need to detect whether the REPL is a new one or an existing one.

Wrap fakeConsole in untrack

Currently, console.log(x) gets mapped console.log(JSON.stringify(x)). This has completely different reactive behavior in Solid if x is a Store or Mutable; it tracks all of x's contents instead of nothing at all. It's come up a couple of times on Discord as making code hard to debug/reproduce errors, as it doesn't match native console.log.

This should be easy to fix by wrapping formatArgs (or the call to JSON.stringify) in untrack. The only potentially tricky part is making sure you have the same SolidJS that's the code itself is using; but maybe you've solved that problem already?

Enabling TypeScript strict mode on Solid Playground

Would it be possible to activate TypeScript strict mode on the Solid Playground?
It's completely confusing to work with TypeScript in non-strict mode (especially if you do not notice that you ARE in non-strict mode ๐Ÿ˜‰). Thanks a lot in advance.

Add dependencies

I wanted to play and learn with solidjs, and the first thing was like "what does an App do, it routes. Yeah SPAs, they route". So I found this lib but to my chagrin the playground doesn't have anything like what some others do by giving an interface to install. I can just play locally tho. I guess I could just switch to codesandbox... Why don't we just use a pre configured/forkable codesandbox with solidjs in it? Then this would be moot!

Very interested in solidjs.... keep it up friend.

Repl doesn't always refresh properly

When writing code in the REPL/playground, it seems that the result panel is not always updated properly. In particular, when following this tutorial, the effect never runs. Switching to the output tab, and then back to the result tab causes the repl to refresh, and the effect runs as expected. There is probably some issue with the repl refreshing, perhaps when it hits an error during an intermediate compilation phase.

A stopgap would be to provide a button to rerun the REPL. This would also be of general utility, in case someone wishes to reset the state in the REPL.

Discord report/discussion.

Make local user settings

I'm among those people that prefer larger coding fonts but that would feel selfish to impose that to every user as I feel like this is not so common.

What I'd like to see is a gear icon somewhere that would introduce a setting page that would be store locally (either via localstorage or indexdb with idb-keyval for example).

I'm sure this feature could also introduce a lot more personalisation without going full crazy and produce a poor man version of codesandbox.

Here are a couple of things that I have in mind as I write this:

  • font size
  • coding font
  • dark/light mode (already exists, just need to move the location)
  • minimap or not (easily switchable today)
  • default vue (code or output), I know some people like Ryan tends to look a lot at the output tab rather than the iframe.

Flexible Option To Export Either As Json file or Project Structured files(.zip optional) and vice versa for imports.

If Possible, after running code in the playground, users should be given the export(download) button and be given the flexibility to choose whether they prefer their code in json format or a zip file containing the project's structured file and dependencies (in package.json file). This is installed easily with npm install..

Eg. After downloading the zip format of the code. Within the zip file should contain a similar project file/folder structure:

./node_modules
./public/
|
-favicon.ico
-index.html
-bundle.css
-index.js
./src/
|
-App.jsx
./package.json
./Readme.md

etc

CSS files by URL

In testing Solid Bootstrap, it'd be really nice to be able to include the Bootstrap CSS in the output. Two natural interfaces:

  • Button for adding CSS by URL
  • import the CSS URL in main.ts. Several build processes support this, and the CSS is already available from NPM and via skypack so this would be especially convenient.

Happy to discuss/brainstorm further, here or in Discord, but wanted to write down this request, having needed it a couple times this week.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.