feat: remove barrel file

This commit is contained in:
Ayo 2023-11-19 18:25:49 +01:00
parent 9d539f32a3
commit de673e2f12
5 changed files with 22 additions and 6 deletions

17
demo/Counter.mjs Normal file
View file

@ -0,0 +1,17 @@
// @ts-check
import WebComponent from "../src/WebComponent.js";
export class Counter extends WebComponent {
static properties = ["count"];
onInit() {
this.props.count = 0;
this.onclick = () => ++this.props.count;
}
get template() {
return `<button id="btn">${this.props.count}</button>`;
}
}
customElements.define("my-counter", Counter);

View file

@ -1,5 +1,5 @@
// @ts-check // @ts-check
import WebComponent from "../src/index.js"; import WebComponent from "../src/WebComponent.js";
export class HelloWorld extends WebComponent { export class HelloWorld extends WebComponent {
static properties = ["my-name", "emotion"]; static properties = ["my-name", "emotion"];

View file

@ -2,7 +2,7 @@
"name": "web-component-base", "name": "web-component-base",
"version": "1.12.13", "version": "1.12.13",
"description": "A zero-dependency, ~760 Bytes (minified & brotlied), JS base class for creating reactive custom elements easily", "description": "A zero-dependency, ~760 Bytes (minified & brotlied), JS base class for creating reactive custom elements easily",
"main": "index.d.ts", "main": "WebComponent.js",
"type": "module", "type": "module",
"scripts": { "scripts": {
"start": "npx simple-server .", "start": "npx simple-server .",

View file

@ -43,7 +43,8 @@ export class WebComponent extends HTMLElement {
* A camelCase counterpart using `WebComponent.props` will give read/write access to any attribute, with or without the `data-*` prefix. * A camelCase counterpart using `WebComponent.props` will give read/write access to any attribute, with or without the `data-*` prefix.
* @see https://www.npmjs.com/package/web-component-base#prop-access * @see https://www.npmjs.com/package/web-component-base#prop-access
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
* @type {DOMStringMap} * @typedef {{[name: string]: any}} PropStringMap
* @type {PropStringMap}
* @example * @example
* *
* class HelloWorld extends WebComponent { * class HelloWorld extends WebComponent {
@ -61,7 +62,7 @@ export class WebComponent extends HTMLElement {
} }
/** /**
* @type {DOMStringMap} * @type {PropStringMap}
*/ */
#props; #props;

View file

@ -1,2 +0,0 @@
import { WebComponent } from "./WebComponent.js";
export default WebComponent;