-
Notifications
You must be signed in to change notification settings - Fork 454
feat(gnoweb): consolidate built-in playground UI #5565
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
base: playground2
Are you sure you want to change the base?
Changes from 20 commits
79bf488
726a72c
c2529fd
6453e3f
b6d19d0
3c115b3
4f456ec
27c3281
fef4668
d6a246b
1647363
3a686a8
0c016d2
48226c4
f7f97f0
85e58cc
92de7db
e6ff4fd
fec2e3e
e8086af
7d65338
c511d29
27085e5
be76768
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| {{/* =================================================================================== | ||
| LAYOUT - Eval view wrapper | ||
| LAYOUT - Eval view | ||
| =================================================================================== */}} | ||
| {{ define "renderEval" }} | ||
| <header class="b-content-header u-gap-0 u-mb-0 u-lg-mb-4"> | ||
| <h1 class="title b-content-h1">Gno Expression Evaluator</h1> | ||
| </header> | ||
|
|
||
| <!-- Aside - Function list --> | ||
| {{ with render .ComponentTOC }} | ||
| {{ template "layout/aside" . }} | ||
|
|
@@ -22,10 +26,9 @@ | |
| data-eval-pkg-path-value="{{ .PkgPath }}" | ||
| data-eval-domain-value="{{ .Domain }}"> | ||
|
|
||
| <div class="b-eval-header"> | ||
| <h2 class="b-content-h2">Expression Evaluator</h2> | ||
| <p class="u-color-muted">Evaluate read-only expressions against <code class="u-font-mono">{{ .PkgPath }}</code></p> | ||
| </div> | ||
| <p class="u-color-muted"> | ||
| Evaluate read-only expressions against <code class="u-font-mono">{{ .PkgPath }}</code> | ||
| </p> | ||
|
|
||
| <!-- Quick eval input --> | ||
| <div class="b-eval-input"> | ||
|
|
@@ -36,7 +39,7 @@ <h2 class="b-content-h2">Expression Evaluator</h2> | |
| placeholder='Render("")' class="u-font-mono" | ||
| autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /> | ||
| </div> | ||
| <button type="submit" class="b-btn b-btn--primary"> | ||
| <button type="submit" class="b-btn b-btn--primary c-with-icon"> | ||
| <svg class="c-icon"><use href="#ico-tx-link"></use></svg> | ||
| <span>Eval</span> | ||
| </button> | ||
|
|
@@ -46,36 +49,35 @@ <h2 class="b-content-h2">Expression Evaluator</h2> | |
| <!-- Result area --> | ||
| <div class="b-eval-result"> | ||
| <div class="b-eval-result-header"> | ||
| <span>Result</span> | ||
| <h3 class="b-eval-result-title">Result</h3> | ||
| <button class="b-eval-result-clear" data-action="click->eval#clearResult">Clear</button> | ||
| </div> | ||
| <pre class="b-eval-result-content" data-eval-target="result"><span class="u-color-muted">// Enter an expression above</span></pre> | ||
| </div> | ||
|
|
||
| <!-- Function quick-call buttons --> | ||
| {{ if .Functions }} | ||
| <div class="b-eval-functions"> | ||
| <h3 class="b-content-h3">Quick Call</h3> | ||
| <div class="c-stack"> | ||
| <div class="b-eval-quick-call"> | ||
| <h2 class="b-content-h2">Quick Call</h2> | ||
| <ul class="b-eval-functions"> | ||
| {{ range .Functions }} | ||
| <div class="b-eval-func"> | ||
| <button class="b-btn b-btn--secondary" data-action="click->eval#quickCall" | ||
| <li id="func-{{ .Name }}"> | ||
| <button class="b-inline-btn" data-action="click->eval#quickCall" | ||
| data-eval-func-name-param="{{ .Name }}" | ||
| data-eval-func-sig-param="{{ .Signature }}"> | ||
| {{ .Name }}({{ range $i, $p := .Params }}{{ if gt $i 0 }}, {{ end }}{{ $p.Name }}{{ end }}) | ||
| </button> | ||
| {{ if .Doc }}<span class="u-color-muted">{{ .Doc }}</span>{{ end }} | ||
| </div> | ||
| {{ if .Doc }}<div class="u-color-muted">{{ .Doc }}</div>{{ end }} | ||
| </li> | ||
| {{ end }} | ||
| </div> | ||
| </ul> | ||
| </div> | ||
| {{ end }} | ||
|
|
||
| <!-- History (hidden until first eval) --> | ||
| <div class="b-eval-history" data-eval-target="history" hidden> | ||
| <h3 class="b-content-h3">History</h3> | ||
| <div class="c-stack" data-eval-target="history-list"> | ||
| </div> | ||
| <h2 class="b-content-h2">History</h2> | ||
| <div class="b-eval-history-list" data-eval-target="history-list" /> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 7d65338 |
||
| </div> | ||
| </div> | ||
| {{ end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,42 +3,43 @@ | |
| =================================================================================== */}} | ||
| {{ define "renderPlayground" }} | ||
| <!-- Playground Content --> | ||
| <div class="b-playground u-grid-full" data-controller="playground" | ||
| <div class="b-playground" data-controller="playground" | ||
| data-playground-remote-value="{{ .Remote }}" | ||
| data-playground-chain-id-value="{{ .ChainId }}" | ||
| data-playground-domain-value="{{ .Domain }}" | ||
| {{ with .ForkFrom }}data-playground-fork-from-value="{{ . }}"{{ end }}> | ||
|
|
||
| <!-- Toolbar --> | ||
| <div class="b-playground-toolbar"> | ||
| <!-- Header Toolbar --> | ||
| <header class="b-content-header"> | ||
| <div class="b-playground-toolbar-left"> | ||
| <h1 class="b-playground-title"> | ||
| <h1 class="title b-content-h1"> | ||
| {{ if .ForkFrom }} | ||
| <span class="u-font-mono">Fork of {{ .ForkFrom }}</span> | ||
| <span>Fork</span> | ||
| <span class="b-tag">{{ .ForkFrom }}</span> | ||
| {{ else }} | ||
| Playground | ||
| {{ end }} | ||
| </h1> | ||
| </div> | ||
| <div class="b-playground-toolbar-right"> | ||
| <button class="b-btn b-btn--secondary" data-action="click->playground#formatCode" title="Format code (Ctrl+Shift+F)"> | ||
| <button class="b-btn b-btn--secondary c-with-icon" data-action="click->playground#formatCode" title="Format code (Ctrl+Shift+F)"> | ||
| <svg class="c-icon"><use href="#ico-code"></use></svg> | ||
| <span>Format</span> | ||
| </button> | ||
| <button class="b-btn b-btn--secondary" data-action="click->playground#runTests" title="Run tests (Ctrl+Shift+T)"> | ||
| <button class="b-btn b-btn--secondary c-with-icon" data-action="click->playground#runTests" title="Run tests (Ctrl+Shift+T)"> | ||
| <svg class="c-icon"><use href="#ico-helper"></use></svg> | ||
| <span>Test</span> | ||
| </button> | ||
| <button class="b-btn b-btn--primary" data-action="click->playground#runCode" title="Run code (Ctrl+Enter)"> | ||
| <button class="b-btn b-btn--primary c-with-icon" data-action="click->playground#runCode" title="Run code (Ctrl+Enter)"> | ||
| <svg class="c-icon"><use href="#ico-tx-link"></use></svg> | ||
| <span>Run</span> | ||
| </button> | ||
| <button class="b-btn b-btn--secondary" data-action="click->playground#shareCode" title="Share"> | ||
| <button class="b-btn b-btn--secondary c-with-icon" data-action="click->playground#shareCode" title="Share"> | ||
| <svg class="c-icon"><use href="#ico-link"></use></svg> | ||
| <span>Share</span> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </header> | ||
|
|
||
| <!-- Editor Area --> | ||
| <div class="b-playground-editor-area"> | ||
|
|
@@ -59,7 +60,7 @@ <h1 class="b-playground-title"> | |
| <!-- Output Area --> | ||
| <div class="b-playground-output"> | ||
| <div class="b-playground-output-header"> | ||
| <span class="b-playground-output-title">Output</span> | ||
| <h3 class="b-playground-output-title">Output</h3> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thought as on eval: "Output" feels more like a pane label than a section heading. Span rather than
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 7d65338 |
||
| <button class="b-playground-output-clear" data-action="click->playground#clearOutput" title="Clear output">Clear</button> | ||
| </div> | ||
| <pre class="b-playground-output-content" data-playground-target="output"><span class="u-color-muted">// Run code to see output here</span></pre> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: "Result" went from
<span>to<h3>, so DOM order now reads h1 → h3 Result → h2 Quick Call → h2 History, which is backwards for screen readers.WDYT about keeping it as a span (or a panel-title class if we factor the shared panel primitive later)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 7d65338