@operato/utils 0.2.51
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/.editorconfig +29 -0
- package/.storybook/main.js +3 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +34 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/demo/index.html +32 -0
- package/dist/src/index.js +2 -0
- package/package.json +66 -0
- package/src/index.ts +1 -0
- package/src/sleep.ts +10 -0
- package/tsconfig.json +22 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
package/.editorconfig
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# EditorConfig helps developers define and maintain consistent
|
2
|
+
# coding styles between different editors and IDEs
|
3
|
+
# editorconfig.org
|
4
|
+
|
5
|
+
root = true
|
6
|
+
|
7
|
+
|
8
|
+
[*]
|
9
|
+
|
10
|
+
# Change these settings to your own preference
|
11
|
+
indent_style = space
|
12
|
+
indent_size = 2
|
13
|
+
|
14
|
+
# We recommend you to keep these unchanged
|
15
|
+
end_of_line = lf
|
16
|
+
charset = utf-8
|
17
|
+
trim_trailing_whitespace = true
|
18
|
+
insert_final_newline = true
|
19
|
+
|
20
|
+
[*.md]
|
21
|
+
trim_trailing_whitespace = false
|
22
|
+
|
23
|
+
[*.json]
|
24
|
+
indent_size = 2
|
25
|
+
|
26
|
+
[*.{html,js,md}]
|
27
|
+
block_comment_start = /**
|
28
|
+
block_comment = *
|
29
|
+
block_comment_end = */
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { storybookPlugin } from '@web/dev-server-storybook';
|
2
|
+
import baseConfig from '../web-dev-server.config.mjs';
|
3
|
+
|
4
|
+
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
5
|
+
...baseConfig,
|
6
|
+
open: '/',
|
7
|
+
plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
|
8
|
+
});
|
package/CHANGELOG.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
|
+
|
6
|
+
### [0.2.51](https://github.com/hatiolab/operato/compare/v0.2.50...v0.2.51) (2021-12-16)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @operato/utils
|
9
|
+
|
10
|
+
### [0.2.50](https://github.com/hatiolab/operato/compare/v0.2.49...v0.2.50) (2021-12-16)
|
11
|
+
|
12
|
+
**Note:** Version bump only for package @operato/utils
|
13
|
+
|
14
|
+
### [0.2.49](https://github.com/hatiolab/operato/compare/v0.2.48...v0.2.49) (2021-12-14)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @operato/utils
|
17
|
+
|
18
|
+
### [0.2.48](https://github.com/hatiolab/operato/compare/v0.2.47...v0.2.48) (2021-12-14)
|
19
|
+
|
20
|
+
**Note:** Version bump only for package @operato/utils
|
21
|
+
|
22
|
+
### [0.2.47](https://github.com/hatiolab/operato/compare/v0.2.46...v0.2.47) (2021-12-13)
|
23
|
+
|
24
|
+
**Note:** Version bump only for package @operato/utils
|
25
|
+
|
26
|
+
### [0.2.46](https://github.com/hatiolab/operato/compare/v0.2.45...v0.2.46) (2021-12-12)
|
27
|
+
|
28
|
+
### :rocket: New Features
|
29
|
+
|
30
|
+
- add utils and oops ([56737fa](https://github.com/hatiolab/operato/commit/56737fa117ed2135e279ca0f1e4c969daddf7b34))
|
31
|
+
|
32
|
+
### :bug: Bug Fix
|
33
|
+
|
34
|
+
- set all module version to 0.2.45 ([40cea11](https://github.com/hatiolab/operato/commit/40cea11fab09ab3fb96bcd7db797abd13b23c216))
|
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) hatiolab.com
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# \<mini-utils>
|
2
|
+
|
3
|
+
This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm i mini-utils
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
```html
|
14
|
+
<script type="module">
|
15
|
+
import 'mini-utils/mini-utils.js'
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<mini-utils></mini-utils>
|
19
|
+
```
|
20
|
+
|
21
|
+
## Linting and formatting
|
22
|
+
|
23
|
+
To scan the project for linting and formatting errors, run
|
24
|
+
|
25
|
+
```bash
|
26
|
+
npm run lint
|
27
|
+
```
|
28
|
+
|
29
|
+
To automatically fix linting and formatting errors, run
|
30
|
+
|
31
|
+
```bash
|
32
|
+
npm run format
|
33
|
+
```
|
34
|
+
|
35
|
+
## Testing with Web Test Runner
|
36
|
+
|
37
|
+
To execute a single test run:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
npm run test
|
41
|
+
```
|
42
|
+
|
43
|
+
To run the tests in interactive watch mode run:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
npm run test:watch
|
47
|
+
```
|
48
|
+
|
49
|
+
## Demoing with Storybook
|
50
|
+
|
51
|
+
To run a local instance of Storybook for your component, run
|
52
|
+
|
53
|
+
```bash
|
54
|
+
npm run storybook
|
55
|
+
```
|
56
|
+
|
57
|
+
To build a production version of Storybook, run
|
58
|
+
|
59
|
+
```bash
|
60
|
+
npm run storybook:build
|
61
|
+
```
|
62
|
+
|
63
|
+
## Tooling configs
|
64
|
+
|
65
|
+
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
66
|
+
|
67
|
+
If you customize the configuration a lot, you can consider moving them to individual files.
|
68
|
+
|
69
|
+
## Local Demo with `web-dev-server`
|
70
|
+
|
71
|
+
```bash
|
72
|
+
npm start
|
73
|
+
```
|
74
|
+
|
75
|
+
To run a local development server that serves the basic demo located in `demo/index.html`
|
package/demo/index.html
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en-GB">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background: #fafafa;
|
8
|
+
--ox-checkbox-size: 12px;
|
9
|
+
}
|
10
|
+
|
11
|
+
#demo {
|
12
|
+
position: relative;
|
13
|
+
height: 300px;
|
14
|
+
background-color: lightgray;
|
15
|
+
vertical-align: middle;
|
16
|
+
}
|
17
|
+
</style>
|
18
|
+
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
|
19
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="demo"></div>
|
23
|
+
|
24
|
+
<script type="module">
|
25
|
+
import { html, render } from 'lit'
|
26
|
+
|
27
|
+
const parent = document.querySelector('#demo')
|
28
|
+
|
29
|
+
render(html`clike anywhere in this box to utils mini.`, parent)
|
30
|
+
</script>
|
31
|
+
</body>
|
32
|
+
</html>
|
package/package.json
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
{
|
2
|
+
"name": "@operato/utils",
|
3
|
+
"description": "Webcomponent utils following open-wc recommendations",
|
4
|
+
"license": "MIT",
|
5
|
+
"author": "heartyoh",
|
6
|
+
"version": "0.2.51",
|
7
|
+
"main": "dist/src/index.js",
|
8
|
+
"module": "dist/src/index.js",
|
9
|
+
"exports": {
|
10
|
+
".": "./dist/src/index.js"
|
11
|
+
},
|
12
|
+
"publishConfig": {
|
13
|
+
"access": "public",
|
14
|
+
"@operato:registry": "https://registry.npmjs.org"
|
15
|
+
},
|
16
|
+
"repository": {
|
17
|
+
"type": "git",
|
18
|
+
"url": "git+https://github.com/hatiolab/operato.git",
|
19
|
+
"directory": "webcomponents/utils"
|
20
|
+
},
|
21
|
+
"scripts": {
|
22
|
+
"analyze": "cem analyze --litelement",
|
23
|
+
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
24
|
+
"build": "tsc && npm run analyze -- --exclude dist",
|
25
|
+
"prepublish": "tsc && npm run analyze -- --exclude dist",
|
26
|
+
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
27
|
+
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
28
|
+
"test": "tsc && wtr --coverage",
|
29
|
+
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
30
|
+
"storybook": "tsc && npm run analyze -- --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds -c .storybook/server.mjs\"",
|
31
|
+
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
32
|
+
},
|
33
|
+
"dependencies": {},
|
34
|
+
"devDependencies": {
|
35
|
+
"@custom-elements-manifest/analyzer": "^0.4.17",
|
36
|
+
"@hatiolab/prettier-config": "^1.0.0",
|
37
|
+
"@open-wc/eslint-config": "^4.3.0",
|
38
|
+
"@open-wc/testing": "next",
|
39
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
40
|
+
"@typescript-eslint/parser": "^4.33.0",
|
41
|
+
"@web/dev-server": "^0.1.28",
|
42
|
+
"@web/dev-server-storybook": "next",
|
43
|
+
"@web/test-runner": "next",
|
44
|
+
"concurrently": "^5.3.0",
|
45
|
+
"eslint": "^7.32.0",
|
46
|
+
"eslint-config-prettier": "^8.3.0",
|
47
|
+
"husky": "^4.3.8",
|
48
|
+
"lint-staged": "^10.5.4",
|
49
|
+
"prettier": "^2.4.1",
|
50
|
+
"tslib": "^2.3.1",
|
51
|
+
"typescript": "^4.5.2"
|
52
|
+
},
|
53
|
+
"customElements": "custom-elements.json",
|
54
|
+
"prettier": "@hatiolab/prettier-config",
|
55
|
+
"husky": {
|
56
|
+
"hooks": {
|
57
|
+
"pre-commit": "lint-staged"
|
58
|
+
}
|
59
|
+
},
|
60
|
+
"lint-staged": {
|
61
|
+
"*.ts": [
|
62
|
+
"eslint --fix",
|
63
|
+
"prettier --write"
|
64
|
+
]
|
65
|
+
}
|
66
|
+
}
|
package/src/index.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './sleep'
|
package/src/sleep.ts
ADDED
package/tsconfig.json
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"target": "es2018",
|
4
|
+
"module": "esnext",
|
5
|
+
"moduleResolution": "node",
|
6
|
+
"noEmitOnError": true,
|
7
|
+
"lib": ["es2017", "dom"],
|
8
|
+
"strict": true,
|
9
|
+
"esModuleInterop": false,
|
10
|
+
"allowSyntheticDefaultImports": true,
|
11
|
+
"experimentalDecorators": true,
|
12
|
+
"importHelpers": true,
|
13
|
+
"outDir": "dist",
|
14
|
+
"sourceMap": true,
|
15
|
+
"inlineSources": true,
|
16
|
+
"rootDir": "./",
|
17
|
+
"declaration": true,
|
18
|
+
"incremental": true,
|
19
|
+
"types": ["node", "mocha"]
|
20
|
+
},
|
21
|
+
"include": ["**/*.ts"]
|
22
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
2
|
+
|
3
|
+
/** Use Hot Module replacement by adding --hmr to the start command */
|
4
|
+
const hmr = process.argv.includes('--hmr');
|
5
|
+
|
6
|
+
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
7
|
+
open: '/demo/',
|
8
|
+
/** Use regular watch mode if HMR is not enabled. */
|
9
|
+
watch: !hmr,
|
10
|
+
/** Resolve bare module imports */
|
11
|
+
nodeResolve: {
|
12
|
+
exportConditions: ['browser', 'development'],
|
13
|
+
},
|
14
|
+
|
15
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
16
|
+
// esbuildTarget: 'auto'
|
17
|
+
|
18
|
+
/** Set appIndex to enable SPA routing */
|
19
|
+
// appIndex: 'demo/index.html',
|
20
|
+
|
21
|
+
plugins: [
|
22
|
+
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
23
|
+
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
24
|
+
],
|
25
|
+
|
26
|
+
// See documentation for all available options
|
27
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
2
|
+
|
3
|
+
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
4
|
+
|
5
|
+
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
6
|
+
/** Test files to run */
|
7
|
+
files: 'dist/test/**/*.test.js',
|
8
|
+
|
9
|
+
/** Resolve bare module imports */
|
10
|
+
nodeResolve: {
|
11
|
+
exportConditions: ['browser', 'development'],
|
12
|
+
},
|
13
|
+
|
14
|
+
/** Filter out lit dev mode logs */
|
15
|
+
filterBrowserLogs(log) {
|
16
|
+
for (const arg of log.args) {
|
17
|
+
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
return true;
|
22
|
+
},
|
23
|
+
|
24
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
25
|
+
// esbuildTarget: 'auto',
|
26
|
+
|
27
|
+
/** Amount of browsers to run concurrently */
|
28
|
+
// concurrentBrowsers: 2,
|
29
|
+
|
30
|
+
/** Amount of test files per browser to test concurrently */
|
31
|
+
// concurrency: 1,
|
32
|
+
|
33
|
+
/** Browsers to run tests on */
|
34
|
+
// browsers: [
|
35
|
+
// playwrightLauncher({ product: 'chromium' }),
|
36
|
+
// playwrightLauncher({ product: 'firefox' }),
|
37
|
+
// playwrightLauncher({ product: 'webkit' }),
|
38
|
+
// ],
|
39
|
+
|
40
|
+
// See documentation for all available options
|
41
|
+
});
|