These are chat archives for ractivejs/ractive

15th
May 2018
Chris Reeves
@evs-chris
May 15 2018 01:33
If you don't mind getting slightly dirty with the template, you can definitely inject whatever you want
Cerem Cem ASLAN
@ceremcem
May 15 2018 01:34
:)
Chris Reeves
@evs-chris
May 15 2018 01:46
For dynamic table stuff, I've had good results with generating a template for rows based on column templates
Cerem Cem ASLAN
@ceremcem
May 15 2018 02:53
is the template documentation completed? @fskreuz had a separate repo, IIRC
Joseph
@fskreuz
May 15 2018 13:13
nope, separate repo was the monorepo, no docs there (and haven't worked on for a while because life). i write docs directly to the ractivejs.github.io repo.
Cerem Cem ASLAN
@ceremcem
May 15 2018 13:14
(life is tough, sometimes)
Joseph
@fskreuz
May 15 2018 13:16
if only life was as easy as throwing more hardware at it... :smile: horizontal scaling ftw.
Cerem Cem ASLAN
@ceremcem
May 15 2018 13:16
ahahah :D cloning had a lot progress :P
this is the place I should look at, right: https://ractive.js.org/concepts/#templates
Joseph
@fskreuz
May 15 2018 13:27
For concepts (how things work under the hood), yes. For the API (how to write), that would be https://ractive.js.org/api/#mustaches
Cerem Cem ASLAN
@ceremcem
May 15 2018 13:31
If you don't mind getting slightly dirty with the template, you can definitely inject whatever you want
Chris Reeves
@evs-chris
May 15 2018 18:22
probably the easiest way to grasp the template structure is referencing this file and using Ractive.parse to see what some common template structures parse down to
the gist of it is that a template is just and array where each child is a string or an object
the objects have a type that determines what they represent e.g. 2 is an interpolator ({{ something }}) and 7 is an element
things that can have content, like elements and sections also have a fragment member f, that is a template array
Chris Reeves
@evs-chris
May 15 2018 18:28
things that have a reference are either a plain ref r, a reference expression rx, or an expression x - where the r is a keypath, the rx is an object with an r and an array of keypaths m, and the x is an object with an s expression text (_0+_1 for foo + bar) and an array of keypaths r (['foo', 'bar'] for foo + bar)
elements also can have attributes, which are objects { t: 13, ... } stored in their attribute array at m
pretty much everything from 20 to 40 in the types file is ephemeral and only used when breaking down expressions before they get turned into their stringy forms
once you've got those basic building blocks nailed down, modifying or generating templates is really not too hard
the worst part is remembering which t is what and which subtype to use on sections at n
Cerem Cem ASLAN
@ceremcem
May 15 2018 23:21
understanding the Ractive template AST excites me a lot, so I feel like I can handle that :)

the worst part is remembering which t is what and which subtype to use on sections at n

does this also mean "if we had a special Ractive IDE that gives the tooltip when we needed, we could make the progress a lot easier"?

Cerem Cem ASLAN
@ceremcem
May 15 2018 23:55
(...just saying)