@epa-wg/custom-element 0.0.2 → 0.0.4
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/.github/workflows/npm-publish-github-packages.yml +36 -0
- package/.gitignore +0 -1
- package/README.md +2 -2
- package/bin/stackblitz.sh +5 -0
- package/custom-element.js +2 -2
- package/index.html +19 -2
- package/package.json +3 -5
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: 16
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm test
|
|
20
|
+
|
|
21
|
+
publish-gpr:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
permissions:
|
|
25
|
+
contents: read
|
|
26
|
+
packages: write
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v3
|
|
29
|
+
- uses: actions/setup-node@v3
|
|
30
|
+
with:
|
|
31
|
+
node-version: 16
|
|
32
|
+
registry-url: https://npm.pkg.github.com/
|
|
33
|
+
- run: npm ci
|
|
34
|
+
- run: npm publish
|
|
35
|
+
env:
|
|
36
|
+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
package/.gitignore
CHANGED
package/README.md
CHANGED
|
@@ -144,6 +144,6 @@ within template
|
|
|
144
144
|
[github-image]: https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/mark-github.svg
|
|
145
145
|
[npm-image]: https://img.shields.io/npm/v/@epa-wg/custom-element.svg
|
|
146
146
|
[npm-url]: https://npmjs.org/package/@epa-wg/custom-element
|
|
147
|
-
[coverage-image]: https://unpkg.com/@epa-wg/custom-element-test@0.0.
|
|
148
|
-
[coverage-url]: https://unpkg.com/@epa-wg/custom-element-test@0.0.
|
|
147
|
+
[coverage-image]: https://unpkg.com/@epa-wg/custom-element-test@0.0.4/coverage/coverage.svg
|
|
148
|
+
[coverage-url]: https://unpkg.com/@epa-wg/custom-element-test@0.0.4/coverage/lcov-report/index.html
|
|
149
149
|
[sandbox-url]: https://stackblitz.com/github/EPA-WG/custom-element?file=index.html
|
package/custom-element.js
CHANGED
|
@@ -59,8 +59,8 @@ export class CustomElement extends HTMLElement
|
|
|
59
59
|
</xsl:template>
|
|
60
60
|
|
|
61
61
|
</xsl:stylesheet>` ) );
|
|
62
|
-
|
|
63
|
-
window.customElements.define(
|
|
62
|
+
const tag = this.getAttribute( 'tag' );
|
|
63
|
+
tag && window.customElements.define( tag, class extends HTMLElement
|
|
64
64
|
{
|
|
65
65
|
constructor()
|
|
66
66
|
{
|
package/index.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<nav>
|
|
18
18
|
<h3><code>custom-element</code> demo</h3>
|
|
19
19
|
<a href="https://github.com/EPA-WG/custom-element"
|
|
20
|
-
><img src="https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/mark-github.svg">GIT</a>
|
|
20
|
+
><img src="https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/mark-github.svg" alt="icon">GIT</a>
|
|
21
21
|
<p>
|
|
22
22
|
This <em>Declarative Custom Element</em> allows to define<br/>
|
|
23
23
|
custom HTML tag with template filled from slots, attributes, dataset. </p>
|
|
@@ -114,14 +114,31 @@
|
|
|
114
114
|
|
|
115
115
|
<!-- `slot name=xxx` replaced with elements with `slot=xxx` attribute -->
|
|
116
116
|
<p><slot name="description"><i>description is not available</i></slot></p>
|
|
117
|
+
<xsl:for-each select="//*[@pokemon-id]">
|
|
118
|
+
<!-- loop over payload elements with `pokemon-id` attribute -->
|
|
119
|
+
<button>
|
|
120
|
+
<img height="32"
|
|
121
|
+
src="https://unpkg.com/pokeapi-sprites@2.0.2/sprites/pokemon/other/dream-world/{@pokemon-id}.svg"
|
|
122
|
+
alt="{text()}"/>
|
|
123
|
+
<br/>
|
|
124
|
+
<xsl:value-of select='text()'/>
|
|
125
|
+
</button>
|
|
126
|
+
|
|
127
|
+
</xsl:for-each>
|
|
117
128
|
</custom-element>
|
|
118
129
|
|
|
119
130
|
<pokemon-tile title="bulbasaur" data-smile="👼" pokemon-id="1" >
|
|
120
131
|
<p slot="description">Bulbasaur is a cute Pokémon born with a large seed firmly affixed to its back;
|
|
121
132
|
the seed grows in size as the Pokémon does.</p>
|
|
133
|
+
<ul>
|
|
134
|
+
<li pokemon-id="2">ivysaur</li>
|
|
135
|
+
<li pokemon-id="3">venusaur</li>
|
|
136
|
+
</ul>
|
|
122
137
|
</pokemon-tile>
|
|
123
138
|
|
|
124
|
-
<pokemon-tile title="ninetales" pokemon-id="38"
|
|
139
|
+
<pokemon-tile title="ninetales" pokemon-id="38" >
|
|
140
|
+
<li pokemon-id="37">vulpix</li>
|
|
141
|
+
</pokemon-tile>
|
|
125
142
|
</template>
|
|
126
143
|
</html-demo-element>
|
|
127
144
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epa-wg/custom-element",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Declarative Custom Element as W3C proposal PoC with native(XSLT) based templating",
|
|
5
5
|
"browser": "custom-element.js",
|
|
6
6
|
"module": "custom-element.js",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"types": "./custom-element.d.ts",
|
|
17
17
|
"scripts": {
|
|
18
|
-
"
|
|
18
|
+
"dev": "bash bin/stackblitz.sh",
|
|
19
|
+
"start": "npm i --no-save @web/dev-server && web-dev-server --node-resolve",
|
|
19
20
|
"test": "echo \"test would reside in https://github.com/EPA-WG/custom-element-test\" && exit 0",
|
|
20
21
|
"typings": "npx -p typescript tsc custom-element.js --declaration --allowJs --emitDeclarationOnly "
|
|
21
22
|
},
|
|
@@ -43,8 +44,5 @@
|
|
|
43
44
|
"funding": {
|
|
44
45
|
"type": "patreon",
|
|
45
46
|
"url": "https://www.patreon.com/sashafirsov"
|
|
46
|
-
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"@web/dev-server": "^0.1.35"
|
|
49
47
|
}
|
|
50
48
|
}
|