TiddlyWiki5 icon indicating copy to clipboard operation
TiddlyWiki5 copied to clipboard

Root stylesheet refresh - Stylesheets in single `<style>` tags

Open BurningTreeC opened this issue 3 months ago • 2 comments

This PR is a follow-up to #8106 , #8118 and #8125 It's also related to the discussion #8128

This puts every tiddler tagged $:/tags/Stylesheet into its own <style> tag at the BOTTOM of the <head> section. Why at the bottom? The list widget in $:/core/ui/RootStylesheet handles inserting and removing its list items all by itself. It does so by appending at the end of the <head> section. That's why from the beginning in render.js and windows.js I render the styleWidgetNode into the end of the <head> section and let the list widget do its "natural" flow.

This uses a modified view widget that's included in this PR. I'm not sure if I got @Jermolene right how it should be done but that's my try on it. It updates the textContent of its generated domNode in case the format is plainwikified, htmlwikified or htmlencodedplainwikified and the content changes, through a contained macro for example that changes.

The $:/core/ui/RootStylesheet distinguishes between standard Stylesheet tiddlers and Stylesheet tiddlers tagged $:/tags/Stylesheet/Static. In the latter case they are rendered as text and not refreshed which (I hope) makes it possible to save refresh time if we put static content into static Stylesheet tiddlers.

I open this as a draft PR since it has Performance Instrumentation enabled and the code might change based on the feedback I get.

BurningTreeC avatar Apr 04 '24 04:04 BurningTreeC