Skip to content
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

Replaces the side debug bar with a live object view #781

Merged
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
"socket.io": "^2.1.1",
"socket.io-client": "^2.3.0",
"svelte": "^3.24.0",
"svelte-json-tree": "^0.1.0",
delucis marked this conversation as resolved.
Show resolved Hide resolved
"svelte-json-tree-auto": "^0.1.0",
"ts-toolbelt": "^6.3.6",
"uuid": "3.2.1"
},
Expand All @@ -190,7 +192,7 @@
"^.+\\.svelte$": "jest-transform-svelte"
},
"transformIgnorePatterns": [
"node_modules/(?!(boardgame.io|flatted|svelte-icons)/)"
"node_modules/(?!(boardgame.io|flatted|svelte-icons|svelte-json-tree-auto|sveslte-json-tree)/)"
delucis marked this conversation as resolved.
Show resolved Hide resolved
],
"testPathIgnorePatterns": [
"examples/",
Expand Down
17 changes: 13 additions & 4 deletions src/client/debug/main/Main.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script>
export let client;

import JSONTree from 'svelte-json-tree';
delucis marked this conversation as resolved.
Show resolved Hide resolved
// import JSONTree from 'svelte-json-tree-auto';
delucis marked this conversation as resolved.
Show resolved Hide resolved
import Move from './Move.svelte';
import Controls from './Controls.svelte';
import PlayerInfo from './PlayerInfo.svelte';
Expand Down Expand Up @@ -36,6 +38,11 @@
color: #888;
delucis marked this conversation as resolved.
Show resolved Hide resolved
}

.tree {
--json-tree-font-family: monospace;
--json-tree-font-size: 14px;
}

label {
font-weight: bold;
font-size: 1.1em;
Expand Down Expand Up @@ -107,12 +114,14 @@

<section>
<label>G</label>
<pre class="json">{JSON.stringify(G, null, 2)}</pre>
<div class="json tree">
delucis marked this conversation as resolved.
Show resolved Hide resolved
<JSONTree value={G} />
</div>
</section>

<section>
<label>ctx</label>
<pre class="json">
{JSON.stringify(SanitizeCtx(ctx), null, 2)}
</pre>
<div class="json tree">
delucis marked this conversation as resolved.
Show resolved Hide resolved
<JSONTree value={SanitizeCtx(ctx)} />
</div>
</section>