These are chat archives for canjs/canjs

14th
Nov 2017
Eben
@eben-roux
Nov 14 2017 04:33
@frank-dspeed The problem appears to be that the produced html seems to contain an element that is breaking the css. My css may not be the best but been doing web since Netscape days ~1998. I don't really appreciate your tone Frank. If this forum is going to go this route I am going to move away from canjs. It is hard enough trying to get stuff working without having poor support and an attitude.
But in the meantime you are welcome to show me how to place those elements side-by-side... which is what I want to do.
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 04:47
@eben-roux since we don't currently support "transparent" components (one where the custom tag itself doesn't appear in the HTML output), you're better off importing the template as a partial -- you've hit upon one limitation of custom tags and components like this, that sometimes they get in the way of parent/child tag relationships.
Eben
@eben-roux
Nov 14 2017 04:48
@bmomberger-bitovi thanks... pity I had to wait a day to get that knowledge :) --- I really thought I had a half-decent look at the docs but couldn't find anything w.r.t. this. I recall Ember having the same issue.
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 04:49
<can-import from="cs-nav-partial.stache!" @value:to="scope.vars.navPartial" />
{{> scope.vars.navPartial}}
Sorry, I'm on client work right now instead of open source so I'm not as responsive on Gitter
Eben
@eben-roux
Nov 14 2017 04:49
excellent, thanks... I'll give it a bash tonight at home once I have some time
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 04:52
As far as I know, React doesn't output component tags, and Angular lets you "transclude" directives, so those are more compatible with stuff like special <li> tags and even SVGs. We just avoid components in cases like this, because (and I've tried to do this before) the alternative is to manually attach nodes to the element's parent in a can-view-callbacks.tag handler, and that's not fun.
Eben
@eben-roux
Nov 14 2017 04:53
had a quick look but I don't see anything on partials in the docs... I can search (if I know I'm looking for them)
should this limitation not be made more apparent somehow?
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 04:54
let me link you. one moment
Eben
@eben-roux
Nov 14 2017 04:54
np, got it
Kevin Phillips
@phillipskevin
Nov 14 2017 04:54
you can also use can-view-callbacks.attr
Eben
@eben-roux
Nov 14 2017 04:54
with a search... but it isn't really apparent and quite tricky
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 04:55
Ah, that is a good point.
Kevin Phillips
@phillipskevin
Nov 14 2017 04:55
depending on what your nav-dropdown needs to do
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 04:55
so if you give your <li> tag a special attribute you can set up a listener that populates it.
Eben
@eben-roux
Nov 14 2017 04:55
since css is quite dependent on the html structure it has quite an impact...
Kevin Phillips
@phillipskevin
Nov 14 2017 04:56
sorry, I meant to respond to your forum post this morning but got tied up with other stuff
Eben
@eben-roux
Nov 14 2017 04:56
not so much interested in special behaviour as that is taken care of by bootstrap
just need it to render as expected
I saw the extra element but no way to remove it
I'm assuming the canjs is attaching something special to that node so it cannot simply just not be rendered?
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 04:57
For can-components that is true. It listens for the element to be removed to tear down bindings
Eben
@eben-roux
Nov 14 2017 04:58
how would a partial tear down bindings?
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 04:58
It is rendered as part of rendering the parent template, so it has can-view-nodelists set up that can handle it.
Kevin Phillips
@phillipskevin
Nov 14 2017 04:59
Eben
@eben-roux
Nov 14 2017 04:59
thanks Kevin, I'll take a look
Kevin Phillips
@phillipskevin
Nov 14 2017 04:59
in case those aren't the ones you found
this is also a long-requested feature: canjs/can-component#95
if you want to add a comment with your interest
Eben
@eben-roux
Nov 14 2017 05:02
@bmomberger-bitovi: It would actually be quite useful to have a garbage collector for this type of thing. In the "managed" world of .Net (and Java too I believe) the garbage collector inspects objects to check for references and it gets passed through a couple of generations before being removed from the heap (destroyed). Wonder if something like this isn't possible with bindings...
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 05:04
We do the best we can. All the blessed paths that we cover in tutorials and guides are memory safe. they can tear themselves down properly. When you get into the much lower level stuff, though, more of the responsibility is shifted to you to make sure that things that are bound are torn down, references are nulled out, etc.
I'd hesitate to do a garbage check in userspace in a JavaScript context because of performance reasons. the native garbage collector for allocated memory is already quite slow for large data sets.
Eben
@eben-roux
Nov 14 2017 05:07
just a thought :) --- probably why .Net uses a generational GC but not really my space (the lower level stuff)
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 05:09
Same. I trust the existing teams of managed runtime experts. :)
Eben
@eben-roux
Nov 14 2017 05:11
I guess if one were to use a huge collection of bindings that are inspected every-so-often it may very well spiral out of control... given that JS is single-threaded and all that; although a web worker may, well... work...
Frank Lemanschik
@frank-dspeed
Nov 14 2017 11:40
@eben-roux there is no need to move away from can-js for having css features right way
do you want a can-webcomponent? you can beta test it if you like
:)
features are its working with in html placed <my-component> tags
and it supports taking the normal css
as it would be in normal html
Frank Lemanschik
@frank-dspeed
Nov 14 2017 12:27
canjs offers some good futures for you like the stach templates with that bindings and nesting
and you should use steal steal is systemjs with npm-crawler
Frank Lemanschik
@frank-dspeed
Nov 14 2017 12:50
@phillipskevin @pYr0x does one of you remember the current status of tree walking in can-stache?
does it still walk up complet ?
or is that solved already
Justin Meyer
@justinbmeyer
Nov 14 2017 13:37
@ivospinheiro In 4.0, I pulled out some of the underlying bits of can-observation, which would let you know what changed
I'm trying to think what it would take to do something similar in 3.0
You could hack your own observation like can-view-scope/compute_data does
Julian
@pYr0x
Nov 14 2017 14:54
@frank-dspeed i think in can-stache, currently, tree walking is still present
Kevin Phillips
@phillipskevin
Nov 14 2017 14:54
yes, it is
Frank Lemanschik
@frank-dspeed
Nov 14 2017 14:54
ok thanks
Kevin Phillips
@phillipskevin
Nov 14 2017 14:54
will be removed in 4.0
Julian
@pYr0x
Nov 14 2017 14:54
you get a warning
Frank Lemanschik
@frank-dspeed
Nov 14 2017 14:54
that helps a lot :)
Julian
@pYr0x
Nov 14 2017 14:54
@phillipskevin i have a working example of a none working el:innerHTML binding
Kevin Phillips
@phillipskevin
Nov 14 2017 14:54
a pre-release will be out in the next couple days
Frank Lemanschik
@frank-dspeed
Nov 14 2017 14:55
can some one of you maybe suggest a more well name for the following
Julian
@pYr0x
Nov 14 2017 14:55
i will let you know the jsbin if i have cleaned it up
Kevin Phillips
@phillipskevin
Nov 14 2017 14:55
great
I'll take a look when you've got it
i mean customelementregistry is the real name of this
customelementregistry is the new webcomponents v2 name
the probally final name
it aims to register a can component as element and setting the right scope
based on the window.document
so that composed can-components in html behavie as composed inside can-stache
it its basicly binding customelementregistry with can-dom-data-state
and its binding the real window document dom tree
at-nikolaus/nils#4
i am working on detecting can-element can-component inside dom and generating a list that can be synced with can-dom-data-state
but i am not sure about the name can-customelementregistry
is a bit long and hard to sell?
:D
Frank Lemanschik
@frank-dspeed
Nov 14 2017 15:02
i want to abstract into that the logic like has own viewmodel and that whats done in can-element
to have it more generic and use able
i think i can make it interoperable
all can-components inside stache work with nativ elements and versa
this will then allow nativ migration path to nativ components simply change whats in the modlet.js to be a class with a viewModel assigned thats it
and all works no matter how composed if done in can-stache via can-import or else
Justin Meyer
@justinbmeyer
Nov 14 2017 15:26

