@blockquote/create-wc 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockquote/create-wc",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Web component with Lit scaffolding - Extending Open Web Component",
5
5
  "keywords": [
6
6
  "LitElement",
@@ -0,0 +1,57 @@
1
+ import { html, LitElement } from 'lit';
2
+ import styles from './styles/<%= className %>-styles.js';
3
+
4
+ export class <%= className %> extends LitElement {
5
+ static get is() {
6
+ return '<%= tagName %>';
7
+ }
8
+
9
+ static get styles() {
10
+ return [styles];
11
+ }
12
+
13
+ static get properties() {
14
+ return {
15
+ /**
16
+ * The heading to say "Hello" to.
17
+ * @type {string}
18
+ */
19
+ heading: { type: String },
20
+
21
+ /**
22
+ * The number of times the button has been clicked.
23
+ * @type {number}
24
+ */
25
+ counter: { type: Number },
26
+ };
27
+ }
28
+
29
+ constructor() {
30
+ super();
31
+ this.heading = 'Hey there';
32
+ this.counter = 5;
33
+ }
34
+
35
+ render() {
36
+ return html`
37
+ <h1>${this.sayHello(this.heading)}!</h1>
38
+ <button @click=${this._onClick}>Counter: ${this.counter}</button>
39
+ <hr />
40
+ <slot></slot>
41
+ `;
42
+ }
43
+
44
+ _onClick() {
45
+ this.counter += 1;
46
+ this.dispatchEvent(new CustomEvent('counter-changed'));
47
+ }
48
+
49
+ /**
50
+ * Formats a greeting
51
+ * @param heading {string} The heading to say "Hello" to
52
+ * @returns {string} A greeting directed at `heading`
53
+ */
54
+ sayHello(heading) {
55
+ return `Hello, ${heading}`;
56
+ }
57
+ }
@@ -0,0 +1,3 @@
1
+ import { <%= className %> } from '../src/<%= className %>.js';
2
+
3
+ window.customElements.define(<%= className %>.is, <%= className %>);
@@ -0,0 +1,13 @@
1
+ ## Demoing with Storybook
2
+
3
+ To run a local instance of Storybook for your component, run
4
+
5
+ ```bash
6
+ npm run storybook
7
+ ```
8
+
9
+ To build a production version of Storybook, run
10
+
11
+ ```bash
12
+ npm run storybook:build
13
+ ```
@@ -0,0 +1,13 @@
1
+ ## Linting and formatting
2
+
3
+ To scan the project for linting and formatting errors, run
4
+
5
+ ```bash
6
+ npm run lint
7
+ ```
8
+
9
+ To automatically fix linting and formatting errors, run
10
+
11
+ ```bash
12
+ npm run format
13
+ ```
@@ -0,0 +1,13 @@
1
+ ## Testing with Web Test Runner
2
+
3
+ To execute a single test run:
4
+
5
+ ```bash
6
+ npm run test
7
+ ```
8
+
9
+ To run the tests in interactive watch mode run:
10
+
11
+ ```bash
12
+ npm run test:watch
13
+ ```
@@ -0,0 +1,35 @@
1
+ # \<<%= tagName %>>
2
+
3
+ ![Lit](https://img.shields.io/badge/lit-2.0.0-blue)
4
+
5
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm i <%= tagName %>
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```html
16
+ <script type="module">
17
+ import '<%= tagName %>/<%= tagName %>.js';
18
+ </script>
19
+
20
+ <<%= tagName %>></<%= tagName %>>
21
+ ```
22
+
23
+ ## Tooling configs
24
+
25
+ For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
26
+
27
+ If you customize the configuration a lot, you can consider moving them to individual files.
28
+
29
+ ## Local Demo with `vite`
30
+
31
+ ```bash
32
+ npm start
33
+ ```
34
+
35
+ To run a local development server that serves the basic demo located in demo/index.html
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <style>
6
+ body {
7
+ background: #fafafa;
8
+ }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <div id="demo"></div>
13
+
14
+ <script type="module">
15
+ import { html, render } from 'lit';
16
+ import '../define/<%= tagName %>.js';
17
+
18
+ const heading = 'World!';
19
+ render(
20
+ html`<<%= tagName %> .heading=${heading}>some light-dom</<%= tagName %>>`,
21
+ document.querySelector('#demo'),
22
+ );
23
+ </script>
24
+ </body>
25
+ </html>
@@ -0,0 +1 @@
1
+ export { <%= className %> } from './src/<%= className %>.js';
@@ -0,0 +1,20 @@
1
+ /* eslint-disable no-unused-vars */
2
+ import { css } from 'lit';
3
+
4
+ export default css`
5
+ :host {
6
+ display: block;
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ :host([hidden]),
11
+ [hidden] {
12
+ display: none !important;
13
+ }
14
+
15
+ *,
16
+ *:before,
17
+ *:after {
18
+ box-sizing: inherit;
19
+ }
20
+ `;
@@ -0,0 +1,46 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import styles from './styles/<%= className %>-styles.js';
4
+
5
+ export class <%= className %> extends LitElement {
6
+ static get is() {
7
+ return '<%= tagName %>';
8
+ }
9
+
10
+ static override styles = [styles];
11
+
12
+ /**
13
+ * The heading to say "Hello" to.
14
+ */
15
+ @property({ type: String })
16
+ heading = 'Hey there';
17
+
18
+ /**
19
+ * The number of times the button has been clicked.
20
+ */
21
+ @property({ type: Number })
22
+ counter = 5;
23
+
24
+ override render() {
25
+ return html`
26
+ <h1>${this.sayHello(this.heading)}!</h1>
27
+ <button @click=${this._onClick}>Counter: ${this.counter}</button>
28
+ <hr />
29
+ <slot></slot>
30
+ `;
31
+ }
32
+
33
+ private _onClick() {
34
+ this.counter += 1;
35
+ this.dispatchEvent(new CustomEvent('counter-changed'));
36
+ }
37
+
38
+ /**
39
+ * Formats a greeting
40
+ * @param heading The heading to say "Hello" to
41
+ * @returns {string} A greeting directed at `heading`
42
+ */
43
+ sayHello(heading: string): string {
44
+ return `Hello, ${heading}`;
45
+ }
46
+ }
@@ -0,0 +1,3 @@
1
+ import { <%= className %> } from '../src/<%= className %>.js';
2
+
3
+ window.customElements.define(<%= className %>.is, <%= className %>);
@@ -0,0 +1,13 @@
1
+ ## Demoing with Storybook
2
+
3
+ To run a local instance of Storybook for your component, run
4
+
5
+ ```bash
6
+ npm run storybook
7
+ ```
8
+
9
+ To build a production version of Storybook, run
10
+
11
+ ```bash
12
+ npm run storybook:build
13
+ ```
@@ -0,0 +1,13 @@
1
+ ## Linting and formatting
2
+
3
+ To scan the project for linting and formatting errors, run
4
+
5
+ ```bash
6
+ npm run lint
7
+ ```
8
+
9
+ To automatically fix linting and formatting errors, run
10
+
11
+ ```bash
12
+ npm run format
13
+ ```
@@ -0,0 +1,13 @@
1
+ ## Testing with Web Test Runner
2
+
3
+ To execute a single test run:
4
+
5
+ ```bash
6
+ npm run test
7
+ ```
8
+
9
+ To run the tests in interactive watch mode run:
10
+
11
+ ```bash
12
+ npm run test:watch
13
+ ```
@@ -0,0 +1,35 @@
1
+ # \<<%= tagName %>>
2
+
3
+ ![Lit](https://img.shields.io/badge/lit-2.0.0-blue)
4
+
5
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm i <%= tagName %>
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```html
16
+ <script type="module">
17
+ import '<%= tagName %>/<%= tagName %>.js';
18
+ </script>
19
+
20
+ <<%= tagName %>></<%= tagName %>>
21
+ ```
22
+
23
+ ## Tooling configs
24
+
25
+ For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
26
+
27
+ If you customize the configuration a lot, you can consider moving them to individual files.
28
+
29
+ ## Local Demo with `vite`
30
+
31
+ ```bash
32
+ npm start
33
+ ```
34
+
35
+ To run a local development server that serves the basic demo located in demo/index.html
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <style>
6
+ body {
7
+ background: #fafafa;
8
+ }
9
+ </style>
10
+ </head>
11
+ <body>
12
+ <div id="demo"></div>
13
+
14
+ <script type="module">
15
+ import { html, render } from 'lit';
16
+ import '../define/<%= tagName %>.ts';
17
+
18
+ const heading = 'World!';
19
+ render(
20
+ html`<<%= tagName %> .heading=${heading}>some light-dom</<%= tagName %>>`,
21
+ document.querySelector('#demo'),
22
+ );
23
+ </script>
24
+ </body>
25
+ </html>
@@ -0,0 +1 @@
1
+ export { <%= className %> } from './src/<%= className %>.js';
@@ -0,0 +1,20 @@
1
+ /* eslint-disable no-unused-vars */
2
+ import { css } from 'lit';
3
+
4
+ export default css`
5
+ :host {
6
+ display: block;
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ :host([hidden]),
11
+ [hidden] {
12
+ display: none !important;
13
+ }
14
+
15
+ *,
16
+ *:before,
17
+ *:after {
18
+ box-sizing: inherit;
19
+ }
20
+ `;
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2019",
4
+ "module": "es2020",
5
+ "lib": ["es2020", "DOM", "DOM.Iterable"],
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "sourceMap": true,
9
+ "inlineSources": true,
10
+ "outDir": "./dist",
11
+ "rootDirs": ["./src", "./define", ".test/"],
12
+ "strict": true,
13
+ "noUnusedLocals": true,
14
+ "noUnusedParameters": true,
15
+ "noImplicitReturns": true,
16
+ "noFallthroughCasesInSwitch": true,
17
+ "noImplicitAny": true,
18
+ "noImplicitThis": true,
19
+ "moduleResolution": "node",
20
+ "allowSyntheticDefaultImports": true,
21
+ "experimentalDecorators": true,
22
+ "forceConsistentCasingInFileNames": true,
23
+ "noImplicitOverride": true
24
+ },
25
+ "include": ["src/**/*.ts", "define/**/*.ts", "test/**/*.ts", "./index.ts"],
26
+ "exclude": []
27
+ }
package/CHANGELOG.md DELETED
@@ -1 +0,0 @@
1
- # create-blockquote-wc