@epa-wg/custom-element 0.0.25 → 0.0.27
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/README.md +3 -3
- package/bin/xslDtd2Ide.mjs +1 -1
- package/custom-element.js +103 -33
- package/demo/a.svg +27 -0
- package/demo/confused.svg +1 -0
- package/demo/demo.css +11 -8
- package/demo/embed-1.html +1 -2
- package/demo/external-template.html +122 -62
- package/demo/lib-dir/Smiley.svg +24 -0
- package/demo/lib-dir/embed-lib.html +34 -0
- package/demo/module-url.html +215 -0
- package/demo/npm-versions-demo.html +118 -0
- package/demo/npm-versions.html +94 -0
- package/demo/s.xml +3 -36
- package/demo/s.xslt +55 -96
- package/demo/set-url.html +1 -1
- package/demo/z.html +32 -61
- package/demo/z.js +9 -0
- package/demo/z1.html +34 -0
- package/ide/customData-dce.json +215 -181
- package/ide/web-types-dce.json +184 -159
- package/ide/web-types-xsl.json +1 -1
- package/index.html +21 -3
- package/local-storage.js +19 -14
- package/module-url.js +34 -0
- package/package.json +1 -1
- package/request.html +0 -53
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>templates for embedded and external DCE lib dependencies</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>templates for embedded and external DCE lib dependencies</h1>
|
|
9
|
+
|
|
10
|
+
<template id="embed-lib-component">
|
|
11
|
+
👋 from embed-lib-component
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<template id="embed-relative-hash">
|
|
15
|
+
👌 from embed-relative-hash invoking
|
|
16
|
+
<module-url slice="full-url" src="./embed-lib.html"></module-url>
|
|
17
|
+
<a href="{//full-url}#embed-lib-component">
|
|
18
|
+
<img src="{//full-url}/../Smiley.svg"/>
|
|
19
|
+
#embed-lib-component
|
|
20
|
+
</a>:
|
|
21
|
+
<custom-element src="#embed-lib-component"></custom-element>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<template id="embed-relative-file">
|
|
25
|
+
👍 from embed-relative-file invoking
|
|
26
|
+
<module-url slice="up-url" src="../embed-1.html"></module-url>
|
|
27
|
+
<a href="{//up-url}">../embed-1.html</a>:
|
|
28
|
+
<custom-element src="../embed-1.html">
|
|
29
|
+
loading from ../embed-1.html ...
|
|
30
|
+
</custom-element>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
</body>
|
|
34
|
+
</html>
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
3
|
+
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
6
|
+
<title>importmap custom-element Declarative Custom Element implementation demo</title>
|
|
7
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
8
|
+
<script type="importmap">
|
|
9
|
+
{
|
|
10
|
+
"imports": {
|
|
11
|
+
"lib-root/": "./lib-dir/",
|
|
12
|
+
"embed-lib": "./lib-dir/embed-lib.html"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
<script type="module" src="../location-element.js"></script>
|
|
17
|
+
<script type="module" src="../module-url.js"></script>
|
|
18
|
+
<script type="module" src="../custom-element.js"></script>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
@import "./demo.css";
|
|
22
|
+
|
|
23
|
+
dce-root {
|
|
24
|
+
box-shadow: 0 0 0.5rem lime;
|
|
25
|
+
padding: 1rem;
|
|
26
|
+
display: inline-block;
|
|
27
|
+
}
|
|
28
|
+
main {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
&>section{
|
|
32
|
+
flex:1 20rem;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
|
|
37
|
+
</head>
|
|
38
|
+
<body>
|
|
39
|
+
|
|
40
|
+
<nav>
|
|
41
|
+
<h3><a href="../index.html"><code>custom-element</code> demo</a>, <code>importmap</code></h3>
|
|
42
|
+
</nav>
|
|
43
|
+
<main>
|
|
44
|
+
<section>
|
|
45
|
+
<h3>How to get the module URL for <code>custom-element</code>?</h3>
|
|
46
|
+
Answer: by defining following attributes in <code>module-url</code>:
|
|
47
|
+
<ol>
|
|
48
|
+
<li><code>src</code> with path to module resource, If omitted, it would match the
|
|
49
|
+
<code>window.location.href</code></li>
|
|
50
|
+
<li><code>slice</code> to read the URL</li>
|
|
51
|
+
</ol>
|
|
52
|
+
URL properties would be a part of slice data, the value would be a full URL.
|
|
53
|
+
</section><section>
|
|
54
|
+
<h3>Where to use <code>module-url</code>?</h3>
|
|
55
|
+
Answer: to inject the library resources URL into generated HTML.
|
|
56
|
+
<p><a
|
|
57
|
+
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#importing_modules_using_import_maps"
|
|
58
|
+
>Import maps </a> are used for defining the dependencies location on the web page level.
|
|
59
|
+
This way dependencies could reside on different CDN path or even domains while in the code would be
|
|
60
|
+
referenced
|
|
61
|
+
by symbolic package name.
|
|
62
|
+
See the CDN example bellow.</p>
|
|
63
|
+
<br/>
|
|
64
|
+
<p>The resolving of import maps is done by
|
|
65
|
+
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve">import.meta.resolve(path)</a>
|
|
66
|
+
</p>
|
|
67
|
+
</section><section>
|
|
68
|
+
<h3>Where NOT to use <code>module-url</code>?</h3>
|
|
69
|
+
Answer:
|
|
70
|
+
<ol>
|
|
71
|
+
<li> in <code>scr</code> attribute of <custom-element ><br/>
|
|
72
|
+
- It uses the same module resolving mechanism
|
|
73
|
+
</li>
|
|
74
|
+
<li> for getting/setting the page URL,<br/>
|
|
75
|
+
- see <a href="./set-url.html">How to set page URL in <code>custom-element</code>?</a>
|
|
76
|
+
|
|
77
|
+
</li>
|
|
78
|
+
</ol>
|
|
79
|
+
|
|
80
|
+
<h3>See also</h3>
|
|
81
|
+
<p><a href="./external-template.html">How to use external templates?</a></p>
|
|
82
|
+
</section>
|
|
83
|
+
<section>
|
|
84
|
+
<html-demo-element legend="this page import maps"
|
|
85
|
+
>
|
|
86
|
+
<template>
|
|
87
|
+
{
|
|
88
|
+
"imports": {
|
|
89
|
+
"lib-root": "./lib-dir/",
|
|
90
|
+
"embed-lib": "./lib-dir/embed-lib.html"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</template>
|
|
94
|
+
</html-demo-element>
|
|
95
|
+
</section>
|
|
96
|
+
</main>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<html-demo-element legend="1. relative to page path"
|
|
100
|
+
description="Should render Vulcan Salute 🖖 with link to embed-1.html, link should open the page"
|
|
101
|
+
>
|
|
102
|
+
<template>
|
|
103
|
+
<custom-element>
|
|
104
|
+
<a href="./embed-1.html">
|
|
105
|
+
<custom-element src="./embed-1.html"></custom-element>
|
|
106
|
+
</a>
|
|
107
|
+
</custom-element>
|
|
108
|
+
</template>
|
|
109
|
+
</html-demo-element>
|
|
110
|
+
|
|
111
|
+
<html-demo-element legend="2. module by symbolic name"
|
|
112
|
+
description="should render '👋 from embed-lib-component' as link to 'demo-lib/embed-lib.html', link should open the page "
|
|
113
|
+
>
|
|
114
|
+
<p><code>embed-lib</code> resolved to <code>./lib-dir/embed-lib.html</code> by page <i>importmap</i></p>
|
|
115
|
+
<template>
|
|
116
|
+
<custom-element>
|
|
117
|
+
<template>
|
|
118
|
+
<module-url slice="lib-url" src="embed-lib"></module-url>
|
|
119
|
+
<if test="//lib-url/@error">
|
|
120
|
+
<p>error: <b>{//lib-url/@error}</b></p>
|
|
121
|
+
</if>
|
|
122
|
+
check the link:
|
|
123
|
+
<a href="{//lib-url}">
|
|
124
|
+
<custom-element src="embed-lib#embed-lib-component">
|
|
125
|
+
failed to load
|
|
126
|
+
</custom-element>
|
|
127
|
+
</a>
|
|
128
|
+
</template>
|
|
129
|
+
</custom-element>
|
|
130
|
+
|
|
131
|
+
</template>
|
|
132
|
+
</html-demo-element>
|
|
133
|
+
|
|
134
|
+
<html-demo-element legend="3. module by symbolic name with missing importmap entry"
|
|
135
|
+
description="should render error message and `failed to load` broken link "
|
|
136
|
+
>
|
|
137
|
+
<p>As <code>fakedemo-lib</code> is not in importmaps, the symbolic name is not resolved and renders the error</p>
|
|
138
|
+
|
|
139
|
+
<template>
|
|
140
|
+
<custom-element>
|
|
141
|
+
<template>
|
|
142
|
+
<module-url slice="lib-url" src="fakedemo-lib/embed-lib.html"></module-url>
|
|
143
|
+
<if test="//lib-url/@error">
|
|
144
|
+
<p>error: <b>{//lib-url/@error}</b></p>
|
|
145
|
+
</if>
|
|
146
|
+
the link is broken:
|
|
147
|
+
<a href="{//lib-url}">
|
|
148
|
+
<custom-element src="fakedemo-lib/embed-lib.html#embed-lib-component">
|
|
149
|
+
failed to load
|
|
150
|
+
</custom-element>
|
|
151
|
+
</a>
|
|
152
|
+
</template>
|
|
153
|
+
</custom-element>
|
|
154
|
+
</template>
|
|
155
|
+
</html-demo-element>
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
<html-demo-element legend="4. module path by symbolic name"
|
|
159
|
+
description="should render two smiley images and links should open matching page"
|
|
160
|
+
>
|
|
161
|
+
<p><code>lib-root</code> resolved to <code>lib-dir</code> by page <i>importmap</i></p>
|
|
162
|
+
<template>
|
|
163
|
+
<custom-element>
|
|
164
|
+
<template>
|
|
165
|
+
<module-url slice="lib-url" src="lib-root/embed-lib.html#embed-relative-hash"></module-url>
|
|
166
|
+
<module-url slice="img-url" src="lib-root/Smiley.svg"></module-url>
|
|
167
|
+
<if test="//lib-url/@error">
|
|
168
|
+
<p>error: <b>{//lib-url/@error}</b></p>
|
|
169
|
+
</if>
|
|
170
|
+
check the link:
|
|
171
|
+
<a href="{//lib-url}"> lib-root/embed-lib.html#embed-relative-hash <img src="{//img-url}" alt=""/></a>
|
|
172
|
+
<custom-element src="lib-root/embed-lib.html#embed-relative-hash">
|
|
173
|
+
failed to load
|
|
174
|
+
</custom-element>
|
|
175
|
+
|
|
176
|
+
</template>
|
|
177
|
+
</custom-element>
|
|
178
|
+
|
|
179
|
+
</template>
|
|
180
|
+
</html-demo-element>
|
|
181
|
+
|
|
182
|
+
<html-demo-element legend="5. module path by symbolic name to internal link within lib"
|
|
183
|
+
description="should render '👍 from embed-relative-file' and Vulcan Salute 🖖. Links should open matching page "
|
|
184
|
+
>
|
|
185
|
+
<template>
|
|
186
|
+
<custom-element>
|
|
187
|
+
<template>
|
|
188
|
+
<module-url slice="lib-url" src="lib-root/embed-lib.html#embed-relative-file"></module-url>
|
|
189
|
+
<if test="//lib-url/@error">
|
|
190
|
+
<p>error: <b>{//lib-url/@error}</b></p>
|
|
191
|
+
</if>
|
|
192
|
+
check the link:
|
|
193
|
+
<a href="{//lib-url}"> lib-root/embed-lib.html#embed-relative-file </a>
|
|
194
|
+
<custom-element src="lib-root/embed-lib.html#embed-relative-file">
|
|
195
|
+
failed to load
|
|
196
|
+
</custom-element>
|
|
197
|
+
|
|
198
|
+
</template>
|
|
199
|
+
</custom-element>
|
|
200
|
+
|
|
201
|
+
</template>
|
|
202
|
+
</html-demo-element>
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
<html-demo-element src="./lib-dir/embed-lib.html"
|
|
206
|
+
legend="./lib-dir/embed-lib.html"
|
|
207
|
+
description="resides within ./lib-dir and serves a sample of module with multiple templates"
|
|
208
|
+
>
|
|
209
|
+
|
|
210
|
+
</html-demo-element>
|
|
211
|
+
|
|
212
|
+
<script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
|
|
213
|
+
|
|
214
|
+
</body>
|
|
215
|
+
</html>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>DOM merge - Declarative Custom Element implementation demo</title>
|
|
6
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
7
|
+
<script type="importmap">
|
|
8
|
+
{
|
|
9
|
+
"imports": {
|
|
10
|
+
"@epa-wg/custom-element/": "../",
|
|
11
|
+
"@epa-wg/custom-element-dist/": "../"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
<script type="module" src="../http-request.js"></script>
|
|
16
|
+
<script type="module" src="../location-element.js"></script>
|
|
17
|
+
<script type="module" src="../custom-element.js"></script>
|
|
18
|
+
<style>
|
|
19
|
+
@import "./demo.css";
|
|
20
|
+
dt{ font-weight: bold}
|
|
21
|
+
dd{ padding: 0;}
|
|
22
|
+
h1,h3{ margin: 0;}
|
|
23
|
+
nav{ gap:0; }
|
|
24
|
+
</style>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
|
|
28
|
+
<nav>
|
|
29
|
+
<a href="../index.html"><h3><code>custom-element</code> demo</h3></a>
|
|
30
|
+
<h1><code>npm-version</code> Declarative Custom Element</h1>
|
|
31
|
+
|
|
32
|
+
<dl>
|
|
33
|
+
<dt>Attributes</dt>
|
|
34
|
+
<dd><code>package-name</code> NPM package name</dd>
|
|
35
|
+
<dd><code>current-version</code> version to be initially selected </dd>
|
|
36
|
+
<dd><code>value</code> user selection </dd>
|
|
37
|
+
|
|
38
|
+
<dt>Events</dt>
|
|
39
|
+
<dd><code>change</code> triggered when <code>value</code> attribute changed</dd>
|
|
40
|
+
|
|
41
|
+
<dt>Slots</dt>
|
|
42
|
+
<dd><code>label</code> defaults to <code>{$package-name} version:</code> </dd>
|
|
43
|
+
</dl>
|
|
44
|
+
|
|
45
|
+
</nav>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<html-demo-element legend="1. NPM package version picker"
|
|
49
|
+
description="defaults, last version should be preselected">
|
|
50
|
+
<template>
|
|
51
|
+
<custom-element src="./npm-versions.html#npm-version"
|
|
52
|
+
package-name="@epa-wg/custom-element-dist"></custom-element>
|
|
53
|
+
</template>
|
|
54
|
+
</html-demo-element>
|
|
55
|
+
|
|
56
|
+
<html-demo-element legend="2. preselected NPM package version picker"
|
|
57
|
+
description="version 22 should be selected and date shown">
|
|
58
|
+
<template>
|
|
59
|
+
<custom-element tag="custom-element-version" src="./npm-versions.html#npm-version"></custom-element>
|
|
60
|
+
<custom-element-version
|
|
61
|
+
package-name="@epa-wg/custom-element"
|
|
62
|
+
current-version="0.0.22"
|
|
63
|
+
show-date="true"
|
|
64
|
+
></custom-element-version>
|
|
65
|
+
</template>
|
|
66
|
+
</html-demo-element>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<html-demo-element legend="3. value attribute changed and propagated to slice"
|
|
70
|
+
description="upon selection change the version should be shown as 'selected-version' slice value">
|
|
71
|
+
<template>
|
|
72
|
+
<custom-element tag="npm-version" src="./npm-versions.html#npm-version"></custom-element>
|
|
73
|
+
|
|
74
|
+
<custom-element >
|
|
75
|
+
<template>
|
|
76
|
+
<npm-version slice="selected-version" package-name="@epa-wg/custom-element"></npm-version>
|
|
77
|
+
<p><code>selected-version</code> slice: {//selected-version/@value}</p>
|
|
78
|
+
</template>
|
|
79
|
+
</custom-element>
|
|
80
|
+
|
|
81
|
+
</template>
|
|
82
|
+
</html-demo-element>
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<html-demo-element legend="4. label slot override"
|
|
86
|
+
description="upon selection change the version should be shown as 'selected-version' slice value">
|
|
87
|
+
<template>
|
|
88
|
+
<custom-element tag="npm-version-1" src="./npm-versions.html#npm-version"></custom-element>
|
|
89
|
+
|
|
90
|
+
<custom-element >
|
|
91
|
+
<template>
|
|
92
|
+
<npm-version-1 slice="selected" package-name="@epa-wg/custom-element">
|
|
93
|
+
<i slot="label">select:</i>
|
|
94
|
+
</npm-version-1>
|
|
95
|
+
<p><code>selected-version</code> slice: {//selected}</p>
|
|
96
|
+
</template>
|
|
97
|
+
</custom-element>
|
|
98
|
+
|
|
99
|
+
</template>
|
|
100
|
+
</html-demo-element>
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
<html-demo-element legend="5. control version in URL"
|
|
104
|
+
description="">
|
|
105
|
+
1. <button onclick="window.location.hash = `#@epa-wg/custom-element-dist@0.0.25/storybook-static/index.html`">set in page URL to version 0.0.25</button><br/>
|
|
106
|
+
2. switch the package version in select and observe the URL change.
|
|
107
|
+
<template>
|
|
108
|
+
<custom-element src="@epa-wg/custom-element-dist/demo/npm-versions.html#npm-version-to-url"
|
|
109
|
+
package-name="@epa-wg/custom-element-dist"
|
|
110
|
+
></custom-element>
|
|
111
|
+
</template>
|
|
112
|
+
</html-demo-element>
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
<script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js" hidden></script>
|
|
116
|
+
|
|
117
|
+
</body>
|
|
118
|
+
</html>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>npm-version template</title>
|
|
6
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
7
|
+
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<h1><code>npm-version</code> template</h1>
|
|
12
|
+
<a href="./npm-versions-demo.html">docs</a>
|
|
13
|
+
<template id="npm-version">
|
|
14
|
+
<attribute name="package-name"></attribute>
|
|
15
|
+
<attribute name="current-version" aria-description="version to select"></attribute>
|
|
16
|
+
<attribute name="show-date" aria-description="set to 'true' to append the date to the version"></attribute>
|
|
17
|
+
<attribute name="value" select="//selected-version"></attribute>
|
|
18
|
+
<http-request
|
|
19
|
+
url="https://registry.npmjs.org/{$package-name}"
|
|
20
|
+
method="GET"
|
|
21
|
+
header-accept="application/json"
|
|
22
|
+
slice="versions-ajax"></http-request>
|
|
23
|
+
|
|
24
|
+
<label>
|
|
25
|
+
<slot name="label"><var>{$package-name}</var> version:</slot>
|
|
26
|
+
<xhtml:select slice="selected-version" autocomplete="off" name="version">
|
|
27
|
+
<for-each select="//versions/*">
|
|
28
|
+
<option value="{./@version}">
|
|
29
|
+
<variable name="item-version">{./@version}</variable>
|
|
30
|
+
{ $item-version }<if test="$show-date = 'true' "> - { substring( //time/*[@dce-object-name = $item-version ], 1,10)}</if>
|
|
31
|
+
</option>
|
|
32
|
+
</for-each>
|
|
33
|
+
<for-each select="//versions/*">
|
|
34
|
+
<if test="./@version = $current-version">
|
|
35
|
+
<option selected value="{./@version}">
|
|
36
|
+
<variable name="item-version">{./@version}</variable>
|
|
37
|
+
{ $item-version }<if test="$show-date = 'true' "> - { substring( //time/*[@dce-object-name = $item-version ], 1,10)}</if>
|
|
38
|
+
</option>
|
|
39
|
+
</if>
|
|
40
|
+
</for-each>
|
|
41
|
+
</xhtml:select>
|
|
42
|
+
</label>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<template id="npm-version-to-url">
|
|
46
|
+
<attribute name="package-name"></attribute>
|
|
47
|
+
<attribute name="value" select="//selected-version"></attribute>
|
|
48
|
+
<variable name="url" select="//window-location/value/@href"></variable>
|
|
49
|
+
|
|
50
|
+
<variable name="url-version">0{
|
|
51
|
+
substring-before(substring-after(substring($url, string-length(substring-before($url, '/')) -
|
|
52
|
+
string-length(substring-before(substring-before($url, '/'), '@0')) + 2), '@0'), '/')
|
|
53
|
+
}</variable>
|
|
54
|
+
|
|
55
|
+
<location-element slice="window-location" live>
|
|
56
|
+
<if test="//selected-version">
|
|
57
|
+
<if test=" not(//url-version = //selected-version ) ">
|
|
58
|
+
<attribute name="src">{ concat( substring-before($url, $url-version),
|
|
59
|
+
//selected-version,
|
|
60
|
+
substring-after($url, $url-version) ) }
|
|
61
|
+
</attribute>
|
|
62
|
+
<attribute name="method">location.href</attribute>
|
|
63
|
+
</if>
|
|
64
|
+
</if>
|
|
65
|
+
</location-element>
|
|
66
|
+
|
|
67
|
+
<http-request
|
|
68
|
+
url="https://registry.npmjs.org/{$package-name}"
|
|
69
|
+
method="GET"
|
|
70
|
+
header-accept="application/json"
|
|
71
|
+
slice="versions-ajax"></http-request>
|
|
72
|
+
|
|
73
|
+
<label>
|
|
74
|
+
<slot name="label">{$package-name} version:</slot>
|
|
75
|
+
<xhtml:select slice="selected-version" autocomplete="off" name="version">
|
|
76
|
+
<for-each select="//versions/*">
|
|
77
|
+
<option value="{./@version}">
|
|
78
|
+
<variable name="item-version">{./@version}</variable>
|
|
79
|
+
{ $item-version } - { substring( //time/*[@dce-object-name = $item-version ], 1,10)}
|
|
80
|
+
</option>
|
|
81
|
+
</for-each>
|
|
82
|
+
<for-each select="//versions/*">
|
|
83
|
+
<if test="./@version = $url-version">
|
|
84
|
+
<option selected value="{./@version}">
|
|
85
|
+
<variable name="item-version">{./@version}</variable>
|
|
86
|
+
{ $item-version } - { substring( //time/*[@dce-object-name = $item-version ], 1,10)}
|
|
87
|
+
</option>
|
|
88
|
+
</if>
|
|
89
|
+
</for-each>
|
|
90
|
+
</xhtml:select>
|
|
91
|
+
</label>
|
|
92
|
+
</template>
|
|
93
|
+
</body>
|
|
94
|
+
</html>
|
package/demo/s.xml
CHANGED
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<span xmlns="http://www.w3.org/1999/xhtml" slot=""></span>
|
|
5
|
-
<button xmlns="http://www.w3.org/1999/xhtml" value="#dce4" slice="set-button" slice-event="click" slot="">set
|
|
6
|
-
</button>
|
|
7
|
-
<span xmlns="http://www.w3.org/1999/xhtml" slot=""></span>
|
|
8
|
-
<xsl:if xmlns="http://www.w3.org/1999/xhtml" test="//form-data/url" slot="">
|
|
9
|
-
<location-element method="{$selected-method}" src="{//form-data/url}"></location-element>
|
|
10
|
-
{$selected-method} - {//form-data/url}
|
|
11
|
-
</xsl:if>
|
|
12
|
-
<span xmlns="http://www.w3.org/1999/xhtml" slot=""></span>
|
|
13
|
-
</payload>
|
|
14
|
-
<attributes>
|
|
15
|
-
<tag>dce-9d95a532-8e54-414a-9077-08799530a637</tag>
|
|
16
|
-
</attributes>
|
|
17
|
-
<dataset/>
|
|
18
|
-
<slice>
|
|
19
|
-
<set-button xmlns="" value="#dce4" slice="set-button" slice-event="click" data-dce-id="2" validation-message="">
|
|
20
|
-
<event isTrusted="true" sliceProcessed="1" pointerId="1" width="1" height="1" pressure="0" tiltX="0"
|
|
21
|
-
tiltY="0" azimuthAngle="0" altitudeAngle="1.5707963267948966" tangentialPressure="0" twist="0"
|
|
22
|
-
pointerType="mouse" isPrimary="false" screenX="47" screenY="538" clientX="47" clientY="451"
|
|
23
|
-
ctrlKey="false" shiftKey="false" altKey="false" metaKey="false" button="0" buttons="0" pageX="47"
|
|
24
|
-
pageY="451" x="47" y="451" offsetX="20" offsetY="8" movementX="0" movementY="0" layerX="47"
|
|
25
|
-
layerY="451" detail="1" which="1" type="click" eventPhase="2" bubbles="true" cancelable="true"
|
|
26
|
-
defaultPrevented="false" composed="true" timeStamp="11628.100000143051" returnValue="true"
|
|
27
|
-
cancelBubble="false" NONE="0" CAPTURING_PHASE="1" AT_TARGET="2" BUBBLING_PHASE="3">
|
|
28
|
-
<relatedTarget/>
|
|
29
|
-
<fromElement/>
|
|
30
|
-
<toElement/>
|
|
31
|
-
<sourceCapabilities firesTouchEvents="false"/>
|
|
32
|
-
</event>
|
|
33
|
-
#dce4
|
|
34
|
-
</set-button>
|
|
35
|
-
</slice>
|
|
36
|
-
</datadom>
|
|
1
|
+
<body xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><h4>embed-1.html</h4>
|
|
2
|
+
<custom-element><template>🖖</template></custom-element>
|
|
3
|
+
</body>
|