SulemanRasheed132446 / vetrify-web-components

Web components for vetrify using stenciljs and storybook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.js CI Built With Stencil

Vetrify Web Components

Vetrify's standalone Web Components.


Operation


To Run

For development using storybook, run:

npm install
npm run build
npm start

vetrify's storybook will be available here: http://localhost:3000

If you want VSCode integration, add the following `.vscode/launch.json` file
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      // Requires the extension Debugger for Chrome: https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome
      "type": "chrome",
      "request": "launch",
      "name": "Storybook Debug",
      "breakOnLoad": true,
      "url": "http://localhost:6006/",
      "sourceMaps": true,
      "webRoot": "${workspaceFolder}",
      "sourceMapPathOverrides": {
        "webpack:///*": "${webRoot}/*",
        "webpack:///./*": "${webRoot}/*",
        "webpack:///src/*": "${webRoot}/*",
        "webpack:///./~/*": "${webRoot}/node_modules/*"
      }
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Debug Stencil tests",
      "cwd": "${workspaceFolder}",
      "program": "${workspaceFolder}/node_modules/.bin/stencil",
      "args": ["test", "--spec", "--e2e", "--devtools"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "disableOptimisticBPs": true,
      "windows": {
        "program": "${workspaceFolder}/node_modules/@stencil/core/bin/stencil"
      }
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Spec Test Current File",
      "cwd": "${workspaceFolder}",
      "program": "${workspaceFolder}/node_modules/.bin/stencil",
      "args": ["test", "--spec", "${fileBasename}"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "disableOptimisticBPs": true,
      "windows": {
        "program": "${workspaceFolder}/node_modules/@stencil/core/bin/stencil"
      }
    },
    {
      "type": "node",
      "request": "launch",
      "name": "E2E Test Current File",
      "cwd": "${workspaceFolder}",
      "program": "${workspaceFolder}/node_modules/.bin/stencil",
      "args": ["test", "--e2e", "${fileBasename}", "--devtools"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "disableOptimisticBPs": true,
      "skipFiles": [
          "${workspaceFolder}/node_modules/**/*.js",
          "<node_internals>/**/*.js"
      ],
      "windows": {
        "program": "${workspaceFolder}/node_modules/@stencil/core/bin/stencil"
      }
    }
  ]
}


To Build

To build the component for production, run:

npm run build

To run the unit tests for the components, run:

npm test

or for a specific spec:

npm test -t special.spec.ts


ADR (Architectural Decision Records)

Lighweight Architecture Decision Records (ADRs) will be used to record thoughts & decisions and prevent re-visiting or re-thinking issues which helps move the project forward.


Contributing


Language Convention

Typescript should be the default language used for defining components, tests, and stories.


Naming Convention

When creating new component tags, do not use stencil in the component name (ex: <stencil-datepicker>). This is because the generated component has little to nothing to do with StencilJs; it's just a web component!

Instead, use the prefix v.


Using Components

Strategies for using Vetrify web components.

The first step is to publish to NPM.

Script tag

  • Put a script tag similar to this <script src='https://unpkg.com/my-component@0.0.1/dist/my-component.esm.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Node Modules

  • Run npm install my-component --save
  • Put a script tag similar to this <script src='node_modules/my-component/dist/my-component.esm.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Toolset

Stencil

StencilJs is a compiler for building fast web apps using Web Components.

Stencil combines the best concepts of the most popular front-end frameworks into a compile-time rather than run-time tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec.

Stencil components are just Web Components, so they work in any major framework or with no framework at all.

Storybook

Storybook is a development environment for UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components. Find out more at https://storybook.js.org.


Notes


Special Thanks to stencil storybook starters


About

Web components for vetrify using stenciljs and storybook


Languages

Language:SCSS 53.3%Language:TypeScript 44.1%Language:JavaScript 2.0%Language:PowerShell 0.2%Language:CSS 0.2%Language:EJS 0.2%