Re: [twdev] Re: Tailwind - a CSS framework as if made for TW !

2019-08-27 Thread Arlen Beiler
I'm Shocked! It Worked!

\define class(suffix) $(classprefix)$$suffix$
\define css()
.$(classprefix)$align {
  text-align:right;
}
\end
<$set name="classprefix" value=<>>
<$text text=<>/>
>>Hello world


On Tue, Aug 27, 2019 at 10:29 PM Arlen Beiler  wrote:

> This is why I want the autoparagraph feature GONE! Ok, whatever, maybe
> that won't happen right away, but we'll get somewhere close eventually. I
> love the idea of adding parameters to the mime type. I didn't even know
> that was a thing before today.
>
> But this is a good read (the article from the original post):
> https://adamwathan.me/css-utility-classes-and-separation-of-concerns/
>
> I think we should consider that idea, or perhaps an alternate idea that I
> got from react native where styles are kept near the elements they style.
> So for instance every template tiddler would have a stylesheet tiddler and
> use a variation of the qualify macro to return the class names to use for
> those styles, and also add those classes to the global stylesheet whenever
> the tiddler is rendered, probably using the same macro somehow, but still
> it would be unique based on the position in the widget tree. The styles
> could be defined using a macro as well, I believe. That would probably be
> easier. But I don't quite know how to get the styles into the global
> stylesheet. Maybe we need to have a style widget that just sticks in a
> style tag with its unique class names right there.
>
> On Tue, Aug 27, 2019 at 6:30 PM Thomas Elmiger 
> wrote:
>
>> Hi Mat, Jeremy and Mario,
>>
>> Thanks for thinking of me, Mat, and my usage of tachyons elements in my
>> Bricks studio.
>>
>> The reasons why I (only) adapted selected parts of tachyons (typography,
>> spacing/measures, some colours, ...) are:
>>
>>- I like the simple and useful design concept (as a starting point).
>>- I basically agree with what Mario says.
>>- TiddlyWiki can already do magic stuff (variables, calculations –
>>JavaScript in CSS –, theme-tweaks, palettes, ...).
>>
>> Some things that are difficult in standard TW and that I tried to improve
>> in Bricks:
>>
>>- Find the right spot in the existing CSS to change.
>>- So I transformed it into a collection of specialised small CSS
>>   documents.
>>   - Colour calculations, e.g. to blend or invert colours or to check
>>contrast (accessibility).
>>   - My ambition was: Enable users to choose some base colours, and
>>   then calculate everything else automagically. That turned out to be
>>   incredibly hard.
>>   - Still I think my ColorAction plugin is great and the Colour
>>   Manager 
>>   points in the right direction (it allows to define/calculate colours 
>> based
>>   on other colour variables – and still see them, a big improvement 
>> compared
>>   to the standard palette manager).
>>   - Use different colour schemes for content and sidebar (e.g. dark
>>sidebar, light background for content)
>>   - I hacked a way around this but it was a long and hard process.
>>   - Save computing power: With TWs flexibility, the more variables
>>you have the more complex calculations are needed to render the design.
>>- So I implemented a simple "compiler" that renders one big
>>   stylesheet without any variables. I can use this "frozen" version to
>>   publish faster wikis.
>>- Adjust spacing to follow a system (margins, paddings, whitespace
>>around headings, ...)
>>   - This is where my tachyons-based variables were extremely helpful.
>>
>> So features like these would be more important for me, than what/if any
>> framework is used. As long as there is a solid concept that goes through
>> all of TW and is easily adaptable (using far less parameters than the
>> ControlPanel offers today) I would actually not care, where it is derived
>> from.
>>
>> All the best,
>> Thomas
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "TiddlyWikiDev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to tiddlywikidev+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywikidev/507dced0-8a53-42a7-970c-fa7beb88177e%40googlegroups.com
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CAJ1vdSRVa2Uj6ZnPvjobeVObK6Czy86UO0AY4QDS5MR5iqOPcA%40mail.gmail.com.


