Skip to content

Commit c3011ea

Browse files
committed
Use hyperapp-object-view
1 parent 1487f5d commit c3011ea

16 files changed

Lines changed: 541 additions & 75 deletions

dist/hyperapp-devtools.js

Lines changed: 155 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hyperapp-devtools.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hyperapp-devtools.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hyperapp-devtools.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/api.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
export interface StringMap<Value = any> {
2+
[key: string]: Value;
3+
}
14
export interface AppAction {
25
name: string;
36
done: boolean;
@@ -7,6 +10,7 @@ export interface AppAction {
710
nextState?: any;
811
actionData?: any;
912
actionResult?: any;
13+
stateCollapses: StringMap<boolean>;
1014
}
1115
export interface Run {
1216
id: string;
@@ -52,10 +56,17 @@ export interface ToggleActionPayload {
5256
run: string;
5357
path: number[];
5458
}
59+
export interface CollapseAppActionPayload {
60+
run: string;
61+
actionPath: number[];
62+
appActionPath: string;
63+
collapsed: boolean;
64+
}
5565
export interface Actions {
5666
log(event: RuntimeEvent): any;
5767
logInit(event: InitEvent): any;
5868
logAction(event: ActionEvent): any;
69+
collapseAppAction(payload: CollapseAppActionPayload): any;
5970
select(action: SelectedAction | null): any;
6071
showPane(shown: boolean): any;
6172
setPaneDisplay(paneDisplay: PaneDisplay): any;

dist/src/immutable.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Path: Array<string | number>
33
*/
4-
export declare type Path = Array<string | number> | string;
4+
export declare type Path = Array<string | number>;
55
/**
66
* Get the value at the given path in the given target, or undefined if path doesn't exists.
77
*/

examples/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ <h1>Devtools examples</h1>
1818
<a href="./todos.html">Todo list</a>
1919
</li>
2020
<li>
21-
<a href="./long-names.html">Test Long state name (for test purpose only)</a>
21+
<a href="./nested-state.html">Nested state</a>
22+
</li>
23+
<li>
24+
<a href="./long-names.html">Long names (for test purpose only)</a>
2225
</li>
2326
</ul>
2427
</body>

examples/nested-state.html

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<title>Counter example with debugger</title>
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
10+
<script src="https://unpkg.com/hyperapp"></script>
11+
<script src="hyperapp-devtools.js"></script>
12+
</head>
13+
14+
<body>
15+
<div id="app" />
16+
<br />
17+
<br />
18+
<a href="index.html">&nbsp;Back to index</a>
19+
20+
<script>
21+
const h = hyperapp.h
22+
23+
// basic building blocks
24+
const toggleState = { value: true }
25+
const toggle = () => state => ({ value: !state.value })
26+
27+
const state = {
28+
slice1: {
29+
slice1: toggleState,
30+
slice2: toggleState,
31+
value: true
32+
},
33+
slice2: {
34+
slice1: toggleState,
35+
slice2: toggleState,
36+
value: true
37+
},
38+
value: true
39+
}
40+
41+
const actions = {
42+
slice1: {
43+
slice1: { toggle },
44+
slice2: { toggle },
45+
toggle,
46+
},
47+
slice2: {
48+
slice1: { toggle },
49+
slice2: { toggle },
50+
toggle,
51+
},
52+
toggle,
53+
}
54+
55+
function sliceView(s, a, prefix) {
56+
return h("span", {},
57+
h("span", { onclick: () => a.toggle() }, prefix + s.value + "\n"),
58+
s.slice1 && sliceView(s.slice1, a.slice1, prefix + " "),
59+
s.slice2 && sliceView(s.slice2, a.slice2, prefix + " "),
60+
)
61+
}
62+
63+
function view(state, actions) {
64+
return h("pre", { style: { margin: "2rem" } },
65+
sliceView(state, actions, "")
66+
)
67+
}
68+
69+
devtools(hyperapp.app)(state, actions, view, document.getElementById("app"))
70+
71+
</script>
72+
73+
</body>
74+
75+
</html>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"release": "npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
2525
},
2626
"dependencies": {
27-
"spectre.css": "^0.5.1",
28-
"hyperapp": "^1.2.5"
27+
"hyperapp": "^1.2.5",
28+
"spectre.css": "^0.5.1"
2929
},
3030
"devDependencies": {
3131
"cpx": "^1.5.0",

0 commit comments

Comments
 (0)