These are chat archives for canjs/canjs

2nd
Jun 2016
Julian
@pYr0x
Jun 02 2016 08:43
can we provide a similar functionality of https://github.com/x-tag with your components? what i mean, is that we dont need to create a stache-template within the component tag and append this stache-frag to the dom
Justin Meyer
@justinbmeyer
Jun 02 2016 15:41
@pYr0x yup
canjs/can-component#10
The big issue is Scope
basically, how do you deal with view-model bindings and such
we could make it work for Custom elements that only use attribute-value based bindings
but not
<my-component foo="bar">
<my-component {foo}="bar">
Julian
@pYr0x
Jun 02 2016 16:14
i think that would be ok for the first step
within nested components the view-model-binding would work, right?
<my-component><x-foo ({^value}}="bar"></x-foo></my-component>
Justin Meyer
@justinbmeyer
Jun 02 2016 16:17
depends .. is that showing light or shadow dom?
meaning ... lets say someone did something like the following:
document.body = "<my-component><x-foo ({^value}}="bar"></x-foo></my-component>"
(ignoring my quote mistakes) that wouldn't work
I don't think light dom view bindings would work
only shadow DOM
Component.extend({
  tag: "my-component",
  view: stache('<x-foo ({^value}}="bar"></x-foo>')
})
document.body = "<my-component/>"
Joel Kuzmarski
@leoj3n
Jun 02 2016 20:45
What is the difference between <can-import/> and <can-import></can-import>? I'm seeing difference in behaviour.
Kevin Phillips
@phillipskevin
Jun 02 2016 20:48
if you include the end tag, it uses progressive loading
meaning it won’t automatically be loaded
and the scope inside the tag will be the promise
so you can do things like
<can-import from=“my-app/home/">
  {{#if isPending}}
    Loading...
  {{else}}
    <app-home></app-home>
  {{/if}}
</can-import>
Joel Kuzmarski
@leoj3n
Jun 02 2016 20:53
Thank you for the explanation @phillipskevin. What does export-as="" mean/do? Can't find docs on it?
Matthew Phillips
@matthewp
Jun 02 2016 20:57
export-as is for done-autorender
It defines the ViewModel that will be used to render the template
usually you provide the viewmodel like so:
var VM = require("./viewmodel");
var renderer = require("./main.stache");

var frag = renderer(new VM())
but with done-autorender, the plugin does the above for you
so using `export-as="viewModel" tells done-autorender to use that module as the VM
Joel Kuzmarski
@leoj3n
Jun 02 2016 21:06
You wouldn't ever "export-as" anything other than "viewModel", Correct? As in you'd never write export-as="myModel".
Julian
@pYr0x
Jun 02 2016 21:33
@leoj3n canjs/canjs#2408
for your first question
Joel Kuzmarski
@leoj3n
Jun 02 2016 21:35
@pYr0x looks great thanks! I was actually wondering if can-import was functionally equivelant to import.
Julian
@pYr0x
Jun 02 2016 21:36
it is
you can import the exported value from a module
Thomas Sieverding
@Bajix
Jun 02 2016 23:41
How do I use done-autorender outside of my main index.stache
It doesn’t seem to play nicely as a drop in replacement for can/view/autorender
I’d like my component demo html files to be similar to my main index entry point