Re: [twdev] Re: Tailwind - a CSS framework as if made for TW !

2019-08-27 Thread Arlen Beiler
This is why I want the autoparagraph feature GONE! Ok, whatever, maybe that
won't happen right away, but we'll get somewhere close eventually. I love
the idea of adding parameters to the mime type. I didn't even know that was
a thing before today.

But this is a good read (the article from the original post):
https://adamwathan.me/css-utility-classes-and-separation-of-concerns/

I think we should consider that idea, or perhaps an alternate idea that I
got from react native where styles are kept near the elements they style.
So for instance every template tiddler would have a stylesheet tiddler and
use a variation of the qualify macro to return the class names to use for
those styles, and also add those classes to the global stylesheet whenever
the tiddler is rendered, probably using the same macro somehow, but still
it would be unique based on the position in the widget tree. The styles
could be defined using a macro as well, I believe. That would probably be
easier. But I don't quite know how to get the styles into the global
stylesheet. Maybe we need to have a style widget that just sticks in a
style tag with its unique class names right there.

On Tue, Aug 27, 2019 at 6:30 PM Thomas Elmiger 
wrote:

> Hi Mat, Jeremy and Mario,
>
> Thanks for thinking of me, Mat, and my usage of tachyons elements in my
> Bricks studio.
>
> The reasons why I (only) adapted selected parts of tachyons (typography,
> spacing/measures, some colours, ...) are:
>
>- I like the simple and useful design concept (as a starting point).
>- I basically agree with what Mario says.
>- TiddlyWiki can already do magic stuff (variables, calculations –
>JavaScript in CSS –, theme-tweaks, palettes, ...).
>
> Some things that are difficult in standard TW and that I tried to improve
> in Bricks:
>
>- Find the right spot in the existing CSS to change.
>- So I transformed it into a collection of specialised small CSS
>   documents.
>   - Colour calculations, e.g. to blend or invert colours or to check
>contrast (accessibility).
>   - My ambition was: Enable users to choose some base colours, and
>   then calculate everything else automagically. That turned out to be
>   incredibly hard.
>   - Still I think my ColorAction plugin is great and the Colour
>   Manager 
>   points in the right direction (it allows to define/calculate colours 
> based
>   on other colour variables – and still see them, a big improvement 
> compared
>   to the standard palette manager).
>   - Use different colour schemes for content and sidebar (e.g. dark
>sidebar, light background for content)
>   - I hacked a way around this but it was a long and hard process.
>   - Save computing power: With TWs flexibility, the more variables
>you have the more complex calculations are needed to render the design.
>- So I implemented a simple "compiler" that renders one big stylesheet
>   without any variables. I can use this "frozen" version to publish faster
>   wikis.
>- Adjust spacing to follow a system (margins, paddings, whitespace
>around headings, ...)
>   - This is where my tachyons-based variables were extremely helpful.
>
> So features like these would be more important for me, than what/if any
> framework is used. As long as there is a solid concept that goes through
> all of TW and is easily adaptable (using far less parameters than the
> ControlPanel offers today) I would actually not care, where it is derived
> from.
>
> All the best,
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tiddlywikidev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/507dced0-8a53-42a7-970c-fa7beb88177e%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CAJ1vdSRXPpKDy7a3kqrm340y3%2BtC3wsZH4LLcsUNvZ%2B%3DzK9wYA%40mail.gmail.com.


Re: [twdev] Re: What should CSS's role be for users in TW?

2019-08-27 Thread Thomas Elmiger
Maybe not more tweaks to the default theme, but more different themes to 
choose from, each with only a limited set of tweaks? Theme demos or a theme 
library where users can easily find a starting point they already like and 
just need to tweak a little bit to make it their own ... 

Just dreamin'
Thomas

