Kapeli / Dash-User-Contributions

Dash repo of user contributed docsets
2k stars 850 forks source link

Request: vuex #2005

Open katerlouis opened 6 years ago

katerlouis commented 6 years ago

Vuex is a state manager tailored for Vue JS the structure is very similar to the main Vue docset. https://vuex.vuejs.org/guide/state.html

So I guess you can implement this quickly :)

Would be really cool!

gisu commented 6 years ago

👍

mrinterweb commented 5 years ago

Are there plans to add vuex docs? I'm pretty sure it would be fine to include vuex in the vue docs since they are pretty coupled.

andreiborisov commented 5 years ago

Vue basically consists from a number of core components:

  1. Vue.js (which what we have now)
  2. Vue Router
  3. Vuex
  4. Vue Server Renderer

They are all integral part of Vue and have similarly (if not identical) structured documentation. Including only Vue.js in the main docset is not representative of how most people actually are using Vue. It's not complete. So I think the real proposal here is to bundle all Vue core docsets in one and rename it to Vue. Or alternatively add all core components as a separate docsets.

Whatever the solution though, I would actually argue that all of them should be in the main docsets, since Vue is extremely (if not the most) popular JavaScript framework right now.

Nuxt.js on the other hand is the perfect candidate for user contributed docset as it's not the core component of Vue.

andreiborisov commented 5 years ago

@Kapeli what’s your perspective on this? Should all core Vue libraries integrated in one docset or managed separately? Are you willing to add core libraries to main docsets or should community tackle them? If latter the case, it would be much appreciated to give a little bit of guidance how and with what tools Vue.js docset is generated right now (since they are very similar structured).

Kapeli commented 5 years ago

I haven't seen much demand for this yet (around 10 requests only).

Are you sure you're not overstating how many Vue developers are using Vue Router, Vuex and Vue Server Renderer? I'm mainly worried that if I add these docs to the current Vue docset, I'll get yelled at that I'm cluttering it with stuff people don't want/need.

I'll add them within a few days, but please note that if others complain about it, I'll remove them.

katerlouis commented 5 years ago

5 months ago I had to jump into the cold water and make a „real Vue project“ for the first time. I struggled a lot with all these new things like node, npm, es6, webpack, vue-cli, vue itself etc.

I can tell you these things are a very essential part of vue. Especially vuex is something you shouldn‘t remove, even if somebody complains. I personally haven‘t used the server renderer yet, but can assure that both vuex and vue-router are vey important to understand.

I even argue that the people who might complain are new to vue aswell and will wish to have the other docs back a few days later.

What do you guys think about vue-cli? While I wouldn‘t put it in the same docset it is worth considering as a separate docset.

andreiborisov commented 5 years ago

Are you sure you’re not overstating how many Vue developers are using Vue Router, Vuex and Vue Server Rendered?

I don’t have numbers, unfortunately, maybe someone from the @vuejs project can provide some insight and guide us.

I’m mainly worried that if I add these docs to the current Vue docset, I’ll get yelled at that I’m cluttering it with stuff people don’t want/need.

I don’t see any harm of including them in the bundled Vue docset, as they are not big. But if you worry, just add them separately, user can use search profiles to search them simultaneously, if he wishes. The important bit is to add them.

That said I’m not sure about bundling based on the different reason: they are updated separately and have different version numbers. How new version of the bundled docset would be even labeled?

andreiborisov commented 5 years ago

As a compromise you can add them bundled, but separately from Vue.js docset and call it “Vue Core Libraries”. That should satisfy everyone. That’s how they are called in Vue.js docs.

What do you guys think about vue-cli?

Using the same logic we can add another docset named “Vue Tooling” and add Devtools, Vue CLI and Vue Loader there.

Kapeli commented 5 years ago

I understand these docs are important to you, but I have to prioritise things. I have docs with 70+ requests that I haven't gotten around to generating docsets for. The Vue stuff seems to be 3 separate docsets and I haven't had more than 10-15 requests for. The other problem is that the Vue docs don't have clearly marked API types, so stuff is pretty much hardcoded. I've copy pasted the code that does the indexing for the Vue.js docset right now to give you an idea.

It would probably take me 2 hours to bundle these docs into the main Vue.js docset, which is not an issue. What I'm worried is keeping them updated and fixing them when they break.

I'll give it a try in a few days and depending on how it goes I'll release something or not.

