Giter Club home page Giter Club logo

Comments (12)

web-padawan avatar web-padawan commented on May 30, 2024 1

Hi, will look into this over the weekend. @rallets did you upgrade from web-component-analyzer to CEM analyzer?

from api-viewer-element.

rallets avatar rallets commented on May 30, 2024 1

@web-padawan switching to manifest and passing in it the whole json, make it working now, thank you!

from api-viewer-element.

web-padawan avatar web-padawan commented on May 30, 2024 1

Tested locally with the JSON attached, and the problem seems to be related to following lines:

https://github.com/web-padawan/api-viewer-element/blob/639c2662d1429b189b63eaae032788426118782e/src/lib/manifest.ts#L50-L54

  1. As there is "customElement": true - the second check (isCustomElement) also returns true,
  2. However, there is no export for this custom element, hence api-viewer fails to recognize it.

So, this is indeed a bug. I will try to find some time tomorrow to come up with a proper workaround.

from api-viewer-element.

rallets avatar rallets commented on May 30, 2024

Hi @web-padawan I have the same problem after upgrading from v. 0.5.0 to the latest. Any tips?

from api-viewer-element.

rallets avatar rallets commented on May 30, 2024

@web-padawan no, I haven't noticed it was changed the analyzer!
So now I have

"@custom-elements-manifest/analyzer": "^0.5.7",
"web-component-analyzer": "^1.1.6"

and I ran:

"analyze": "cem analyze"

using the config file

export default {
  globs: ['src/components/**/*.{js,ts}'],
  outdir: './',
  litelement: true,
  plugins: [],
}

that produce something like:

{
  "schemaVersion": "1.0.0",
  "readme": "",
  "modules": [
    {
      "kind": "javascript-module",
      "path": "src/components/section-bar/section-bar-style.ts",
      "declarations": [
        {
          "kind": "variable",
          "name": "SectionBarStyle",
          "type": {
            "text": "array"
          },
          "default": "[theme, css`\r\n  #container {\r\n    display: flex;\r\n  }\r\n`]"
        }
      ],
      "exports": [
        {
          "kind": "js",
          "name": "SectionBarStyle",
          "declaration": {
            "name": "SectionBarStyle",
            "module": "src/components/section-bar/section-bar-style.ts"
          }
        }
      ]
    }
  ]
}

but still renders No custom elements found in the JSON file.

I'm passing the full object to elements (I'm using Angular 13.1)

import elements from 'a-npm-local-package/custom-elements.json';

<api-viewer [elements]="elements"></api-viewer>

btw do you know if cem can also output as md? I have a:

"docs-md": "wca analyze \"src/**/*.{js,ts}\" --outFile custom-elements.md --format markdown"

that it looks like cem doesn't support anymore, and I haven't found a plugin for this.

from api-viewer-element.

rallets avatar rallets commented on May 30, 2024

I tried to use the json file you are using in the demo https://api-viewer-element.netlify.app/assets/custom-elements.json and I get the same result.
Does api-viewer still expose the attribute elements ? I'm using that because I need to fetch a json from node_modules, and in that way I can avoid to specify a src with a node_modules path (that doesn't work neither)

Let me know if you need more info.
Thank you for the great component!

from api-viewer-element.

web-padawan avatar web-padawan commented on May 30, 2024

Sorry, I missed to document upgrading from 0.5.0. The property is now called manifest. I will add separate page to the docs about that.

from api-viewer-element.

baermathias avatar baermathias commented on May 30, 2024

I tried it this way:

<api-viewer 
  src="../custom-elements.json"
></api-viewer>

And also this way:

import manifest from '../custom-elements.json'
return html`
  <api-viewer 
    .manifest="${manifest}"
  ></api-viewer>
`  

Unfortunately without luck.

from api-viewer-element.

web-padawan avatar web-padawan commented on May 30, 2024

@baermathias Thanks for reminding, I will check your example in the evening.

from api-viewer-element.

baermathias avatar baermathias commented on May 30, 2024

@web-padawan just wanted to hear if there was any progress with this issue?

from api-viewer-element.

web-padawan avatar web-padawan commented on May 30, 2024

Sorry about the delay, I forgot to check this issue before the holidays and then it got lost in my backlog of things.
Now when I'm done with converting to monorepo etc, I'm going to work on this for the next 1.0.0-pre release.

from api-viewer-element.

web-padawan avatar web-padawan commented on May 30, 2024

Hi @baermathias, currently looking into this but so far I couldn't reproduce the issue using fixtures in the repo.

  1. Removed export statement for the ProgressBar base class
  2. Replaced @customElement with customElements.define()

As you can see in 084207a, the export with "kind": "custom-element-definition" is still there.
Could you please provide a source code of your component to produce JSON you shared?

from api-viewer-element.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.