Skip to content

Commit f557b09

Browse files
author
Timothy Johnson
committed
Each block iteration
1 parent 186cda3 commit f557b09

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

src/ComponentView.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
id={$selectedNode.id}
5454
header="State"
5555
entries={$selectedNode.detail.ctx} />
56-
{:else if $selectedNode.type == 'block'}
56+
{:else if $selectedNode.type == 'block' || $selectedNode.type == 'iteration'}
5757
<PropertyList
5858
readOnly
5959
id={$selectedNode.id}

src/client/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function serializeNode(node) {
9999
break
100100
}
101101

102+
case 'iteration':
102103
case 'block': {
103104
const { ctx, source } = node.detail
104105
serialized.detail = {

src/nodes/Iteration.svelte

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<script>
2+
export let style
3+
export let hover
4+
export let selected
5+
export let source
6+
</script>
7+
8+
<style>
9+
div {
10+
height: 16px;
11+
line-height: 16px;
12+
}
13+
14+
div {
15+
color: rgb(151, 164, 179);
16+
}
17+
</style>
18+
19+
<div class:hover class:selected {style}>&#8618;</div>
20+
<slot />

src/nodes/Node.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import Element from './Element.svelte'
44
import Block from './Block.svelte'
55
import Slot from './Slot.svelte'
6+
import Iteration from './Iteration.svelte'
67
import Text from './Text.svelte'
78
import Anchor from './Anchor.svelte'
89
@@ -27,6 +28,7 @@
2728
component: Element,
2829
block: Block,
2930
slot: Slot,
31+
iteration: Iteration,
3032
text: Text,
3133
anchor: Anchor
3234
}[node.type]
@@ -103,8 +105,10 @@
103105
<span style={`left: ${depth * 12 + 2}px`} />
104106
{/if}
105107
<ul>
106-
{#each node.children as node (node.id)}
107-
<svelte:self {node} depth={depth + 1} />
108+
{#each node.children as child (child.id)}
109+
<svelte:self
110+
node={child}
111+
depth={node.type == 'iteration' ? depth : depth + 1} />
108112
{/each}
109113
</ul>
110114
</svelte:component>

src/store.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const visibility = writable({
44
component: true,
55
element: true,
66
block: true,
7+
iteration: true,
78
slot: true,
89
text: true,
910
anchor: false

0 commit comments

Comments
 (0)