custom-elements-ts 0.0.16 → 0.1.0

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.
Files changed (69) hide show
  1. package/.eslintrc.json +46 -0
  2. package/.github/workflows/ci.yml +49 -0
  3. package/.prettierrc +7 -0
  4. package/LICENSE +20 -0
  5. package/README.md +426 -168
  6. package/demos/counter/counter.element.html +1 -0
  7. package/demos/counter/counter.element.scss +234 -0
  8. package/demos/counter/counter.element.ts +68 -0
  9. package/demos/counter/index.html +205 -0
  10. package/demos/counter/index.ts +1 -0
  11. package/demos/site/code-example/code-example.element.scss +168 -0
  12. package/demos/site/code-example/code-example.element.ts +88 -0
  13. package/demos/site/event-log/event-log.element.scss +179 -0
  14. package/demos/site/event-log/event-log.element.ts +134 -0
  15. package/demos/site/favicon.svg +14 -0
  16. package/demos/site/index.html +346 -0
  17. package/demos/site/index.ts +13 -0
  18. package/demos/site/message/message.element.scss +75 -0
  19. package/demos/site/message/message.element.ts +76 -0
  20. package/demos/site/og-image.png +0 -0
  21. package/demos/site/styles/site.css +1023 -0
  22. package/demos/site/styles/tokens.css +56 -0
  23. package/demos/site/toast/toast.element.scss +110 -0
  24. package/demos/site/toast/toast.element.ts +63 -0
  25. package/demos/todo-dashboard/index.html +141 -0
  26. package/demos/todo-dashboard/index.ts +4 -0
  27. package/demos/todo-dashboard/todo-dashboard.element.scss +1145 -0
  28. package/demos/todo-dashboard/todo-dashboard.element.ts +332 -0
  29. package/demos/todo-dashboard/todo-filters.element.ts +54 -0
  30. package/demos/todo-dashboard/todo-item.element.ts +126 -0
  31. package/demos/todo-dashboard/todo-stats.element.ts +189 -0
  32. package/package.json +73 -29
  33. package/src/custom-element.ts +206 -0
  34. package/{index.d.ts → src/index.ts} +2 -0
  35. package/src/listen.ts +70 -0
  36. package/src/prop.ts +92 -0
  37. package/src/state.ts +129 -0
  38. package/src/template-runtime.ts +435 -0
  39. package/src/toggle.ts +66 -0
  40. package/src/tsconfig.json +24 -0
  41. package/src/util.ts +33 -0
  42. package/src/watch.ts +14 -0
  43. package/tests/basic.spec.ts +70 -0
  44. package/tests/custom-element.spec.ts +77 -0
  45. package/tests/dispatch.spec.ts +52 -0
  46. package/tests/init.spec.ts +94 -0
  47. package/tests/listen.spec.ts +118 -0
  48. package/tests/prop.spec.ts +118 -0
  49. package/tests/templating-runtime.spec.ts +575 -0
  50. package/tests/toggle.spec.ts +92 -0
  51. package/tests/watch.spec.ts +183 -0
  52. package/tools/build.js +119 -0
  53. package/tools/bundle.js +167 -0
  54. package/tools/rollup-config.js +70 -0
  55. package/tools/start.js +188 -0
  56. package/tsconfig.json +38 -0
  57. package/vite.config.mts +30 -0
  58. package/bundles/custom-elements-ts.umd.js +0 -315
  59. package/bundles/custom-elements-ts.umd.js.map +0 -1
  60. package/custom-element.d.ts +0 -12
  61. package/esm2015/custom-elements-ts.js +0 -260
  62. package/esm2015/custom-elements-ts.js.map +0 -1
  63. package/esm5/custom-elements-ts.js +0 -298
  64. package/esm5/custom-elements-ts.js.map +0 -1
  65. package/listen.d.ts +0 -17
  66. package/prop.d.ts +0 -2
  67. package/toggle.d.ts +0 -1
  68. package/util.d.ts +0 -4
  69. package/watch.d.ts +0 -1
package/.eslintrc.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "root": true,
3
+ "parser": "@typescript-eslint/parser",
4
+ "parserOptions": {
5
+ "ecmaVersion": 2019,
6
+ "sourceType": "module",
7
+ "warnOnUnsupportedTypeScriptVersion": false
8
+ },
9
+ "plugins": ["@typescript-eslint", "prettier"],
10
+ "extends": [
11
+ "eslint:recommended",
12
+ "plugin:@typescript-eslint/recommended",
13
+ "plugin:prettier/recommended"
14
+ ],
15
+ "env": { "browser": true, "es6": true, "jasmine": true },
16
+ "overrides": [
17
+ {
18
+ "files": ["tools/**/*.js"],
19
+ "parser": "espree",
20
+ "env": { "node": true, "es6": true },
21
+ "rules": {
22
+ "@typescript-eslint/no-var-requires": "off",
23
+ "@typescript-eslint/no-unused-vars": "off",
24
+ "no-undef": "off",
25
+ "no-console": "off",
26
+ "prettier/prettier": "off"
27
+ }
28
+ }
29
+ ],
30
+ "ignorePatterns": ["dist/", ".tmp/", "node_modules/", "demos/**"],
31
+ "rules": {
32
+ "eqeqeq": ["error", "always"],
33
+ "no-throw-literal": "error",
34
+ "prettier/prettier": "error",
35
+ "@typescript-eslint/explicit-function-return-type": "off",
36
+ "@typescript-eslint/no-explicit-any": "off",
37
+ "@typescript-eslint/no-unused-vars": [
38
+ "warn",
39
+ {
40
+ "args": "none",
41
+ "varsIgnorePattern": "^_|^[A-Z].*Element$",
42
+ "caughtErrorsIgnorePattern": "^_"
43
+ }
44
+ ]
45
+ }
46
+ }
@@ -0,0 +1,49 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["master"]
6
+ pull_request:
7
+ branches: ["master"]
8
+
9
+ jobs:
10
+ build-test-deploy:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: write
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Use Node.js 20
19
+ uses: actions/setup-node@v4
20
+ with:
21
+ node-version: 20
22
+
23
+ - name: Install dependencies
24
+ run: npm ci
25
+
26
+ - name: Run tests with coverage
27
+ run: npm run test:coverage
28
+
29
+ - name: Upload coverage to Coveralls
30
+ uses: coverallsapp/github-action@v2
31
+ with:
32
+ github-token: ${{ secrets.GITHUB_TOKEN }}
33
+ path-to-lcov: ./coverage/lcov.info
34
+
35
+ - name: Build demo site bundle
36
+ run: npm run build site
37
+
38
+ # The build emits index.html, site.umd.js, and styles/* into dist/.
39
+ # All asset URLs in index.html are relative (no <base> tag), so they
40
+ # resolve correctly under the GitHub Pages project subpath
41
+ # (e.g. https://geocine.github.io/custom-elements-ts/) without any
42
+ # post-processing. No path rewriting is required here.
43
+
44
+ - name: Deploy to GitHub Pages
45
+ if: github.event_name == 'push' && github.ref == 'refs/heads/master'
46
+ uses: peaceiris/actions-gh-pages@v3
47
+ with:
48
+ github_token: ${{ secrets.GITHUB_TOKEN }}
49
+ publish_dir: ./dist
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": true,
4
+ "trailingComma": "es5",
5
+ "printWidth": 100,
6
+ "endOfLine": "auto"
7
+ }
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-present Aivan Monceller
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 DEALINGS IN THE SOFTWARE.