These are chat archives for canjs/canjs

6th
Nov 2017
Sander Roeffaers
@Kleppo
Nov 06 2017 10:29
Hi, I was checking the release 3.12 and I noticed the example of ‘selected-to-index’ is broken…
Could you guys check ik? Thx! :smile:
https://canjs.com/doc/can-stache-converters.selected-to-index.html
Kevin Phillips
@phillipskevin
Nov 06 2017 13:59
thanks for reporting @Kleppo
we'll take a look
@frank-dspeed can-import comes from the can-view-import module
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:00
@phillipskevin i have it already
i learnd from your can-element in the constructor
that was the missing part i was only rendering but don't setting a scope on the element
that some how made it not work i loaded can-view-import befor
but can-import ended up with wrong context then
@phillipskevin can you clearify then i don't need to test so much
when i would set define-map in the constructor this.viewModel
and then set scope to self.viewModel
i should get same results as a can-component does right?
i can set any scope on any element?
as long as mustache can use it?
I am not understanding full why you did this get own viewModel in the constructor
Kevin Phillips
@phillipskevin
Nov 06 2017 14:04
why I did what?
I'm not sure I'm following
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:04
and why you did the scope assign in the constructor and not in the connected callback
Kevin Phillips
@phillipskevin
Nov 06 2017 14:05
if you're talking about can-element that was @matthewp, not me
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:05
can you please fast read up you can-element.js if you don't got it in mind
ah i tought your doing it because you was fighting for it on the contributors meeting
:D
Kevin Phillips
@phillipskevin
Nov 06 2017 14:05
ah, ok
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:06
but do you fully understand how that works?
can you fast read can-element
the js file i think there are only 8 lines of code that are relevant :)
but this 8 lines are only understand able if you have a bigger view of all parts
i think domData is some kind of registry and its no where well documented i don't found it
i think that is the relevant part for all kind of context fails that can happen when moving dom elements
Kevin Phillips
@phillipskevin
Nov 06 2017 14:09
domData just associates some data with a dom element
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:09
what data exactly?
the viewModel?
Kevin Phillips
@phillipskevin
Nov 06 2017 14:09
any data you want
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:10
i mean by design out of eco system view what is the exact flow
i understand rendering stache with (viewModel=
but the part after that with domData and Scope
is a mistery
for example i would love to understand when i do can-import where does it land
:)
ah and can-view-callback is global?
its like the element registry?
Kevin Phillips
@phillipskevin
Nov 06 2017 14:12
yes
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:13
perfect ! that makes sense!
so i only need to read can-view-callback and export what it got as element
:D
then i could work around can-view-callbacks
and use only nativ methods
perfect perfect
Kevin Phillips
@phillipskevin
Nov 06 2017 14:14
you want to register all can-components as custom elements?
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:14
right
!
Kevin Phillips
@phillipskevin
Nov 06 2017 14:14
ok
interesting
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:14
i want to re use them without the need of stache parsing
a tag befor inserting
Kevin Phillips
@phillipskevin
Nov 06 2017 14:14
can-view-callbacks doesn't expose the tags
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:15
at present the compat is made via simply make a element that parses it self as stache
i am not sure but the combination of domData + can-view-callbacks
will probally be the missing part
all else is working
i don't think there are much more stuff between the rendered view and the live bindings
i will deep look into the view-callbacks and view-parser
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:22
I got it !!!!
domData.set.call(element, "viewModel", myVm);
domData Exposes the Element :)
but as reference so it need to exist some where in the dom
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:35
OK now i have it more then complet :)
the trick is to parse the stache that builds a component
preserve the nesting of elements and apply
with the right assosiated view Models as can-view-callbacks don#t does that
its a flat registriy structure
so you need to look if viewModel === can-view-scope and mimic that behavier
so can-view-scope is the missing link between viewModels
Frank Lemanschik
@frank-dspeed
Nov 06 2017 14:40
can-stache probally posts to can-view-callback that looks in domData and then looksup the can-view-scope which is not the viewModel its a viewModel Refrence to one or more viewModel instances
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 06 2017 15:52
@Macrofig how to use this https://validatejs.org/#validators-datetime with can-validate-validatejs?
Juan Orozco
@Macrofig
Nov 06 2017 15:53
If I remember correctly, can-validate-validatejs provides the Validate.JS constructor so you can register stuff like that. One sec...
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 06 2017 15:54
ok
So, you can do...
import makeValidator from 'can-validate-validatejs';
makeValidator.validatejs.extend(...);
Then, in your definemap, you can use the key you register.
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 06 2017 15:55
Ah I see thank you so much :)
Juan Orozco
@Macrofig
Nov 06 2017 15:56
Oh, sorry, in your define map, it will automatically have access once you run makeValidator.
Mohamed Cherif Bouchelaghem
@cherifGsoul
Nov 06 2017 15:56
:+1:
Juan Orozco
@Macrofig
Nov 06 2017 15:56
:)
Eben
@eben-roux
Nov 06 2017 16:22
hello all... any bootstrap v4 examples anywhere that I can look at?
Frank Lemanschik
@frank-dspeed
Nov 06 2017 16:22
@eben-roux you should wait with that
i can give you a working steal config for that but that will change its beta
Eben
@eben-roux
Nov 06 2017 16:24
I'd like to get going on the bootstrap beta in the meantime since it should be stable enough for what I'm doing
Frank Lemanschik
@frank-dspeed
Nov 06 2017 16:24
it is not
where do you know the stable status from?
i am just working on integrating popper into it
so why do you know more about its stable status then ;)
it was now a extern dependency
    "meta": {
      "bootstrap/js/dropdown": {
        "deps": [
          "jquery",
          "tether",
          "popper.js"
        ]
      },
      "bootstrap": {
        "deps": [
          "jquery",
          "tether",
          "popper.js"
        ]
      },
      "bootstrap/dist/js/bootstrap": {
        "deps": [
          "jquery",
          "tether",
          "popper.js"
        ]
      },
      "tether/dist/js/tether": {
        "format": "global",
        "deps": [
          "jquery"
        ]
      },
      "popper.js/dist/umd/popper": {
        "format": "global",
        "deps": [
          "jquery"
        ]
      }
}
  "map": {
      "popper.js": "popper.js/dist/umd/popper",
      "tether": "tether/dist/js/tether",
      "justifiedGallery": "justifiedGallery/src/js/justifiedGallery"
    }