Am Dienstag, 27. August 2019 17:56:38 UTC+2 schrieb Jeremy Ruston:
>
> I'd certainly favour making the default theme much more tweakable by end 
> users without knowing CSS. For example, sliders to alter the tightness of 
> margins, more options for the positioning of elements like the sidebar and 
> story river etc.
>
> Best wishes
>
> Jeremy 
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/ced7c662-9672-4f60-b91b-15df0feea1b3%40googlegroups.com.


[twdev] Re: Tailwind - a CSS framework as if made for TW !

2019-08-27 Thread Thomas Elmiger
Hi Mat, Jeremy and Mario,

Thanks for thinking of me, Mat, and my usage of tachyons elements in my 
Bricks studio. 

The reasons why I (only) adapted selected parts of tachyons (typography, 
spacing/measures, some colours, ...) are: 

   - I like the simple and useful design concept (as a starting point).
   - I basically agree with what Mario says.
   - TiddlyWiki can already do magic stuff (variables, calculations – 
   JavaScript in CSS –, theme-tweaks, palettes, ...).
   
Some things that are difficult in standard TW and that I tried to improve 
in Bricks: 

   - Find the right spot in the existing CSS to change. 
   - So I transformed it into a collection of specialised small CSS 
  documents.
  - Colour calculations, e.g. to blend or invert colours or to check 
   contrast (accessibility).
  - My ambition was: Enable users to choose some base colours, and then 
  calculate everything else automagically. That turned out to be incredibly 
  hard.
  - Still I think my ColorAction plugin is great and the Colour Manager 
   points in the 
  right direction (it allows to define/calculate colours based on other 
  colour variables – and still see them, a big improvement compared to the 
  standard palette manager).
  - Use different colour schemes for content and sidebar (e.g. dark 
   sidebar, light background for content)
  - I hacked a way around this but it was a long and hard process. 
  - Save computing power: With TWs flexibility, the more variables you 
   have the more complex calculations are needed to render the design. 
   - So I implemented a simple "compiler" that renders one big stylesheet 
  without any variables. I can use this "frozen" version to publish faster 
  wikis.
   - Adjust spacing to follow a system (margins, paddings, whitespace 
   around headings, ...)
  - This is where my tachyons-based variables were extremely helpful.
   
So features like these would be more important for me, than what/if any 
framework is used. As long as there is a solid concept that goes through 
all of TW and is easily adaptable (using far less parameters than the 
ControlPanel offers today) I would actually not care, where it is derived 
from.

All the best,
Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/507dced0-8a53-42a7-970c-fa7beb88177e%40googlegroups.com.


[twdev] Re: Weird behavior of File Backups with TWc

2019-08-27 Thread PMario
Hi BJ, 

There seems to be a problem in TWc, which is there for a long time already. 
.. As you pointed out, it causes a problem now. ... I'll open a new issue 
at: https://github.com/TiddlyWiki/TiddlyWiki/issues once I'm sure I did 
fully understand what's going on. 

It would be nice, if you could join in. ... Can you point me to the fixes, 
you had to make to your plugin?
-mario

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/93291e49-890f-4fe1-8e42-6ac956e5e870%40googlegroups.com.


[twdev] Re: Weird behavior of File Backups with TWc

2019-08-27 Thread PMario
Hi Ton, 

I think I did find the real problem and fixed it. ... There is a new beta 
version. Please try it: 
https://github.com/pmario/file-backups/issues/28#issuecomment-525451252 

have fun!
mario

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/889791bc-32b3-44e6-803c-c1a989a9dfa8%40googlegroups.com.


Re: [twdev] Re: Tailwind - a CSS framework as if made for TW !

2019-08-27 Thread Jeremy Ruston
Hi Mat,

