Frontend architecture drafts are coming together. On today's walk,
- 1. At the ORIGIN server, the TREE-manifest of application assets should be granularised to the CODE BLOCK, for styles, scripts, and markup.
- 1.1. This allows INDEXING OF EACH function body, style rule, and document fragment, enabling de/serialisation a.k.a. de/hydration of client application state, including client application logic as state.
- 1.2. That, then allows including NESTED CACHING of markup.
- 1.3. And, that allows for the highly distasteful, but occasionally useful, practice of totally modelling the USER's client state, via [ server-side rendering, SSR ] of both [ entire documents ], and [ document fragments ].
- 1.4. Server and client shall exchange data on latency, server shall default to laziness ( preferring client-side rendering, CSR ), client may object, and server may respond to various degrees, ultimately taking over all work and performing SSR.
- 2. Client HTML app root functions as a broker
- 2.1. ... managing all requests to servers,
- 2.2. ... managing all DOM manipulations,
- 2.3. ... registering web components,
- 2.4. ... and, maintaining ( some degree of ) application state.
- 3. Web components
- 3.1. ... contain markup, styles, and logic, but no business data
- 3.2. ... upon registration (2.3.), if data is required, will request it from broker (2.1.), and if DOM manipulations are required, will request those also (2.2.), possibly combining both into atomic transactions to be guaranteed by the broker.
- 4. Mutation Observer API : enables C++ implementations of communication between components and broker.
- 4.1. It's not even necessary to propagate DOM events along the huge branches of markup, because markup is only an end-product after rendering.
- 4.1.1. The number of app components is far lesser than the number of markup elements, and it is possible to have a small, detached node tree, representing components without markup, which comes out of the box with the propagation behaviours of events between leafs and root.
- 4.1.2. Even without a small detached node tree to model components without markup, it is possible to simply pass to each component and the broker, pointers to each component and the broker, so that they can all inbox each other directly without using the messaging medium of DOM event propagation along the giant markup node tree ( though the latter is initially useful, for passing the direct pointers to each other ).
... this design probably implies a lot of bugs I haven't though about.
But I did think it would be cute, since the test is called Jonwik ( because it's not Qwik ), to call the broke Charon.
No comments :
Post a Comment