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

Node manager #903

Merged
merged 96 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
7398a42
node manager declaration
maxence-charriere Sep 30, 2023
860a383
Merge branch 'v10' into node-manager
maxence-charriere Sep 30, 2023
cd16644
mount text
maxence-charriere Oct 1, 2023
d91e410
remove node manager dismountText
maxence-charriere Oct 1, 2023
949681c
node manager can update
maxence-charriere Oct 1, 2023
6d4b3d4
node manager update text
maxence-charriere Oct 1, 2023
97dce4b
updade node manager doc
maxence-charriere Oct 1, 2023
b8bc613
mount html element
maxence-charriere Oct 2, 2023
25a8eb3
node manager resolve url
maxence-charriere Oct 2, 2023
9d240d4
Update node_test.go
maxence-charriere Oct 2, 2023
eb59447
node manager mount html attributes
maxence-charriere Oct 2, 2023
4783c7e
node manager mount html event handler
maxence-charriere Oct 2, 2023
a740ae0
test mount event handler
maxence-charriere Oct 2, 2023
d050bde
node manager make context
maxence-charriere Oct 3, 2023
06a0fd4
Update html.go
maxence-charriere Oct 3, 2023
c063b65
node manager dismount html element
maxence-charriere Oct 3, 2023
57ae52e
html element setters to return the element
maxence-charriere Oct 3, 2023
855cf7d
node manager updateHTMLAttributes
maxence-charriere Oct 3, 2023
656276e
node manager update html event handlers
maxence-charriere Oct 4, 2023
37adbce
node manage update html children
maxence-charriere Oct 4, 2023
9050453
Update node_test.go
maxence-charriere Oct 4, 2023
9d32045
unexport Depth()
maxence-charriere Oct 4, 2023
75730a1
node manager mount component partial implementation
maxence-charriere Oct 4, 2023
5d919b4
node manager component mount
maxence-charriere Oct 5, 2023
fa73de9
improve node manager mount test coverage
maxence-charriere Oct 5, 2023
4104e34
Update node_test.go
maxence-charriere Oct 5, 2023
a3ffdc8
Update node.go
maxence-charriere Oct 5, 2023
4a5e5b6
node manager dismount component
maxence-charriere Oct 5, 2023
9c470a7
node manager update component
maxence-charriere Oct 9, 2023
2c69bc8
can update value tests
maxence-charriere Oct 9, 2023
22e6d58
node manager mount raw html
maxence-charriere Oct 12, 2023
763bd56
node manager dismount raw html
maxence-charriere Oct 12, 2023
d1465da
node manager update raw html
maxence-charriere Oct 12, 2023
5b86b25
node manager notify component update on html events
maxence-charriere Oct 13, 2023
19ccf43
node manager NotifyComponentEvent
maxence-charriere Oct 13, 2023
f03484f
refactor node manager to use context
maxence-charriere Oct 14, 2023
2931a83
use function to get page in node context
maxence-charriere Oct 14, 2023
cfc11af
enginex navigate and load
maxence-charriere Oct 16, 2023
59a48f2
enginex url tests
maxence-charriere Oct 17, 2023
19e4353
update manager
maxence-charriere Oct 17, 2023
466abbf
enginex start implementation
maxence-charriere Oct 18, 2023
9ad9ab8
fix enginex context
maxence-charriere Oct 18, 2023
d4f378a
implement more node context methods
maxence-charriere Oct 18, 2023
0bb47e6
browser app updatble
maxence-charriere Oct 18, 2023
f1a8565
Update browser.go
maxence-charriere Oct 18, 2023
83cc7a3
comple browser init
maxence-charriere Oct 18, 2023
7ab86db
Update enginex.go
maxence-charriere Oct 18, 2023
325bd6c
refactor actions
maxence-charriere Oct 19, 2023
fa51819
enginex start testing
maxence-charriere Oct 19, 2023
f394f5f
update context documentation
maxence-charriere Oct 19, 2023
b7af7da
add notifications to node context
maxence-charriere Oct 20, 2023
b9a0ea1
state manage implementation part1
maxence-charriere Oct 22, 2023
a5a842f
state manager broadcast
maxence-charriere Oct 23, 2023
0a969a1
state manager observer and get unit tests
maxence-charriere Oct 24, 2023
7b6334f
state manager test set partial tests
maxence-charriere Oct 24, 2023
59257b5
state manager remaining tests
maxence-charriere Oct 25, 2023
71cdcba
fix doc site
maxence-charriere Oct 26, 2023
41b6dc0
cleanup
maxence-charriere Oct 26, 2023
4b7382c
node manage encode text
maxence-charriere Oct 26, 2023
c6e01e3
node manage encode raw
maxence-charriere Oct 26, 2023
d8cf3a5
node manager encode component
maxence-charriere Oct 26, 2023
2c39c5e
node manager encode html
maxence-charriere Oct 26, 2023
dc6ccd0
update node manager doc
maxence-charriere Oct 26, 2023
86307d9
Update node.go
maxence-charriere Oct 26, 2023
5a4696f
node manage encode test
maxence-charriere Oct 27, 2023
7a04874
enginex to load component intro body first child only
maxence-charriere Oct 27, 2023
fa6d472
change loading
maxence-charriere Oct 27, 2023
004a527
enginex root
maxence-charriere Oct 27, 2023
34dc3ac
refactor node manager encode
maxence-charriere Oct 27, 2023
4b6d724
engine x encode
maxence-charriere Oct 27, 2023
1a28d08
fix set state
maxence-charriere Oct 27, 2023
9b55cdf
context to be a single structure
maxence-charriere Oct 27, 2023
d170fec
update context
maxence-charriere Oct 27, 2023
18e5da3
state manager delete
maxence-charriere Oct 27, 2023
b060dac
Update context.go
maxence-charriere Oct 27, 2023
ffe5de3
fix on anchor click
maxence-charriere Oct 28, 2023
7f4dc1d
fix fragment navigation
maxence-charriere Oct 28, 2023
509f58f
fix js loading
maxence-charriere Oct 28, 2023
043c442
fix node manager foreach updatable component
maxence-charriere Oct 28, 2023
bcb66e2
fix action post
maxence-charriere Oct 28, 2023
4b63652
Update node.go
maxence-charriere Oct 29, 2023
e89c91b
update default rate
maxence-charriere Oct 31, 2023
587f76f
Update app.go
maxence-charriere Oct 31, 2023
3d07156
Update app.go
maxence-charriere Oct 31, 2023
80d2fc5
revert oninit and prerender deprecation
maxence-charriere Nov 2, 2023
163783f
Update context.go
maxence-charriere Nov 2, 2023
47c0767
remove emit back
maxence-charriere Nov 2, 2023
6733781
cleanup
maxence-charriere Nov 2, 2023
88230f4
add back benchmarks
maxence-charriere Nov 2, 2023
7a92dd5
add generated unit test
maxence-charriere Nov 8, 2023
52aa6c9
add unit test to gen html
maxence-charriere Nov 8, 2023
4e272c6
fix context defer and add unit tests
maxence-charriere Nov 8, 2023
0ac61e9
refactor testing
maxence-charriere Nov 9, 2023
edd8196
refactor testing
maxence-charriere Nov 9, 2023
283a88e
refactor HTMLString
maxence-charriere Nov 9, 2023
72f8ffd
cleanup
maxence-charriere Nov 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/src/actions-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newActionPage() *actionPage {
return &actionPage{}
}

