-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Sidebar-resizer: change $:/themes/...
tiddlers
#8663
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
base: master
Are you sure you want to change the base?
Sidebar-resizer: change $:/themes/...
tiddlers
#8663
Conversation
|
Confirmed: BurningTreeC has already signed the Contributor License Agreement (see contributing.md) |
sorry for tagging you 😸 The calculations are now done in wikitext in the procedures. |
This works now with all absolute css metrics: Including percentage, which is easy to calculate. The internal calculations are all done in pixel, so this first converts everything to pixel, then calculates, then converts back to the corresponding value. I don't know if this can also support other relative css metrics... |
As I said above, in fixed-fluid mode I'm not settled about how the gap between story-river and sidebar should be handled. |
@BurningTreeC -- I did checkout this branch and did run it, but I can not find any resizer. I think I'm missing something |
Try use GPT o1 for this. BTW, I'm trying to use LLM to add comment to all TW core wikitext, if you aleady add some, LLM will thank you for making it easier :P |
Hi @Jermolene @saqimtiaz @pmario @linonetwo I've now done some experiments using Anyway, now this PR fixed an important problem which is the editor and preview redrawing when resizing. Fixed 🥳 ! I had to use some JS for |
Hello all, is this still relevant? 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the preview: https://deploy-preview-8663--tiddlywiki-previews.netlify.app/
See my minor comments about code style. The rest looks good to me.
<div class={{{ [<edit-preview-state>match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}> | ||
\procedure tp-tiddler-editor-preview() | ||
<div | ||
class={{{ [<get.edit-preview-state>match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [<get.edit-preview-state>match[yes]then[tc-tiddler-preview-identified-]addsuffix<identifier>] [[tc-tiddler-editor]] +[join[ ]] }}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible these lines should have newlines too.
\function convert.to.in(value) [<value>divide[96]] | ||
\function convert.to.pc(value) [convert.to.in<value>multiply[6]] | ||
\function convert.to.pt(value) [convert.to.in<value>multiply[72]] | ||
\function convert.to.em(value) [[storyTiddler]is[variable]then<value>divide{$:/themes/tiddlywiki/vanilla/metrics/bodyfontsize}] [[storyTiddler]!is[variable]then<value>divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any response to this concern?
|
||
\function get.current.theme() [{$:/theme}!is[blank]] :else[all[tiddlers+shadows]plugin-type[theme]plugin-priority[0]first[]] | ||
|
||
\function get.theme.storywidthoverlap() [[max((]addsuffix<get.theme.metric storyright>addsuffix[ - ]addsuffix<get.theme.metric storywidth>addsuffix[ - ]addsuffix<get.theme.metric storyleft>addsuffix[),(-1 * (]addsuffix<get.theme.metric storyright>addsuffix[ - ]addsuffix<get.theme.metric storywidth>addsuffix[ - ]addsuffix<get.theme.metric storyleft>addsuffix[)))]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newlines to body code for better readability.
\function get.theme.storywidthoverlap(
code
\end
|
||
\function get.template-right.style.flex-basis() [<sliderCondition>match[no]then[0%]] :else[[calc(]addsuffix<get.template-right.width>addsuffix[ - ]addsuffix<resizerWidthDivided>addsuffix[px)]] | ||
|
||
\procedure sidebar-resizer(templateLeft:"",templateRight:"",mode:"block",eventCatcherClass:"",zIndexLeft:"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a \whitespace trim
in the code?
Are all the extra new-lines here needed? Are they there for readability or to create redundant DOM elements?
Do they create redundant DOM elements?
$pointerdown=<<sidebar-resizer-pointerdown-actions-inner>> | ||
$pointerup=<<sidebar-resizer-pointercancel-actions>>> | ||
|
||
<%if [<resizer.state>!match[no]] %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant newlines? -- I did skip this comment in all other files where there happens to be redundant new-lines
@@ -18,7 +18,8 @@ | |||
"tiddlywiki/tight", | |||
"tiddlywiki/heavier", | |||
"tiddlywiki/tight-heavier", | |||
"tiddlywiki/readonly" | |||
"tiddlywiki/readonly", | |||
"tiddlywiki/example" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this theme be renamed? eg: "resizers" or something similar?
I'll try to address your comments soon |
Hello all, |
@BurningTreeC @Jermolene -- I would love to get that PR merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @BurningTreeC.
My main concern is the overall size of these changes. It is useful functionality, but these changes add 34,124 byte to index.html, which is 1.2% of the size of empty.html. That's twice the size of recent WYSIWYG editor libraries.
As I note below, there is a lot of duplication in the code. If we can, I'd rather get the overhead down by improving core functionality to make the necessary changes cleaner and more reusable. We've been making good progress exploring ways to make wikitext and filters more expressive and efficient, and I think this PR would make an excellent driver for further improvements.
In the meantime, I think we need to look at the possibility of a much smaller PR that just makes the necessary core modifications to allow this functionality to be shipped as a plugin.
@@ -1,11 +1,13 @@ | |||
title: $:/language/ThemeTweaks/ | |||
|
|||
ThemeTweaks: Theme Tweaks | |||
ThemeTweaks/Hint: You can tweak certain aspects of the ''Vanilla'' theme. | |||
ThemeTweaks/Hint: You can tweak certain aspects of the ''<$text text={{{ [<get.current.theme>get[name]] :else[[current]] }}}/>'' theme. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have adopted the convention that core functions should be prefixed tf.
. In this case I think it would be preferable to create a little, local macro that encapsulates the entire <$text>
widget, called something like <<theme-name>>
.
|
||
\function sidebarbreakpoint-minus-one() [subtract.one.from.sidebarbreakpoint<sidebarbreakpoint>] :else[<sidebarbreakpoint>] | ||
|
||
\function add.one.to.breakpoint(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These dense, repetitious filters stick out a little. Is there some way that they could be simplified?
Hi @Jermolene @pmario and all others interested. |
Maybe while making a plugin I find ways how to shrink it so that it becomes suitable for the core |
I would be interested in a plugin like this, if it is possible. |
Thanks @BurningTreeC @pmario I do think this functionality would make a lot of users very happy. I remain very keen to try to get the necessary primitives into the core. Perhaps we might start with something relatively simple like the CSS unit conversions. |
Hello @Jermolene Would you be in favor of me adding the CSS unit conversions as functions or should they be implemented in JS? |
Hi @BurningTreeC on reflection I think it may be premature to make that change. If we're going the plugin route then it would make more sense to focus on the smallest, simplest core modifications that would support the plugin, and then at a later stage review generic functionality like the CSS unit conversions for inclusion in the core. |
Hello @Jermolene |
Hi @BurningTreeC the simplest solution might be for the stylesheets themselves to include conditional code that checks the current value of |
Thanks @Jermolene ! |
This PR uses the same mechanism as #8644 but changes the
$:/themes/tiddlywiki/vanilla/metrics/...
tiddlers directly.Note that in fixed-fluid mode thestory-river
actually changes its width but thetiddlerwidth
remains fixed width as there was no discussion yet how we handle this. I just made the tiddlers adapt to the story-river if the story-river-width goes below the tiddlerwidth.There are some design questions:
I haven't yet added the ControlPanel configurations used for storyminwidth and sidebarminwidth.This PR is just for completeness, I will update it so that we can compare with other possible solutions.
In the meantime this PR has been updated quite a bit, I've put a current build here:
https://sidebar-resizer-config.tiddlyhost.com/