DOMDocument *document = webView.mainFrameDocument;
if([webView.mainFrameURL contains:@"vuejs.org/v2/guide/"])
{
    DOMHTMLElement *h1 = [[document getFirstElementWithClassName:@"content"] getFirstElementWithTagName:@"h1"];
    NSString *title = [[h1 innerText] trimWhitespace];
    if([title contains:@"404"] || !h1)
    {
        return;
    }
    [self insertName:title type:@"Guide" path:[self relativeWebViewPath]];
    if([[document getFirstElementWithClassName:@"content"] getElementsByTagName:@"h3"].length || [[document getFirstElementWithClassName:@"content"] getElementsByTagName:@"h2"].length)
    {
        [self insertTOC3Name:@"Sections" hashName:@"Sections" type:@"Guide" hashType:@"Section" isSection:YES path:[self relativeWithAnchor:@"main"] onlyInTOC:YES];
    }
    __block BOOL didAddH2s = NO;
    [[[document getFirstElementWithClassName:@"content"] getElementsByTagName:@"h2"] enumerateWithBlock:^(id h2, BOOL *stop) {
        didAddH2s = YES;
        [self insertTOC3Name:[[h2 innerText].trimWhitespace stringByAppendingFormat:@" - %@", title] hashName:[h2 innerText].trimWhitespace type:@"Section" hashType:@"Section" isSection:NO path:[self relativeWithAnchor:[h2 idName]] onlyInTOC:NO];
    }];
    if(!didAddH2s)
    {
        __block BOOL didAddH3s = NO;
        [[[document getFirstElementWithClassName:@"content"] getElementsByTagName:@"h3"] enumerateWithBlock:^(id h3, BOOL *stop) {
            didAddH3s = YES;
            [self insertTOC3Name:[[h3 innerText].trimWhitespace stringByAppendingFormat:@" - %@", title] hashName:[h3 innerText].trimWhitespace type:@"Section" hashType:@"Section" isSection:NO path:[self relativeWithAnchor:[h3 idName]] onlyInTOC:NO];
        }];
    }
}
if([webView.mainFrameURL contains:@"vuejs.org/v2/api/index.html"])
{
    DOMHTMLElement *menu = [document getFirstElementWithClassName:@"menu-root"];
    __block NSString *lastParentName = nil;
    [[menu childNodes] enumerateWithBlock:^(id menuChild, BOOL *stop) {

        if([menuChild isKindOfClass:[DOMHTMLLIElement class]] && [[menuChild nextElementSibling] isKindOfClass:[DOMHTMLUListElement class]])
        {
            DOMHTMLAnchorElement *anchor = [menuChild getFirstElementWithTagName:@"a"];
            lastParentName = [[anchor innerText] trimWhitespace];
            [self insertTOC3Name:lastParentName hashName:lastParentName type:@"Guide" hashType:@"Section" isSection:YES path:[self relativeForAbsoluteLinkURL:[anchor absoluteLinkURL]] onlyInTOC:NO];
        }
        else if([menuChild isKindOfClass:[DOMHTMLUListElement class]])
        {
            [[(DOMHTMLElement*)menuChild childNodes] enumerateWithBlock:^(id menuChildChild, BOOL *stop) {
                DOMHTMLAnchorElement *anchor = [menuChildChild getFirstElementWithTagName:@"a"];
                NSString *name = [[anchor innerText] trimWhitespace];
                NSString *type = nil;
                if([lastParentName isCaseInsensitiveEqual:@"Global Config"])
                {
                    type = @"Property";
                    if(![name hasCaseInsensitivePrefix:@"Vue.config"])
                    {
                        name = [@"Vue.config." stringByAppendingString:name];
                    }
                }
                else if([lastParentName containsAny:@[@"Global API", @"Instance Methods", @"Array Extension Methods"]])
                {
                    type = @"Method";
                }
                else if([lastParentName containsAny:@[@"Options"]])
                {
                    type = @"Option";
                }
                else if([lastParentName containsAny:@[@"Instance Properties"]])
                {
                    type = @"Property";
                }
                else if([lastParentName containsAny:@[@"Directives"]])
                {
                    type = @"Directive";
                }
                else if([lastParentName containsAny:@[@"Special Elements"]])
                {
                    type = @"Element";
                }
                else if([lastParentName containsAny:@[@"Filters"]])
                {
                    type = @"Filter";
                }
                else if([lastParentName containsAny:@[@"Special Attributes"]])
                {
                    type = @"Attribute";
                }
                else if([lastParentName containsAny:@[@"Built-In Components"]])
                {
                    type = @"Component";
                }
                else
                {
                    NSLog(@"Unknown type for %@ at %@", lastParentName, webView.mainFrameURL);
                    return;
                }
                [self insertTOC3Name:name hashName:name type:type hashType:type isSection:NO path:[self relativeForAbsoluteLinkURL:[anchor absoluteLinkURL]] onlyInTOC:NO];
            }];
        }
    }];
}
katerlouis commented 5 years ago

What's the status on this one? Adding vue-router in the process would be nice, aswell.

inspirity commented 5 years ago

I'missing the vuex documentation too. Im using vue and vuex a lot and mostly I'm fine without documentation. But each time i need some information about vuex i realize how much I rely on Dash for a quick answer to my question. Is there any way to support the implementation of vuex?

asolopovas commented 3 years ago

+1

d-damien commented 3 years ago

Found this : https://github.com/jonboiser/vue-libs-dash-docs

Seems to work in Zeal 0.6.1 after I git cloned it in the docsets folder. Thanks @jonboiser.