8000 GitHub - arkits/gql-wc
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

arkits/gql-wc

Repository files navigation

Built With Stencil

GraphQL Schema Builder Web Component

A web component built with Stenc 8000 il.js that provides an interactive visual interface for building and modifying GraphQL schemas. This component allows users to create, edit, and visualize GraphQL types and their relationships through a drag-and-drop interface.

Features

  • 🎨 Visual schema builder with drag-and-drop interface
  • 📝 Interactive type and field editing
  • 🔄 Real-time schema generation
  • 🎯 Input validation for GraphQL naming conventions
  • 📚 Support for type and field descriptions
  • 🔌 Easy integration with any web framework

Installation

npm install gql-wc

Usage

Basic Usage

<graphql-schema-builder></graphql-schema-builder>

With Initial Schema

<graphql-schema-builder schema="type User { id: ID! name: String! }"></graphql-schema-builder>

Properties

Property Type Description
schema string Initial GraphQL schema to load
externalEntities object External entities and attributes that can be used in the schema

Events

Event Description
schemaChange Emitted when the schema is modified, contains the updated types and GraphQL schema

Event Details

The schemaChange event emits an object with the following structure:

{
  types: GraphQLType[];  // Internal representation of the types
  graphqlSchema: string; // Generated GraphQL schema string
}

Development

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Start the development server:
    npm start

Building

To build the component for production:

npm run build

Examples

Basic Schema Creation

<graphql-schema-builder></graphql-schema-builder>

<script>
  const builder = document.querySelector('graphql-schema-builder');
  
  builder.addEventListener('schemaChange', (event) => {
    console.log('Generated Schema:', event.detail.graphqlSchema);
  });
</script>

Loading External Schema

<graphql-schema-builder id="schema-builder"></graphql-schema-builder>

<script>
  const schema = `
    type User {
      id: ID!
      name: String!
      email: String
      posts: [Post!]
    }

    type Post {
      id: ID!
      title: String!
      content: String
      author: User!
    }
  `;

  const builder = document.getElementById('schema-builder');
  builder.schema = schema;
</script>

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0