| 03:32 | symbioquine[m] | <mstenta[m] "But for contrib modules: yea bes"> I think I've figured out a decent pattern for this: github.com/symbioquine/farmOS_vue_page_d |
| 13:19 | * | cpm has joined |
| 15:33 | symbioquine[m] | Building on that to start sketching out a land drawing tool for 2.x; github.com/symbioquine/farmOS_land_drawi |
| 15:34 | * | uploaded an image: (124KiB) < matrix.org/_matrix/media/r0/download/mat > |
| 15:34 | paul121[m] | okay COOL! curious how/if (??) Vue can play with the map :-) |
| 15:35 | symbioquine[m] | The OpenLayers vector source is just an object so there's nothing stopping it from being reactive in Vue.js |
| 15:36 | symbioquine[m] | github.com/symbioquine/farmOS_land_drawi |
| 15:36 | symbioquine[m] | github.com/symbioquine/farmOS_land_drawi |
| 15:36 | symbioquine[m] | github.com/symbioquine/farmOS_land_drawi |
| 15:40 | paul121[m] | ah cool.. was curious how it was interacting with the map instance... but it looks like you create it within the vue app, makes sense: github.com/symbioquine/farmOS_land_drawi |
| 15:40 | symbioquine[m] | Yeah, that way the component can own the lifecycle of the map |
| 15:41 | symbioquine[m] | More critical in apps with routing where the map might need to get created/destroyed multiple times within a single "page instance" |
| 15:41 | symbioquine[m] | But still a good pattern |
| 15:41 | paul121[m] | bonus points if you can make it work with the map that Drupal creates :-) |
| 15:43 | symbioquine[m] | I considered that, but it would have been pretty hard to untangle that Drupal event subscriber stuff and get only the bits of behavior I need for this tool. |
| 15:43 | paul121[m] | (main thinking is so that other custom layers/behaviors could be included in this as well - certainly not critical) |
| 15:43 | symbioquine[m] | farmOS-map has a cleaner interface |
| 15:43 | paul121[m] | yeah |
| 15:44 | symbioquine[m] | <paul121[m] "(main thinking is so that other "> Yeah that makes sense, it's just hard to make stuff both globally automatic and modular/configurable... :) |
| 15:45 | paul121[m] | yea.. Drupal wasn't made for JS modularity! |
| 15:46 | paul121[m] | one idea tho, if you make a `map-type` config entity & render a map on a page via a Drupal controller, it should get a unique ID on the page. Could the Vue app "attach" to that? |
| 15:47 | symbioquine[m] | <paul121[m] "one idea tho, if you make a `map"> That would probably work, but at least there'd be some complicated state associated with hot reloading for development. |
| 15:48 | symbioquine[m] | With Vue managing the instance it's pretty much a live editing experience without even needing page reloads. |
| 15:49 | symbioquine[m] | github.com/symbioquine/farmOS_vue_page_d |
| 15:50 | paul121[m] | ooohhh yeah that would complicate hot reloading |
| 15:52 | * | uploaded an image: (397KiB) < matrix.org/_matrix/media/r0/download/mat > |
| 15:55 | symbioquine[m] | That said, it would be nice if there were a way for certain farmOS-map behaviors from relevant farmOS contrib modules to get automatically registered with tools like this. |
| 15:56 | symbioquine[m] | It's almost like we need some sort of tagging/scoping system so that the behaviors can control when they apply and map instances or pages can supply more metadata about themselves for that determination. |
| 15:58 | symbioquine[m] | That seems to be roughly the goal of that Drupal MapEvent system, but as-is you can't use it without pulling in a bunch of stuff that is (appears anyway) hard-coded for the scenario where Drupal is rendering the map component. |
| 16:01 | paul121[m] | > It's almost like we need some sort of tagging/scoping system so that the behaviors can control when they apply and map instances or pages can supply more metadata about themselves for that determination. |
| 16:01 | paul121[m] | yesss... had a few ideas on that here - it's necessary for supporting "multiple maps", but "multiple maps" can also mean maps being created/destroyed over the lifetime of a single page which is probably more common: github.com/farmOS/farmOS-map/issues/94#m |
| 16:03 | paul121[m] | the "global behavior" registry might actually work well for this Vue app use case tho.. I *think* it would still add those behaviors to the map instance it's handling itself? |
| 16:03 | paul121[m] | but the issue with the global behaviors is they're always there, and always added |
| 16:04 | symbioquine[m] | See github.com/farmOS/farmOS-map/issues/110# |
| 16:04 | paul121[m] | if you enable `farm_mapbox` does it get added to this Vue app? |
| 16:05 | symbioquine[m] | no |
| 16:05 | symbioquine[m] | At least I'm pretty sure it wouldn't |
| 16:05 | symbioquine[m] | I can check |
| 16:05 | paul121[m] | ah right... because the map render event is when it's added to the page |
| 16:08 | paul121[m] | cool yea `namedBehaviors` is inline with what I was thinking :D |
| 16:09 | paul121[m] | a pattern I'm seeing though is that with the `attachBehavior(behavior, options = {})`, the `options` are different from what I've been referring to as "settings" |
| 16:10 | paul121[m] | `options` could certainly be used for "settings", but that hasn't been our practice haha |
| 16:10 | paul121[m] | I hadn't realized that before |
| 16:12 | paul121[m] | so the "farmOS-map API is complete", yes, but our Drupal implementation could be improved |
| 16:45 | symbioquine[m] | <paul121[m] "`options` could certainly be use"> The nice thing about this is that most of the settings don't need to change over the life of a map instance so a "constructor-based" model is much simpler. |
| 16:46 | symbioquine[m] | That said some mutable/observable state could be really nice too... |
| 16:47 | symbioquine[m] | Might make sense for them to be largely separate mechanisms though. |
| 16:47 | paul121[m] | true and true |
| 16:48 | paul121[m] | right... and theres nothing stopping a behavior from using `instance.map.set('myvalue', ..)` right now... |
| 16:48 | symbioquine[m] | Gotta go play outside now, but super excited to be talking through this stuff! |
| 16:48 | paul121[m] | guess its just a matter of how & if we should standardize something. hmm |
| 16:48 | symbioquine[m] | yeah |
| 16:57 | mstenta[m] | Haven't had a chance to respond but I've been enjoying reading all this! Great stuff!! |