Just to say that I share your enthusiasm for moving towards our default themes 
being based on re-using existing CSS frameworks. Tailwind looks great, and 
tries to address many concerns that are familiar to us. However, frameworks 
like Tailwind go so far beyond what is possible with CSS that they are all 
based on tools that extend and enflex CSS: SCSS, Less, etc. In the case of 
Tailwind the dependencies are unfamiliar to me but seem to include an 
interesting looking mechanism for manipulating CSS within JS. Meanwhile, TW5 
itself already incorporates the important functionality of those CSS frameworks 
(e.g. making it possible to use maths operators to compute dimensions).

The essence of TW5's internal design is to reuse the same wikification 
mechanism for everything, and so I don't want to bring into the core an 
alternative mechanism that duplicates what we can do with wikification. So, I 
think the approach we'd have to take is to take a static snapshot of the output 
of the framework and then use automated tooling to transform it into something 
that TW can process. The idea would be to move from specifying parameters at 
the time the Tailwind framework is built to doing it dynamically via wikitext 
constructions.

It's the kind of thing I'd like to address for v5.2.x

Best wishes

Jeremy


--
Jeremy Ruston
jer...@jermolene.com
https://jermolene.com

> On 26 Aug 2019, at 18:59, Mat  wrote:
> 
> 
> PMario, thanks for great input!
> 
> 
>> TLDR;
>> The concept of utility classes is worth considering for TW.
> 
> Good you agree; Introducing utility classes was the main point!
> 
> I won't delve into the details of your reply because we actually agree. I 
> also don't think we'd need an extensive framework for this BUT I do think it 
> could save us a lot of work if we find a suitable one - but more than 
> anything we might not do it ourselves if we're supposed to do it from scratch.
> 
> Just one note; you're a bit unfair when you complain that we don't want to 
> use "vue.js or react.js or angular.js or .js" because that is 
> the video presenters exact point: Use your own environment, in our case tw. 
> And they make this point when they talk about avoiding repeated text which is 
> a macrolishiously simple matter in TW.
> 
> Your reply makes me realize we should first discuss what it is we want with 
> CSS in TW. I'll start a thread.
> 
> 
> <:-)
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to tiddlywikidev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/8335ab0d-b26d-43fb-a0a1-6d73d3d884e5%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/33B8B304-BA90-4250-8BB6-E4D3FF609FDE%40gmail.com.


Re: [twdev] Re: What should CSS's role be for users in TW?

2019-08-27 Thread Jeremy Ruston
I'd certainly favour making the default theme much more tweakable by end users 
without knowing CSS. For example, sliders to alter the tightness of margins, 
more options for the positioning of elements like the sidebar and story river 
etc.

Best wishes

Jeremy

--
Jeremy Ruston
jer...@jermolene.com
https://jermolene.com

