These are chat archives for canjs/canjs

23rd
Jan 2018
Gregg Roemhildt
@roemhildtg
Jan 23 2018 18:00
Hi guys, Shouldn't can-slot use the scope of its parent component? From what I can tell, if I pass <can-template> to a slot, it uses the context of the template, which throws off the component
Frank Lemanschik
@frank-dspeed
Jan 23 2018 18:02
good question
i don't know the canjs answer for that
in WebComponents world thats clear but in 4.0 that registers webcomponents
so you could use nativ webcomponent slot implamentation some how
i need more research on the next implamentation of can-component
but as writen here you need to pass down the values via stache bindings
it has its own scope
but it will 100% inhire the component scope also so ../parentScopeProp
should work inside can-slot without bindings
Gregg Roemhildt
@roemhildtg
Jan 23 2018 18:11
I don't know...I can't seem to get that syntax right: https://jsbin.com/bezugozira/edit?html,js,console,output
To have myObject render in the passed can-template/can-slot
Frank Lemanschik
@frank-dspeed
Jan 23 2018 18:11
the problem is i don't understand the jsbin well
i got lazy with analytics of such code :)
when i see to much code that don't fits into my brain i drop it
like a buffer overflow
Gregg Roemhildt
@roemhildtg
Jan 23 2018 18:12
lol
:)
Frank Lemanschik
@frank-dspeed
Jan 23 2018 18:13
in gernal a slot is a part of a component
that can get styled inside the component tag
Gregg Roemhildt
@roemhildtg
Jan 23 2018 18:13
Yep, then I would imagine it should inherit that component's scope. Unless I'm completely misunderstanding how slots work
Frank Lemanschik
@frank-dspeed
Jan 23 2018 18:14
yes they will do
but the slot also has a scope
thats why i say probally ../parentPropertyName
will work
../ for looking up the component scope
else you can bind what you need also on the slot like
parentPropertyName:bind="./parentPropertyName"
then you can directly use {{parentPropertyName}}
i would say if you don't reuse slot items like in lists
simply take {{../PropertyName}}
Gregg Roemhildt
@roemhildtg
Jan 23 2018 18:34
Hmm, yeah I don't think that is working either.
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:05
then its clear a bug
you should open a issue
i don't plan using slots i don't see any need for that as i factor not reused components
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:05
Yup, I was just about to file one
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:06
do post the isssue here after that
so i can upvote it and mark it so i get updates
i am interrested in the current state of that then
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:06
Slots are cool
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:06
i see no usecase at present i only see it as usefull if i would code components
that i want to style outside of them self
but as i factor components as needed i have not a single usecase
all that a slot can do i would solve via a sub component
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:08

Consider this, you implement a form component with validation, saving, and other functionality. Form templates need to be customized for almost any purpose...single column, multi column, etc....but you need to keep/reuse that logic. Slots let you override different parts of your template.

And yes, I can just created a new template/component that uses the viewModel. But this is easier. <form-widget><can-template name="form">...</can-template></form-widget>

Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:08
for example i would factor a list component and a item component
the item would be the slot
ahh the form part is a hell at present
i solve it manual at present
i simply on click bind a method in the viewModel it does validation
and then does the ajax post
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:10
yes i saw your working on a bigger component stack
i would love to join that once i got my basic applications working again
feathers + socket io 2
killed it all
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:11
I want to release a 1.0. I am just waiting for time to get some documentation system working
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:11
Ah !!! there i am a specialist!
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:11
Yeah, socket.io is a no go for now
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:11
my PRO Ultra PRO TIP!
do documentation by HAND!
simply in a MD file
its faster then getting any other stuff working
i am coding now for over 28 years
my summary is do it all by Hand
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:12
Yeah. I see the advantages there. Documentation generators using jsdoc comments are really attractive at first...but they don't work sometimes and rarely give any clue as to why, and you spend a lot of time troubleshooting that
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:12
there is no one fit all solution for automatic code documentation
it gets all wirred mixed into the source
and then your bound to formart and parsing and all that
yes hand written documentation
thats what rocks
the only thing that makes sense even
in most cases
the most part of the canjs docs are also not really generated from the code
and i saw really NO Professional bigger company using such software to generate docs
maybe in future for mjs we get better partial doc generation
mjs is the new extension for ES6/7 by the way :D
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:15
canjs/can-component#198 FYI
Whats mjs?
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:15
so in future js gets droped in favor of mjs
modular JS
the import export module style
it got a own extension
finaly!
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:16
OH
Frank Lemanschik
@frank-dspeed
Jan 23 2018 19:16
normal JS stays JS
and all with es6/7+ gets mjs
so soon all .js files will get mjs
because the CJS standart can be called finally legacy
and the new extension was the less painfullest way to do the migration for future software
because that stops the step that you need to examin every js file on load if it uses require or import export and so on
Gregg Roemhildt
@roemhildtg
Jan 23 2018 19:19
Makes sense