@ivospinheiro thinking about it some more, we could probably add information about what caused a compute to re-evaluate on its event object

var c = compute(function(){
  return something.get()
})

c.on("change", function(ev){
  ev.changedBy //-> {valueDependencies: [...], keyDependencies: {....} }
})

Can you create an issue in can-compute (or can-observation)? We can probably add this pretty quick.

Here's where a compute gets called back when its dependency changes: https://github.com/canjs/can-observation/blob/master/can-observation.js#L114

We'd just want to store those until the compute's update got called.

Frank Lemanschik
@frank-dspeed
Nov 14 2017 15:27
can't we simply implament npm debug in general ?
with log levels
then we can define what we want to get logged and voila
thats how i do it at present i writed a simple log function that uses debug module and then simply logs stuff that i can filter easy to get whats done
we can simply log everything without overhead
because if the browser don't has localstorage debug enabled it simply does nothing
and if enabled we can filter
i did once a can-define/map fork only for applying that
and it worked really well
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:18
Are partials removed in can-stache 3.9? I see a warning like and my template is rendering a partial like this:
<data-admin vm:view:from="view" vm:parameters:to="params">components/data-admin/template.stache</data-admin>
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 20:22
@roemhildtg is the value of viewthe path to the partial?
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:23
Kindof. It would be viewModel.view.editTemplate where editTemplate is the partial render function
template.stache, is actually the component template
for data-admin
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 20:30
What we usually recommend is explicitly import the stache you're using for the partial, then read it from the refs scope (or scope.vars). We cover this in some detail in https://canjs.com/doc/can-view-import.html#_can_dynamic_importfrom__MODULE_NAME_value_to___MODULE_REF___
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:32
I haven't used can-import do partials get added to the steal bundles build still?
I've gone the route of importing the stache templates in my js viewmodel files, and passing them to the template
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 20:33
However, it seems like your viewmodels are holding the partial references, so that's another valid way of getting them in to the template.
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:35
I don't know which is better, I do want to switch to can-slot, and can-imports eventually I think
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 20:36
To answer your previous question, yes, steal will still bundle files imported with can-import
What was the warning you got along with the weird output?
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:37
WARN: {{>*self}} is deprecated. Use {{>scope.view}} instead.
Brad Momberger
@bmomberger-bitovi
Nov 14 2017 20:38
Strange. That doesn't appear in your codebase anywhere
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:38
There is one template (details.stache) that references the data-admin component
Kevin Phillips
@phillipskevin
Nov 14 2017 20:49
you weren't using {{> *self}} and you saw that warning?
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:50
Correct
Kevin Phillips
@phillipskevin
Nov 14 2017 20:50
that's bizarre
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:51
:smile:
Kevin Phillips
@phillipskevin
Nov 14 2017 20:51
that warning only happens when the key you're looking up is explicitly *self
stache 3.9 you said?
have you tried a newer version?
could be a bug that we've fixed already
Gregg Roemhildt
@roemhildtg
Nov 14 2017 20:53
I haven't yet. I'll give that a go
Gregg Roemhildt
@roemhildtg
Nov 14 2017 21:05
Sweet, 3.13 is working
Kevin Phillips
@phillipskevin
Nov 14 2017 21:09
great
Gregg Roemhildt
@roemhildtg
Nov 14 2017 21:12
btw... +1 for landscaper.
makes stuff like this much easier https://github.com/roemhildtg/can-admin/pull/105/files
Kevin Phillips
@phillipskevin
Nov 14 2017 21:18
Yeah, that's awesome. Glad you like it. It definitely saves me tons of time.
you might be the first non-Bitovi employee I've seen use it
Gregg Roemhildt
@roemhildtg
Nov 14 2017 21:23
it works well to update a canjs project in particular because I have a few different repos that sort of depend on each other and they all should be using the same can packages. It wasn't super easy to find/use right off the bat, but once you get it it sort of walks you through it
Kevin Phillips
@phillipskevin
Nov 14 2017 21:25
yeah, we've worked on a UI for it
but it's not quite ready yet
Gregg Roemhildt
@roemhildtg
Nov 14 2017 21:30
Quick question. If I have a DefineMap with a .filters DefineList property, and I call map.serialize() in a getter, will that getter be called each time filters changes length?
Kevin Phillips
@phillipskevin
Nov 14 2017 22:17
no, it won't
here's a simpler example: http://jsbin.com/nerebiv/edit?js,output
if you uncomment that var length = this.list.length; you'll see the output update when the vm.list.push is called
Gregg Roemhildt
@roemhildtg
Nov 14 2017 22:43
Okay. So just get the length
Then it's bound