This is a rundown of all the DOM Component abstraction issues I encountered while attempting to modularize my Eve code. I made each major issue an h2
header, provided examples as h3
headers.
The nested search/bind componentizing pattern only works for very simple data structures, as it seems the DOM is first rendered, then searched for tags.
#time-string
instead of #time
to reduce surface area of what might be going wrong
commit
[#experience
title: "Morning Meditation"
interval: [#interval start: "7:15" end: "8:35"]]
[#experience
title: "Lunch"
interval: [#interval start: "12:15" end: "13:15"]]
search @browser @virtual-dom
time-view = [#time-view time]
bind @browser @virtual-dom
time-view <- [#span class: "time" text: time]
// This search is the failure point on #interval,
// Presumably because the variable interval in the root app
// isn't expanded before searching
search @browser @virtual-dom
interval = [#interval start, end]
bind @browser @virtual-dom
interval <- [#span interval children:
[#time-view time: start],
[#span class: "divider" text: "-"],
[#time-view time: end]]
// with full destructuring and restructuring
search
experience = [#experience title,
interval: [#interval start, end]]
bind @browser
[#div class: "experience-list" children:
[#h3 text: "Experience List with full destructuring:"]
[#div experience class: "experience" children:
[#interval start, end],
[#span class: "divider" text: ": "]
[#span text: title]]]
If I try to avoid destructuring and restructuring #interval
, then the variable is not found in the component searches, and thus not rebound
// with interval as variable, [#interval] isn't matched
search
experience = [#experience interval, title]
bind @browser
[#div class: "experience-list" text: "foo" children:
[#h3 text: "Experience List with Variable:"]
[#div experience class: "experience" children: (
interval,
[#span class: "divider" text: ": "],
[#span text: title])]]
This is an attempt to bind
to a @virtual-dom
database, which will then be search/rebound, and then rendered to the @browser
. It doesn't work at all, because the browser
only renders literal records, and won't render searched for records:
search
experience = [#experience interval, title]
bind @virtual-dom
[#app #div class: "experience-list" children:
[#h3 text: "Virtual Dom Experience List:"]
[#div experience class: "experience" children: (
interval,
[#span class: "divider" text: ": "],
[#span text: title])]]
search @virtual-dom
app = [#app class children]
bind @browser
[#div text: "Virtual Dom for class: {{class}}" children: app]
The issue distilled:
commit
[#snippet #span text: "Example tag-as-record"]
search
snippet = [#snippet]
bind @browser
[#div children: (
[#h3 text: "Snippets:"]
snippet)]
I wanted to
disable
a lot of these blocks, but it breaks formatting. The Experience List With Variable block in particular breaks the entire program until you use the inspector.