func (p *actionPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *actionPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/architecture-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newArchitecturePage() *architecturePage {
return &architecturePage{}
}

func (p *architecturePage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *architecturePage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/components-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newComponentsPage() *componentsPage {
return &componentsPage{}
}

func (p *componentsPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *componentsPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/concurrency-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newConcurrencyPage() *concurrencyPage {
return &concurrencyPage{}
}

func (p *concurrencyPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *concurrencyPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/declarative-syntax-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newDeclarativeSyntaxPage() *declarativeSyntaxPage {
return &declarativeSyntaxPage{}
}

func (p *declarativeSyntaxPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *declarativeSyntaxPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/getting-started-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newGettingStartedPage() *gettingStartedPage {
return &gettingStartedPage{}
}

func (p *gettingStartedPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *gettingStartedPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/github-deploy-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newGithubDeployPage() *githubDeployPage {
return &githubDeployPage{}
}

func (p *githubDeployPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *githubDeployPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/home-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ func newHomePage() *homePage {
return &homePage{}
}

func (p *homePage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *homePage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/install-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newInstallPage() *installPage {
return &installPage{}
}

func (p *installPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *installPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/js-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newJSPage() *jsPage {
return &jsPage{}
}

func (p *jsPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *jsPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/lifecycle-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newLifecyclePage() *lifecyclePage {
return &lifecyclePage{}
}

func (p *lifecyclePage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *lifecyclePage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
46 changes: 23 additions & 23 deletions docs/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,29 @@ func main() {
ui.BlockPadding = 18
analytics.Add(analytics.NewGoogleAnalytics())

app.Route("/", newHomePage())
app.Route("/getting-started", newGettingStartedPage())
app.Route("/architecture", newArchitecturePage())
app.Route("/reference", newReferencePage())

app.Route("/components", newComponentsPage())
app.Route("/declarative-syntax", newDeclarativeSyntaxPage())
app.Route("/routing", newRoutingPage())
app.Route("/static-resources", newStaticResourcePage())
app.Route("/js", newJSPage())
app.Route("/concurrency", newConcurrencyPage())
app.Route("/seo", newSEOPage())
app.Route("/lifecycle", newLifecyclePage())
app.Route("/install", newInstallPage())
app.Route("/testing", newTestingPage())
app.Route("/actions", newActionPage())
app.Route("/states", newStatesPage())
app.Route("/notifications", newNotificationsPage())

app.Route("/migrate", newMigratePage())
app.Route("/github-deploy", newGithubDeployPage())

app.Route("/privacy-policy", newPrivacyPolicyPage())
app.Route("/", app.NewZeroComponentFactory(newHomePage()))
app.Route("/getting-started", app.NewZeroComponentFactory(newGettingStartedPage()))
app.Route("/architecture", app.NewZeroComponentFactory(newArchitecturePage()))
app.Route("/reference", app.NewZeroComponentFactory(newReferencePage()))

app.Route("/components", app.NewZeroComponentFactory(newComponentsPage()))
app.Route("/declarative-syntax", app.NewZeroComponentFactory(newDeclarativeSyntaxPage()))
app.Route("/routing", app.NewZeroComponentFactory(newRoutingPage()))
app.Route("/static-resources", app.NewZeroComponentFactory(newStaticResourcePage()))
app.Route("/js", app.NewZeroComponentFactory(newJSPage()))
app.Route("/concurrency", app.NewZeroComponentFactory(newConcurrencyPage()))
app.Route("/seo", app.NewZeroComponentFactory(newSEOPage()))
app.Route("/lifecycle", app.NewZeroComponentFactory(newLifecyclePage()))
app.Route("/install", app.NewZeroComponentFactory(newInstallPage()))
app.Route("/testing", app.NewZeroComponentFactory(newTestingPage()))
app.Route("/actions", app.NewZeroComponentFactory(newActionPage()))
app.Route("/states", app.NewZeroComponentFactory(newStatesPage()))
app.Route("/notifications", app.NewZeroComponentFactory(newNotificationsPage()))

app.Route("/migrate", app.NewZeroComponentFactory(newMigratePage()))
app.Route("/github-deploy", app.NewZeroComponentFactory(newGithubDeployPage()))

app.Route("/privacy-policy", app.NewZeroComponentFactory(newPrivacyPolicyPage()))

app.Handle(installApp, handleAppInstall)
app.Handle(updateApp, handleAppUpdate)
Expand Down
17 changes: 6 additions & 11 deletions docs/src/markdown-doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ func (d *remoteMarkdownDoc) Src(v string) *remoteMarkdownDoc {
return d
}

func (d *remoteMarkdownDoc) OnPreRender(ctx app.Context) {
d.load(ctx)
}

func (d *remoteMarkdownDoc) OnMount(ctx app.Context) {
d.load(ctx)
}
Expand All @@ -107,14 +103,13 @@ func (d *remoteMarkdownDoc) OnUpdate(ctx app.Context) {

func (d *remoteMarkdownDoc) load(ctx app.Context) {
src := d.Isrc
ctx.ObserveState(markdownState(src)).
ctx.ObserveState(markdownState(src), &d.md).
While(func() bool {
return src == d.Isrc
}).
OnChange(func() {
ctx.Defer(scrollTo)
}).
Value(&d.md)
})

ctx.NewAction(getMarkdown, app.T("path", d.Isrc))
}
Expand All @@ -130,10 +125,10 @@ func (d *remoteMarkdownDoc) Render() app.UI {
Loading(d.md.Status == loading).
Err(d.md.Err).
Label(fmt.Sprintf("Loading %s...", filepath.Base(d.Isrc))),
app.If(d.md.Status == loaded,
newMarkdownDoc().
app.If(d.md.Status == loaded, func() app.UI {
return newMarkdownDoc().
Class("fill").
MD(d.md.Data),
).Else(),
MD(d.md.Data)
}),
)
}
8 changes: 4 additions & 4 deletions docs/src/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ func (m *menu) Render() app.UI {

app.Div().Class("separator"),

app.If(m.appInstallable,
ui.Link().
app.If(m.appInstallable, func() app.UI {
return ui.Link().
Class(linkClass).
Icon(downloadSVG).
Label("Install").
OnClick(m.installApp),
),
OnClick(m.installApp)
}),
ui.Link().
Class(linkClass).
Icon(userLockSVG).
Expand Down
4 changes: 0 additions & 4 deletions docs/src/migrate-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newMigratePage() *migratePage {
return &migratePage{}
}

func (p *migratePage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *migratePage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/notifications-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ func newNotificationsPage() *notificationsPage {
return &notificationsPage{}
}

func (p *notificationsPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *notificationsPage) OnMount(ctx app.Context) {
p.notificationPermission = ctx.Notifications().Permission()
p.registerSubscription(ctx)
Expand Down
16 changes: 8 additions & 8 deletions docs/src/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func (p *page) Render() app.UI {
newMenu().Class("fill"),
).
Index(
app.If(len(p.Iindex) != 0,
ui.Scroll().
app.If(len(p.Iindex) != 0, func() app.UI {
return ui.Scroll().
Class("fill").
HeaderHeight(headerHeight).
Content(
Expand All @@ -90,8 +90,8 @@ func (p *page) Render() app.UI {
newIndexLink().Title("Report an Issue"),
app.Div().Class("separator"),
),
),
),
)
}),
).
Content(
ui.Scroll().
Expand All @@ -105,8 +105,8 @@ func (p *page) Render() app.UI {
Right().
Middle().
Content(
app.If(p.updateAvailable,
app.Div().
app.If(p.updateAvailable, func() app.UI {
return app.Div().
Class("link-update").
Body(
ui.Link().
Expand All @@ -117,8 +117,8 @@ func (p *page) Render() app.UI {
Icon(downloadSVG).
Label("Update").
OnClick(p.updateApp),
),
),
)
}),
),
),
).
Expand Down
4 changes: 0 additions & 4 deletions docs/src/privacy-policy-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newPrivacyPolicyPage() *privacyPolicyPage {
return &privacyPolicyPage{}
}

func (p *privacyPolicyPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *privacyPolicyPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
20 changes: 7 additions & 13 deletions docs/src/reference-content.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ func (c *referenceContent) Index(v bool) *referenceContent {
return c
}

func (c *referenceContent) OnPreRender(ctx app.Context) {
c.load(ctx)
}

func (c *referenceContent) OnMount(ctx app.Context) {
c.load(ctx)
}
Expand All @@ -48,12 +44,11 @@ func (c *referenceContent) OnNav(ctx app.Context) {
}

func (c *referenceContent) load(ctx app.Context) {
ctx.ObserveState(referenceState).
ctx.ObserveState(referenceState, &c.content).
OnChange(func() {
ctx.Defer(c.handleFragment)
ctx.Defer(c.scrollTo)
}).
Value(&c.content)
})

ctx.NewAction(getReference)
}
Expand All @@ -78,12 +73,11 @@ func (c *referenceContent) Render() app.UI {
Err(c.content.Err).
Size(loaderSize).
Spacing(loaderSpacing),

app.If(!c.Iindex && c.content.Content != "",
app.Raw(c.content.Content),
).ElseIf(c.Iindex && c.content.Index != "",
app.Raw(c.content.Index),
),
app.If(!c.Iindex && c.content.Content != "", func() app.UI {
return app.Raw(c.content.Content)
}).ElseIf(c.Iindex && c.content.Index != "", func() app.UI {
return app.Raw(c.content.Index)
}),
app.Div().Text(c.content.Err),
)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/reference-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newReferencePage() *referencePage {
return &referencePage{}
}

func (p *referencePage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *referencePage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/routing-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newRoutingPage() *routingPage {
return &routingPage{}
}

func (p *routingPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *routingPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/seo-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newSEOPage() *seoPage {
return &seoPage{}
}

func (p *seoPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *seoPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
4 changes: 0 additions & 4 deletions docs/src/states-page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ func newStatesPage() *statesPage {
return &statesPage{}
}

func (p *statesPage) OnPreRender(ctx app.Context) {
p.initPage(ctx)
}

func (p *statesPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
Expand Down
Loading