
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@ninjaneers/graphiql-webcomponent
Advanced tools
A Webcomponent wrapper around [GraphiQL](https://github.com/graphql/graphiql) and [GraphiQL-Explorer](https://github.com/OneGraph/graphiql-explorer/).
A Webcomponent wrapper around GraphiQL and GraphiQL-Explorer.
Add import @ninjaneers/graphiql-webcomponent; to your app.module.ts to register the Webcomponent in the browser.
Add schemas: [CUSTOM_ELEMENTS_SCHEMA] to the modules where the Webcomponent will be used.
Now you can use the Webcomponent in your Angular templates like this:
<div *ngIf="config$ | async as config">
<graphiql-webcomponent #graphiql
[config]="config"
[query]="''"
[variables]="{}"
></graphiql-webcomponent>
</div>
export class ParentComponent implements AfterViewInit {
public config$ = new BehaviorSubject({
api: {
url: 'http://localhost:8080/graphql',
},
})
@ViewChild('graphiql')
public graphiql: ElementRef;
public ngAfterViewInit(): void {
this.graphiql.nativeElement.addEventListener('QueryChange', (event) => console.dir(event));
this.graphiql.nativeElement.addEventListener('VariablesChange', (event) => console.dir(event));
}
}
Add import @ninjaneers/graphiql-webcomponent; to your index.(js/ts) to register the webcomponent in the browser.
Now you can use the Webcomponent in your (j/t)sx like this:
const Parent = () => {
const ref = useRef(null);
useEffect(() => {
ref.current.addEventListener('QueryChange', (event) => console.dir(event));
ref.current.addEventListener('VariablesChange', (event) => console.dir(event));
}, [ref]);
return <graphiql-webcomponent ref={ref}
config={config}
query={""}
variables={{}}
></graphiql-webcomponent>
}
type GraphiqlWebcomponentConfig = {
api: {
url: string;
headers?: Record<string, string>;
subscriptionUrl?: string;
wsConnectionParams?: Record<string, string | Record<string, string>>;
};
defaultQuery?: string;
disableExplorer?: boolean;
editorTheme?: string;
excludeMutations?: boolean;
excludeSubscriptions?: boolean;
};
http://localhost:3000/v1/graphql.{"Authorization": "Bearer ..."}.ws://localhost:3000/v1/graphql.{headers: {Authorization": "Bearer ...}}.false."dracula".false.false.FAQs
A Webcomponent wrapper around [GraphiQL](https://github.com/graphql/graphiql) and [GraphiQL-Explorer](https://github.com/OneGraph/graphiql-explorer/).
We found that @ninjaneers/graphiql-webcomponent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.