Vetrify's standalone Web Components.
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 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
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.
Typescript should be the default language used for defining components, tests, and stories.
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
.
Strategies for using Vetrify web components.
The first step is to publish to NPM.
- 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
- 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
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 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.
- Stencil 2.0.3
- Storybook 6.0.26
- Real Stencil HMR (hot module reloading)
- Chromatic tested for visual regression testing of stories.