> On 27 Aug 2019, at 01:48, TonyM  wrote:
> 
> 
> Mat,
> 
> As you know I started this thread CSS and TiddlyWiki - Open discussion from a 
> different perspective. I support you raising this here.
> 
> To respond to this thread;
> There are some cases where css has answers not found in wikitext or widgets, 
> and some cases where html is a superior method thus css becomes useful to 
> style that html.
> If css is the best or only way to do something perhaps this flags a gap in 
> tiddlywiki features, that could be addressed.
> Also Tiddlywiki uses css for its own interface and I believe when doing so we 
> should have a reference work so people can tweek tiddlywiki with css if they 
> wish. This includes documenting where/what existing classes are used in 
> tiddlywiki's User interface. Inspect is not a novices tool.
> css provides a powerful way to overlay and switch ui elements, as a result I 
> believe we should avoid compromising its use (ie do not make decisions that 
> limit the power of CSS over a wiki as much as we can, but I do not think it 
> should be the main avenue for user interface manipulation. Tiddlywiki already 
> provides rich interface settings.
> I think we should document or provide some instructions or primitives that 
> need css, and how to make use of it.
> In some special cases some plugins or tiddlywiki.com documentation that 
> leverage css to achieve things that are harder elsewhere should be done.
> Helping pagination when printing tiddlers
> Some numbering situations
> Perhaps even sortable tables
> Building nice html/css layouts within tiddlers.
> Publishing static tiddlers with better styles and layouts
> The trick to get in tiddler anchors
> I have discovered the simple act of using html tables and the 
> `` html tags and css to control break avoidance in a row 
> etc..  allows pagination of tables when printing (open in new window and 
> Print). This is a helpful thing to know and need not have any additional 
> coding associated with it, but it does need to be documented, since 
> tiddlywiki is by its very nature good at lists and tables this is an 
> essential feature.
> In summary the community needs to curate good solutions for users whatever 
> the technology we use, keeping it as accessible to novices as possible, and 
> do our best not to compromise the use of those technologies for others to 
> extend tiddlywiki ie javascript, html and css.
> 
> Regards
> Tony
> 
>> On Tuesday, August 27, 2019 at 5:29:08 AM UTC+10, Mat wrote:
>> Problem:
>> 
>>> Yes, you can make almost anything with TW - it is made for hacking! What's 
>>> that? - sidebar on left side? ... ehm.. that's a bit beyond of TW 
>>> itself you must know CSS.
>> 
>> I think we all agree that a TW user should ideally not have to learn CSS to 
>> shape TW into what he wants. How can we get away from this? Or does it have 
>> to be this way?
>> 
>> Another problem, even when you know CSS:
>> 
>> There is a big "workflow differences" between wikitext / html and css - 
>> Wikitext and html is where the user is ...but CSS is somewhere else:
>> 
>> If you want to modify wikitext/html, you "click edit and then edit". CSS is 
>> often way more intricate. You must figure out where the style is defined, 
>> open that stylesheet and then often the most difficult part to locate the 
>> place(s!) what it is defined. And then go back - i.e if you don't want to 
>> overwrite the stylesheet, you must copy-paste by creating a new stylesheet, 
>> tag it, type it, close the original stylesheet. Et cetera. 
>> 
>> With html we have (some) wikitext "elements" presumably so the user won't 
>> have to know html. E.g pipe for tables and several of the widgets. With CSS 
>> we  have some predefined classes but as someone pointed out; the more 
>> properties a class has the less reusable it is!
>> 
>> How can TW deal with this problem in a good way? How much CSS should a TW 
>> user need to know? Maybe even: Who does TW cater for and therefore who does 
>> the CSS solution cater for? 
>> 
>> 
>> P.S Worthwhile article on CSS and Scalability.
>> 
>> <:-)
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to tiddlywikidev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/f94b73dd-48bf-4713-b38d-17e40e6f31c8%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from 

Re: [twdev] Re: How to use Node modules in browser?

2019-08-27 Thread Jeremy Ruston
Hi Bimlas

To make the browser to pick up changes from the server then you can trigger 
polling with the tm-server-refresh message. In my own experiments I often just 
change the default polling interval from 60s down to 3-5s (via 
$:/config/SyncPollingInterval).

You may also be interested in this pending PR which attempts to address some of 
these issues by introducing a new framework for invoking external tasks on the 
server:

https://github.com/Jermolene/TiddlyWiki5/pull/3461

Best wishes

Jeremy

--
Jeremy Ruston
jer...@jermolene.com
https://jermolene.com

>> On 27 Aug 2019, at 13:32, bimlas  wrote:
> 
> I think I found the solution: I have to use this (after the tiddler is 
> modified) in the browser (by an ActionWidget for example):
> 
>   $tw.utils.nextTick(function() {
> $tw.syncer.enqueueSyncTask({type: "load", title: 
> "$:/communicate-with-server"})
>   });
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to tiddlywikidev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/030d5158-3cac-472c-8044-5c48284b40f1%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/BB72E578-49A6-44DA-82DD-7538D7A02B7A%40gmail.com.


Re: [twdev] Re: How to use Node modules in browser?