ignore justifiedGallery
Eben
@eben-roux
Nov 06 2017 16:27
thanks
Frank Lemanschik
@frank-dspeed
Nov 06 2017 16:29
@eben-roux little extra info in your app.js
or your main file you should then only do import bootstrap from 'bootstrap';
no the other stuff
steal loads the rest in right order
Eben
@eben-roux
Nov 06 2017 16:30
ok, cool... thanks
Nico R.
@nriesco
Nov 06 2017 16:32
@frank-dspeed that “map” property, were exactly should it be within the package.json file? at the same level as meta?
I mean is it “steal.map” ?
I know meta is in steal so it is “steal.meta"
Frank Lemanschik
@frank-dspeed
Nov 06 2017 16:34
same for map
its the steal config
put it where ever you config it
in standart situation in package json
Nico R.
@nriesco
Nov 06 2017 16:38
Ok thanks
Eben
@eben-roux
Nov 06 2017 18:21
@frank-dspeed I'm getting this: steal.js:3090 GET http://localhost:8080/tether/dist/js/tether.js 404 (Not Found)
I'm guessing I messaed up the config somewhere... any ideas?
and when you say that I only need to import bootstrap in my app.js do you mean this: import 'bootstrap/dist/js/bootstrap'
Frank Lemanschik
@frank-dspeed
Nov 06 2017 19:47
the problem is
probally that it don't knows where tether is
try to yarn add tether and popper befor that
i only gave you the mapping you need to install the scripts befor