2019-08-27 Thread bimlas
I think I found the solution: I have to use this (after the tiddler is 
modified) in the browser (by an ActionWidget for example):

  $tw.utils.nextTick(function() {
$tw.syncer.enqueueSyncTask({type: "load", title: 
"$:/communicate-with-server"})
  });

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/030d5158-3cac-472c-8044-5c48284b40f1%40googlegroups.com.


[twdev] Re: [TW5] Data Visualisation using SVG or Chartist.js

2019-08-27 Thread Mohammad
This is great Anders!

Thanks for sharing!

Mohammad

On Monday, August 26, 2019 at 4:54:00 PM UTC+4:30, ajarmund wrote:
>
> Thank you! I updated the macro to have plot width and marker size as 
> parameters as well. The hover effect should be customisable through the CSS 
> stylesheet, but I guess the plugins by Jed will have more functionality
>
> Best,
> Anders
>
>
> mandag 26. august 2019 11.09.44 UTC+2 skrev Mohammad følgende:
>>
>> Hi Anders,
>>  This is wonderful! The feasibility was proved!
>> It is good if one can customize the size the marker and have a better 
>> hover effect.
>>
>> --Mohammad
>>
>> On Saturday, August 24, 2019 at 3:32:13 PM UTC+4:30, ajarmund wrote:
>>>
>>> And now 5.1.20 has been released with mathematical operators! I tried to 
>>> make a simple macro using SVG: 
>>> http://folk.ntnu.no/anderhja/plotdemo.html
>>>
>>> However, what is the best way to transclude a macro making a SVG in 
>>> terms of scaling? I tried to make a tiddler calling the macro with type SVG 
>>> for transclusion, but it didn't work, so maybe CSS is the way to go?
>>>
>>>
>>> - Anders
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/e16f224d-4249-4ef7-ba20-6acfce759e54%40googlegroups.com.


Re: [twdev] Re: How to use Node modules in browser?

2019-08-27 Thread bimlas
Jeremy,

... have the browser create a tiddler with some flags that gets synced to 
> the server. The serverside code picks up the tiddler (by searching for the 
> same flags), and then performs some operation, putting the results back in 
> the same tiddler.
>

 So far it works so that the server receives the query and executes the 
change, but how can I "upload" the changes? On the file system I can see 
that the tiddler has changed, but how can I update it in the browser? There 
I still see the query, not the response.

Example code:

* Create a new directory and cd into it
* `npm init && npm install --save tiddlywiki`
* Create `index.js` with this content:

// Start TiddlyWiki
var $tw = require('tiddlywiki').TiddlyWiki();
$tw.boot.argv = ['gui', '--listen'];
$tw.boot.boot(function() {});

$tw.wiki.addEventListener("change", function (changedTiddlers) {
  if (!"$:/communicate-with-server" in changedTiddlers) return;
  var tiddler = $tw.wiki.getTiddler("$:/communicate-with-server");
  if (!tiddler || (tiddler.fields["sender"] === "server")) return;
  console.log("Query got from browser");

  var query = tiddler.fields.text;
  var response = $tw.wiki.getModificationFields();
  response["sender"] = "server";
  
  // Parse query...
  console.log("Original query:" + query);
  response.text = query.toUpperCase();
  
  $tw.wiki.addTiddler(new $tw.Tiddler(tiddler,response));
});

* `node index.js`
* Create "$:/communicate-with-server" and write something in it

When you save it, it notifies you in the terminal (where Node is running) 
that it has received a request from the browser and executes the change 
(capitalizing the text), saves the file, but the browser knows nothing 
about it: it still does shows the version in memory. (If you want to send a 
request again, make sure the "sender" field is cleared)

How do I get the browser to read the file system change? And how do I tell 
the browser when the change was made (so I don't have to use a timer after 
I send the request)?


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/17d5d753-6874-4a88-936e-eabf03db3a39%40googlegroups.com.