@epa-wg/custom-element-dist 0.0.21 → 0.0.23
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/.idea/.gitignore +8 -0
- package/README.md +4 -4
- package/coverage/coverage-final.json +13 -11
- package/coverage/index.html +30 -30
- package/coverage/src/custom-element/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js.html +603 -420
- package/coverage/src/custom-element/http-request.js.html +10 -10
- package/coverage/src/custom-element/index.html +18 -18
- package/coverage/src/custom-element/local-storage.js.html +2 -2
- package/coverage/src/custom-element/location-element.js.html +1 -1
- package/coverage/src/index.html +1 -1
- package/coverage/src/mocks/handlers.ts.html +1 -1
- package/coverage/src/mocks/index.html +1 -1
- package/coverage/src/stories/{css.stories.ts → attributes.test.stories.ts}/coverage.svg +1 -1
- package/coverage/src/stories/{attributes.stories.ts.html → attributes.test.stories.ts.html} +113 -83
- package/coverage/src/stories/coverage.svg +1 -1
- package/coverage/src/stories/css.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/{css.stories.ts.html → css.test.stories.ts.html} +122 -65
- package/coverage/src/stories/dom-merge.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/{dom-merge.stories.ts.html → dom-merge.test.stories.ts.html} +118 -70
- package/coverage/src/stories/external-template.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/{external-template.stories.ts.html → external-template.test.stories.ts.html} +180 -150
- package/coverage/src/stories/form.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/form.test.stories.ts.html +655 -0
- package/coverage/src/stories/http-request.stories.ts.html +7 -7
- package/coverage/src/stories/index.html +118 -88
- package/coverage/src/stories/{dom-merge.stories.ts → local-storage.test.stories.ts}/coverage.svg +1 -1
- package/coverage/src/stories/{local-storage.stories.ts.html → local-storage.test.stories.ts.html} +475 -439
- package/coverage/src/stories/{external-template.stories.ts → location-element.test.stories.ts}/coverage.svg +1 -1
- package/coverage/src/stories/{location-element.stories.ts.html → location-element.test.stories.ts.html} +134 -98
- package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/slice-events.test.stories.ts.html +685 -0
- package/coverage/src/stories/slots.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/slots.test.stories.ts.html +736 -0
- package/coverage/src/stories/{renderPlay.ts.html → testStoryBook.ts.html} +44 -26
- package/coverage/src/sum.ts.html +1 -1
- package/dist/custom-element-BISbI4SU.js +463 -0
- package/dist/custom-element-N-sWiqGK.cjs +53 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +2 -2
- package/dist/mockServiceWorker.js +1 -1
- package/package.json +4 -4
- package/public/mockServiceWorker.js +1 -1
- package/src/custom-element/custom-element.d.ts +4 -0
- package/src/custom-element/custom-element.js +103 -42
- package/src/custom-element/demo/a.html +38 -41
- package/src/custom-element/demo/b.html +13 -0
- package/src/custom-element/demo/data-slices.html +32 -0
- package/src/custom-element/demo/form.html +240 -0
- package/src/custom-element/demo/s.xml +11 -14
- package/src/custom-element/demo/s.xslt +22 -38
- package/src/custom-element/demo/s1.xslt +60 -0
- package/src/custom-element/ide/customData-dce.json +14 -1
- package/src/custom-element/ide/web-types-dce.json +6 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +1 -0
- package/src/custom-element.test.ts +24 -8
- package/src/stories/{attributes.stories.ts → attributes.test.stories.ts} +19 -9
- package/src/stories/{css.stories.ts → css.test.stories.ts} +28 -9
- package/src/stories/{dom-merge.stories.ts → dom-merge.test.stories.ts} +19 -3
- package/src/stories/{external-template.stories.ts → external-template.test.stories.ts} +13 -3
- package/src/stories/form.test.stories.ts +190 -0
- package/src/stories/http-request.stories.ts +6 -6
- package/src/stories/http-request.test.ts +0 -9
- package/src/stories/{local-storage.stories.ts → local-storage.test.stories.ts} +24 -12
- package/src/stories/{location-element.stories.ts → location-element.test.stories.ts} +21 -9
- package/src/stories/{slice-events.stories.ts → slice-events.test.stories.ts} +88 -5
- package/src/stories/slots.test.stories.ts +217 -0
- package/src/stories/testStoryBook.ts +28 -0
- package/storybook-static/assets/{Color-RQJUDNI5-C4yZhNbM.js → Color-PRSJMWNM-BD_Ds9NW.js} +1 -1
- package/storybook-static/assets/{Configure-C7d36rng.js → Configure-70I_VApa.js} +1 -1
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-9dn0-HCP.js +2 -0
- package/storybook-static/assets/WithTooltip-KJL26V4Q-C6g5GOU9.js +1 -0
- package/storybook-static/assets/{attributes.stories-ZB0RTY1d.js → attributes.test.stories-BEOraI4E.js} +22 -21
- package/storybook-static/assets/css.test.stories-D9WaxrEv.js +96 -0
- package/storybook-static/assets/custom-element-BV8-hRQS.js +219 -0
- package/storybook-static/assets/{dom-merge.stories-CgHZUABU.js → dom-merge.test.stories-BhbNeum_.js} +5 -6
- package/storybook-static/assets/{entry-preview-CQqNFx4W.js → entry-preview-DrgzXgwT.js} +1 -1
- package/storybook-static/assets/{entry-preview-docs-CWgqLfd3.js → entry-preview-docs-Bxv0qQWs.js} +1 -1
- package/storybook-static/assets/{external-template.stories-DtSLMxvg.js → external-template.test.stories-Bpr_wxBo.js} +23 -24
- package/storybook-static/assets/form.test.stories-3tURbEdv.js +250 -0
- package/storybook-static/assets/{formatter-B5HCVTEV-tKeEfJA9.js → formatter-2WMMO6ZP-6IvBq34u.js} +5 -5
- package/storybook-static/assets/http-request.stories-8K_qSs8C.js +300 -0
- package/storybook-static/assets/iframe-zdt9kuj6.js +2 -0
- package/storybook-static/assets/index-B3oZkK3F.js +1 -0
- package/storybook-static/assets/index-C30JwJMK.js +548 -0
- package/storybook-static/assets/index-CVRyq5ci.js +27 -0
- package/storybook-static/assets/index-DXimoRZY.js +1 -0
- package/storybook-static/assets/{index-DnEJ_bKa.js → index-DhXZyjEd.js} +1 -1
- package/storybook-static/assets/index-DuIEV_9C.js +13 -0
- package/storybook-static/assets/{lit-element-B4_0akdT.js → lit-element-CenEXOuS.js} +2 -2
- package/storybook-static/assets/{local-storage.stories-BkO6djDz.js → local-storage.test.stories-CtisAQBB.js} +28 -24
- package/storybook-static/assets/{location-element.stories-DCIOUd0D.js → location-element.test.stories-5O_t_m4Y.js} +11 -11
- package/storybook-static/assets/preview-4Up_z4Em.js +7 -0
- package/storybook-static/assets/preview-BKCN0mOr.js +1 -0
- package/storybook-static/assets/{preview-CkgAD_DE.js → preview-D0eCfQft.js} +2 -2
- package/storybook-static/assets/preview-DRnyIGXK.js +48 -0
- package/storybook-static/assets/preview-FpHGYA1q.js +1 -0
- package/storybook-static/assets/{preview-PxUn-cIn.js → preview-TCN6m6T-.js} +1 -1
- package/storybook-static/assets/slice-events.test.stories-BSXCLIA5.js +231 -0
- package/storybook-static/assets/slots.test.stories-B1vqfHmN.js +214 -0
- package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-DpPBKyTO.js +1 -0
- package/storybook-static/iframe.html +153 -10
- package/storybook-static/index.html +1 -1
- package/storybook-static/index.json +1 -1
- package/storybook-static/mockServiceWorker.js +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +35 -29
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +1 -1
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +5 -5
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +35 -35
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/interactions-10/manager-bundle.js +18 -16
- package/storybook-static/sb-addons/links-1/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +1 -1
- package/storybook-static/sb-manager/WithTooltip-KJL26V4Q-5LS5AN27.js +1 -0
- package/storybook-static/sb-manager/{chunk-S4VOIVUE.js → chunk-B3YDJJJH.js} +9 -9
- package/storybook-static/sb-manager/{chunk-FEE35O7J.js → chunk-BLWCBWKL.js} +3 -3
- package/storybook-static/sb-manager/{chunk-XCO5HRLK.js → chunk-GUVK2GTO.js} +3 -3
- package/storybook-static/sb-manager/chunk-LFRML3ZV.js +186 -0
- package/storybook-static/sb-manager/chunk-MC7RAF2B.js +274 -0
- package/storybook-static/sb-manager/{chunk-XP3HGWTR.js → chunk-ZR5JZWHI.js} +1 -1
- package/storybook-static/sb-manager/{formatter-B5HCVTEV-7DCBOGO6.js → formatter-2WMMO6ZP-JI7RHVTW.js} +1 -1
- package/storybook-static/sb-manager/globals-module-info.js +1 -1
- package/storybook-static/sb-manager/globals-runtime.js +1 -1
- package/storybook-static/sb-manager/index.js +1 -1
- package/storybook-static/sb-manager/runtime.js +1 -1
- package/storybook-static/sb-manager/{syntaxhighlighter-JOJW2KGS-VF6EEVPI.js → syntaxhighlighter-BP7B2CQK-WOJYHKQR.js} +1 -1
- package/storybook-static/sb-preview/runtime.js +28 -11
- package/tsconfig.json +31 -21
- package/vite.config.js +5 -5
- package/yarn.lock +10242 -0
- package/.vscode/settings.json +0 -24
- package/coverage/src/stories/local-storage.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/location-element.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/renderPlay.ts/coverage.svg +0 -10
- package/coverage/src/stories/slice-events.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/slice-events.stories.ts.html +0 -436
- package/dist/custom-element-B4v-KaIh.cjs +0 -53
- package/dist/custom-element-_g0GTup2.js +0 -436
- package/src/stories/attributes.test.ts +0 -14
- package/src/stories/css.test.ts +0 -12
- package/src/stories/dom-merge.test.ts +0 -12
- package/src/stories/external-template.test.ts +0 -12
- package/src/stories/local-storage.test.ts +0 -12
- package/src/stories/location-element.test.ts +0 -14
- package/src/stories/renderPlay.ts +0 -22
- package/src/stories/slice-events.test.ts +0 -12
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-BLMupvSb.js +0 -2
- package/storybook-static/assets/WithTooltip-Y7J54OF7-BAQSPSFk.js +0 -1
- package/storybook-static/assets/css.stories-CLSX-Xxd.js +0 -86
- package/storybook-static/assets/custom-element-BLZZ00dz.js +0 -53
- package/storybook-static/assets/http-request.stories-CUzlXO89.js +0 -300
- package/storybook-static/assets/iframe-gCvlWuoC.js +0 -2
- package/storybook-static/assets/index-CBQwM6ST.js +0 -508
- package/storybook-static/assets/index-CDavW7r9.js +0 -193
- package/storybook-static/assets/index-CQA5dlr6.js +0 -13
- package/storybook-static/assets/index-DgaNIR0t.js +0 -1
- package/storybook-static/assets/index-Dkj0J1ds.js +0 -1
- package/storybook-static/assets/preview-C6t8KBFr.js +0 -1
- package/storybook-static/assets/preview-CYD85dwb.js +0 -7
- package/storybook-static/assets/preview-D8LadFCz.js +0 -48
- package/storybook-static/assets/preview-DNpCpRPf.js +0 -1
- package/storybook-static/assets/slice-events.stories-DXKjXI37.js +0 -115
- package/storybook-static/assets/syntaxhighlighter-JOJW2KGS-C04pIVD3.js +0 -1
- package/storybook-static/sb-manager/WithTooltip-Y7J54OF7-CEHQ77YF.js +0 -1
- package/storybook-static/sb-manager/chunk-E3WK6ZOZ.js +0 -234
- package/storybook-static/sb-manager/chunk-E6ABNH5R.js +0 -183
- /package/coverage/src/stories/{attributes.stories.ts → testStoryBook.ts}/coverage.svg +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<html lang="en">
|
|
4
4
|
|
|
5
5
|
<head>
|
|
6
|
-
<title>Code coverage report for src/stories/
|
|
6
|
+
<title>Code coverage report for src/stories/testStoryBook.ts</title>
|
|
7
7
|
<meta charset="utf-8" />
|
|
8
8
|
<link rel="stylesheet" href="../../prettify.css" />
|
|
9
9
|
<link rel="stylesheet" href="../../base.css" />
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
<body>
|
|
20
20
|
<div class='wrapper'>
|
|
21
21
|
<div class='pad1'>
|
|
22
|
-
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/stories</a>
|
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/stories</a> testStoryBook.ts</h1>
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
26
|
<span class="strong">100% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>14/14</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
40
|
<span class="strong">100% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>8/8</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
47
|
<span class="strong">100% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>11/11</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -85,49 +85,67 @@
|
|
|
85
85
|
<a name='L20'></a><a href='#L20'>20</a>
|
|
86
86
|
<a name='L21'></a><a href='#L21'>21</a>
|
|
87
87
|
<a name='L22'></a><a href='#L22'>22</a>
|
|
88
|
-
<a name='L23'></a><a href='#L23'>23</a
|
|
88
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
|
89
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
|
90
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
|
91
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
|
92
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
|
93
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
|
94
|
+
<a name='L29'></a><a href='#L29'>29</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
89
95
|
<span class="cline-any cline-neutral"> </span>
|
|
90
96
|
<span class="cline-any cline-neutral"> </span>
|
|
91
97
|
<span class="cline-any cline-neutral"> </span>
|
|
92
98
|
<span class="cline-any cline-neutral"> </span>
|
|
99
|
+
<span class="cline-any cline-yes">43x</span>
|
|
100
|
+
<span class="cline-any cline-yes">43x</span>
|
|
93
101
|
<span class="cline-any cline-neutral"> </span>
|
|
102
|
+
<span class="cline-any cline-yes">43x</span>
|
|
103
|
+
<span class="cline-any cline-yes">43x</span>
|
|
94
104
|
<span class="cline-any cline-neutral"> </span>
|
|
95
|
-
<span class="cline-any cline-yes">28x</span>
|
|
96
|
-
<span class="cline-any cline-yes">28x</span>
|
|
97
105
|
<span class="cline-any cline-neutral"> </span>
|
|
98
106
|
<span class="cline-any cline-neutral"> </span>
|
|
99
|
-
<span class="cline-any cline-yes">28x</span>
|
|
100
|
-
<span class="cline-any cline-yes">28x</span>
|
|
101
107
|
<span class="cline-any cline-neutral"> </span>
|
|
102
108
|
<span class="cline-any cline-neutral"> </span>
|
|
109
|
+
<span class="cline-any cline-yes">9x</span>
|
|
103
110
|
<span class="cline-any cline-neutral"> </span>
|
|
104
111
|
<span class="cline-any cline-neutral"> </span>
|
|
112
|
+
<span class="cline-any cline-yes">9x</span>
|
|
105
113
|
<span class="cline-any cline-neutral"> </span>
|
|
106
|
-
<span class="cline-any cline-yes">
|
|
107
|
-
<span class="cline-any cline-yes">
|
|
108
|
-
<span class="cline-any cline-yes">
|
|
114
|
+
<span class="cline-any cline-yes">52x</span>
|
|
115
|
+
<span class="cline-any cline-yes">52x</span>
|
|
116
|
+
<span class="cline-any cline-yes">9x</span>
|
|
117
|
+
<span class="cline-any cline-yes">43x</span>
|
|
109
118
|
<span class="cline-any cline-neutral"> </span>
|
|
110
|
-
<span class="cline-any cline-neutral"> </span
|
|
119
|
+
<span class="cline-any cline-neutral"> </span>
|
|
120
|
+
<span class="cline-any cline-yes">9x</span>
|
|
121
|
+
<span class="cline-any cline-neutral"> </span>
|
|
122
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import type {StoryObj, Meta} from '@storybook/web-components';
|
|
111
123
|
import {it} from 'vitest';
|
|
112
124
|
|
|
113
|
-
|
|
114
|
-
export async function renderPlay<TProps>(story: StoryObj, meta:{render: (args: TProps)=>string })
|
|
125
|
+
async function playStory( story: StoryObj, meta: Meta )
|
|
115
126
|
{
|
|
116
|
-
// @ts-ignore
|
|
117
127
|
document.body.innerHTML = meta.render(story.args);
|
|
118
|
-
await new Promise(resolve => setTimeout(async ()
|
|
128
|
+
await new Promise( (resolve) => setTimeout(async ()=>
|
|
119
129
|
{
|
|
120
|
-
|
|
121
|
-
await story.play({canvasElement: document.body.firstElementChild as HTMLElement});
|
|
130
|
+
await story.play({canvasElement: document.body.lastElementChild});
|
|
122
131
|
resolve(0);
|
|
123
|
-
},
|
|
132
|
+
},0))
|
|
124
133
|
}
|
|
125
134
|
|
|
126
|
-
export function
|
|
135
|
+
export async function testStoryBook<TProps>( mod: Record<string, StoryObj>, meta: Meta )
|
|
127
136
|
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
const {describe, it } = await import('vitest');
|
|
138
|
+
function playStories( mod: Record<string, StoryObj>, meta: Meta )
|
|
139
|
+
{
|
|
140
|
+
Object.keys(mod).map(name=>
|
|
141
|
+
{
|
|
142
|
+
const story = mod[name];
|
|
143
|
+
if( !story.play )
|
|
144
|
+
return;
|
|
145
|
+
it( name, async()=>playStory(story,meta));
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
describe( meta.title, async () => playStories(mod, meta) )
|
|
131
149
|
}
|
|
132
150
|
</pre></td></tr></table></pre>
|
|
133
151
|
|
|
@@ -136,7 +154,7 @@ export function playStories<TProps>( Stories: any, meta:{ render: (args: T
|
|
|
136
154
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
137
155
|
Code coverage generated by
|
|
138
156
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
139
|
-
at 2024-
|
|
157
|
+
at 2024-06-27T03:24:38.495Z
|
|
140
158
|
</div>
|
|
141
159
|
<script src="../../prettify.js"></script>
|
|
142
160
|
<script>
|
package/coverage/src/sum.ts.html
CHANGED
|
@@ -79,7 +79,7 @@ export function sum(a: number, b: number) {
|
|
|
79
79
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
80
80
|
Code coverage generated by
|
|
81
81
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
82
|
-
at 2024-
|
|
82
|
+
at 2024-06-27T03:24:38.495Z
|
|
83
83
|
</div>
|
|
84
84
|
<script src="../prettify.js"></script>
|
|
85
85
|
<script>
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
const F = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xhtml", se = "http://exslt.org/common", x = (e, l) => e.getAttribute?.(l), W = (e) => e.nodeType === 3, le = (e) => typeof e == "string", ne = (e) => e && typeof e.nodeType == "number", N = (e, l = "", t = document) => ((s) => (l && s.append(S(t.ownerDocument || t, l)), s))((t.ownerDocument || t).createElement(e)), S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
|
|
2
|
+
for (; e.firstChild; ) e.firstChild.remove();
|
|
3
|
+
return e;
|
|
4
|
+
}, U = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), K(e)), ae = (e) => (e?.setAttribute("xmlns:xsl", F), e), ie = (e) => (e?.setAttribute("xmlns:xhtml", q), ae(e)), Y = (e, l) => {
|
|
5
|
+
const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
|
|
6
|
+
for (let s of e.attributes)
|
|
7
|
+
t.setAttribute(s.name, s.value);
|
|
8
|
+
for (; e.firstChild; )
|
|
9
|
+
t.append(e.firstChild);
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
function M(e) {
|
|
13
|
+
return new DOMParser().parseFromString(e, "application/xml");
|
|
14
|
+
}
|
|
15
|
+
function H(e) {
|
|
16
|
+
return new XMLSerializer().serializeToString(e);
|
|
17
|
+
}
|
|
18
|
+
function X(e, l, t, s) {
|
|
19
|
+
const n = (h) => e.ownerDocument.createElement(h), c = ((h, p, m) => (p.append(m = n(h)), m))(l, e);
|
|
20
|
+
return [...t].forEach((h) => c.append(s(h))), c;
|
|
21
|
+
}
|
|
22
|
+
function re(e) {
|
|
23
|
+
return e.slot || (e.setAttribute || (e = N("span", e.textContent.replaceAll(`
|
|
24
|
+
`, ""))), e.setAttribute("slot", "")), e;
|
|
25
|
+
}
|
|
26
|
+
function L(e, l, t) {
|
|
27
|
+
const s = typeof e;
|
|
28
|
+
if (s === "string")
|
|
29
|
+
return N(l, e, t);
|
|
30
|
+
if (s === "number")
|
|
31
|
+
return N(l, "" + e, t);
|
|
32
|
+
if (e instanceof Array) {
|
|
33
|
+
const i = N("array", "", t);
|
|
34
|
+
return e.map((c) => i.append(L(c, l, t))), i;
|
|
35
|
+
}
|
|
36
|
+
if (e instanceof FormData) {
|
|
37
|
+
const i = N("form-data", "", t);
|
|
38
|
+
for (const c of e)
|
|
39
|
+
i.append(L(c[1], c[0], t));
|
|
40
|
+
return i;
|
|
41
|
+
}
|
|
42
|
+
const n = N(l, "", t);
|
|
43
|
+
for (let i in e)
|
|
44
|
+
ne(e[i]) || typeof e[i] == "function" || e[i] instanceof Window || (typeof e[i] != "object" ? n.setAttribute(i, e[i]) : n.append(L(e[i], i, t)));
|
|
45
|
+
return n;
|
|
46
|
+
}
|
|
47
|
+
function G(e) {
|
|
48
|
+
if (C(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
|
|
49
|
+
const s = t.data, n = s.matchAll(/{([^}]*)}/g);
|
|
50
|
+
if (n) {
|
|
51
|
+
let i = 0, c = (p) => S(t, p), h = [];
|
|
52
|
+
if ([...n].forEach((p) => {
|
|
53
|
+
p.index > i && h.push(c(p.input.substring(i, p.index)));
|
|
54
|
+
const m = e.querySelector("value-of").cloneNode();
|
|
55
|
+
m.setAttribute("select", p[1]), h.push(m), i = p.index + p[0].length;
|
|
56
|
+
}), i < s.length && h.push(c(s.substring(i, s.length))), h.length) {
|
|
57
|
+
for (let p of h)
|
|
58
|
+
l.insertBefore(p, t);
|
|
59
|
+
l.removeChild(t);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})), "all" in e) {
|
|
63
|
+
let l = 1;
|
|
64
|
+
for (let t of e.all)
|
|
65
|
+
t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
|
|
66
|
+
}
|
|
67
|
+
return e;
|
|
68
|
+
}
|
|
69
|
+
function oe(e, l = "xsl:stylesheet") {
|
|
70
|
+
if (e.tagName === l || e.documentElement?.tagName === l)
|
|
71
|
+
return G(e);
|
|
72
|
+
const t = M(`<xsl:stylesheet version="1.0" xmlns:xsl="${F}" xmlns:xhtml="${q}" xmlns:exsl="${se}" exclude-result-prefixes="exsl" >
|
|
73
|
+
<xsl:output method="xml" />
|
|
74
|
+
<xsl:template match="/"><dce-root xmlns="${q}"><xsl:apply-templates select="*"/></dce-root></xsl:template>
|
|
75
|
+
<xsl:template match="*[name()='template']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
76
|
+
<xsl:template match="*"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
77
|
+
<xsl:template match="*[name()='svg']|*[name()='math']"><xsl:apply-templates mode="sanitize" select="."/></xsl:template>
|
|
78
|
+
<xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]"><xsl:copy><xsl:apply-templates mode="sanitize" select="@*"/><xsl:value-of select="text()"></xsl:value-of></xsl:copy></xsl:template>
|
|
79
|
+
<xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="@*"/><xsl:value-of select="text()"></xsl:value-of></xsl:element></xsl:template>
|
|
80
|
+
<xsl:template mode="sanitize" match="*|@*"><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></xsl:template>
|
|
81
|
+
<xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
|
|
82
|
+
<xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
|
|
83
|
+
<xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']"><dce-text><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></dce-text></xsl:template>
|
|
84
|
+
<xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
|
|
85
|
+
</xsl:stylesheet>`), s = new XSLTProcessor(), n = ((a) => {
|
|
86
|
+
C(a, "script", (g) => g.remove());
|
|
87
|
+
const o = a.content ?? a.firstElementChild?.content ?? a.body ?? a;
|
|
88
|
+
xe.forEach((g) => C(o, g, (b) => ye(b, o)));
|
|
89
|
+
const E = a.firstElementChild?.content || a.content, v = (g) => {
|
|
90
|
+
const b = M("<xhtml/>"), $ = b.importNode(g, !0);
|
|
91
|
+
return b.replaceChild($, b.documentElement), ie($);
|
|
92
|
+
};
|
|
93
|
+
if (E) {
|
|
94
|
+
const g = N("div");
|
|
95
|
+
return [...E.childNodes].map((b) => g.append(b.cloneNode(!0))), v(g);
|
|
96
|
+
}
|
|
97
|
+
return v(a.documentElement || a.body || a);
|
|
98
|
+
})(e), i = M(
|
|
99
|
+
`<xsl:stylesheet version="1.0"
|
|
100
|
+
xmlns:xsl="${F}"
|
|
101
|
+
xmlns:xhtml="${q}"
|
|
102
|
+
xmlns:dce="urn:schemas-epa-wg:dce"
|
|
103
|
+
xmlns:exsl="http://exslt.org/common"
|
|
104
|
+
exclude-result-prefixes="exsl"
|
|
105
|
+
>
|
|
106
|
+
<xsl:template match="ignore">
|
|
107
|
+
<xsl:choose>
|
|
108
|
+
<xsl:when test="//attr">{//attr}</xsl:when>
|
|
109
|
+
<xsl:otherwise>{def}</xsl:otherwise>
|
|
110
|
+
</xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
|
|
111
|
+
<xsl:template mode="payload" match="attributes"></xsl:template>
|
|
112
|
+
<xsl:template match="/">
|
|
113
|
+
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
114
|
+
</xsl:template>
|
|
115
|
+
<xsl:template name="slot" >
|
|
116
|
+
<xsl:param name="slotname" />
|
|
117
|
+
<xsl:param name="defaultvalue" />
|
|
118
|
+
<xsl:choose>
|
|
119
|
+
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
120
|
+
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
121
|
+
</xsl:when>
|
|
122
|
+
<xsl:otherwise>
|
|
123
|
+
<xsl:copy-of select="$defaultvalue"/>
|
|
124
|
+
</xsl:otherwise>
|
|
125
|
+
</xsl:choose>
|
|
126
|
+
</xsl:template>
|
|
127
|
+
<xsl:variable name="js-injected-body">
|
|
128
|
+
<xsl:call-template name="slot" >
|
|
129
|
+
<xsl:with-param name="slotname" select="''"/>
|
|
130
|
+
<xsl:with-param name="defaultvalue"/>
|
|
131
|
+
</xsl:call-template>
|
|
132
|
+
</xsl:variable>
|
|
133
|
+
</xsl:stylesheet>`
|
|
134
|
+
);
|
|
135
|
+
s.importStylesheet(t);
|
|
136
|
+
const c = s.transformToFragment(n, document), h = (a, o) => a.querySelector(o), p = h(i, 'template[mode="payload"]');
|
|
137
|
+
if (!c)
|
|
138
|
+
return console.error("transformation error", { xml: n.outerHTML, xsl: H(t) });
|
|
139
|
+
const m = [];
|
|
140
|
+
[...c.querySelectorAll("dce-root>attribute")].forEach((a) => {
|
|
141
|
+
const o = Y(a, "xsl:param"), E = x(a, "name");
|
|
142
|
+
p.append(o);
|
|
143
|
+
let v = x(o, "select")?.split("??");
|
|
144
|
+
v || (v = ["//" + E, `'${o.textContent}'`], U(o), o.setAttribute("name", E));
|
|
145
|
+
let g;
|
|
146
|
+
if (v?.length > 1) {
|
|
147
|
+
o.removeAttribute("select");
|
|
148
|
+
const b = h(i, 'template[match="ignore"]>choose').cloneNode(!0);
|
|
149
|
+
U(b.firstElementChild).append(S(b, "{" + v[0] + "}")), U(b.lastElementChild).append(S(b, "{" + v[1] + "}")), b.firstElementChild.setAttribute("test", v[0]), o.append(b), g = b.cloneNode(!0);
|
|
150
|
+
} else
|
|
151
|
+
g = Y(a, "xsl:value-of");
|
|
152
|
+
g.removeAttribute("name"), a.append(g), a.removeAttribute("select"), m.push(o);
|
|
153
|
+
}), [...c.querySelectorAll("[value]")].filter((a) => a.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((a) => {
|
|
154
|
+
const o = x(a, "value");
|
|
155
|
+
o && a.setAttribute("value", he(o));
|
|
156
|
+
});
|
|
157
|
+
for (const a of c.childNodes)
|
|
158
|
+
p.append(i.importNode(a, !0));
|
|
159
|
+
[...p.querySelectorAll("template")].forEach((a) => p.ownerDocument.documentElement.append(a));
|
|
160
|
+
const P = h(i, 'call-template[name="slot"]'), d = (a) => {
|
|
161
|
+
const o = P.cloneNode(!0), E = x(a, "name");
|
|
162
|
+
E && o.firstElementChild.setAttribute("select", `'${E}'`);
|
|
163
|
+
for (let v of a.childNodes)
|
|
164
|
+
o.lastElementChild.append(v);
|
|
165
|
+
return o;
|
|
166
|
+
};
|
|
167
|
+
C(p, "slot", (a) => a.parentNode.replaceChild(d(a), a));
|
|
168
|
+
const u = G(i);
|
|
169
|
+
return u.params = m, u;
|
|
170
|
+
}
|
|
171
|
+
async function ce(e) {
|
|
172
|
+
return await new Promise((t, s) => {
|
|
173
|
+
const n = new XMLHttpRequest();
|
|
174
|
+
n.open("GET", e), n.responseType = "document", n.onload = () => {
|
|
175
|
+
n.readyState === n.DONE && n.status === 200 && t(n.responseXML || N("div", n.responseText)), s(n.statusText);
|
|
176
|
+
}, n.addEventListener("error", (i) => s(i)), n.send();
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function me(e, l, t = !1) {
|
|
180
|
+
if (e === l)
|
|
181
|
+
return !0;
|
|
182
|
+
if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
|
|
183
|
+
return t;
|
|
184
|
+
for (let s in e)
|
|
185
|
+
if (!(s in l) || !me(e[s], l[s]))
|
|
186
|
+
return t;
|
|
187
|
+
return !0;
|
|
188
|
+
}
|
|
189
|
+
const Q = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), ue = (e, l) => Q(l).map((t) => {
|
|
190
|
+
let s = e.ownerDocument, n = (i) => (e.append(i), i);
|
|
191
|
+
if (t.includes("/")) {
|
|
192
|
+
const i = [], c = s.evaluate(t, e);
|
|
193
|
+
for (let h; h = c.iterateNext(); )
|
|
194
|
+
i.push(h);
|
|
195
|
+
return i;
|
|
196
|
+
}
|
|
197
|
+
return [...e.childNodes].find((i) => i.localName === t) || n(N(t, "", s));
|
|
198
|
+
}).flat();
|
|
199
|
+
function J(e, l, t, s) {
|
|
200
|
+
if (!t.sliceProcessed)
|
|
201
|
+
return t.sliceProcessed = 1, ue(e, l ?? "").map((n) => {
|
|
202
|
+
const i = e.ownerDocument, c = t.sliceEventSource, h = t.sliceElement, p = () => [...n.childNodes].filter((m) => m.nodeType === 3 || m.localName === "value" || m.localName === "form-data").map((m) => m.remove());
|
|
203
|
+
if (c.getAttributeNames().map((m) => n.setAttribute(m, x(c, m))), [...n.childNodes].filter((m) => m.localName === "event").map((m) => m.remove()), "validationMessage" in c && n.setAttribute("validation-message", c.validationMessage), t.type === "init" && p(), n.append(L(t, "event", i)), h.hasAttribute("slice-value")) {
|
|
204
|
+
c.value === void 0 ? n.removeAttribute("value") : n.setAttribute("value", c.value);
|
|
205
|
+
const m = D(x(h, "slice-value"), n);
|
|
206
|
+
p(), n.append(S(i, m));
|
|
207
|
+
} else {
|
|
208
|
+
if ("elements" in c)
|
|
209
|
+
return p(), n.append(L(new FormData(c), "value", n.ownerDocument)), n;
|
|
210
|
+
const m = c.value ?? x(h, "value");
|
|
211
|
+
p(), m == null ? [...n.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : le(m) ? n.append(S(i, m)) : n.append(L(m, "value", n.ownerDocument));
|
|
212
|
+
}
|
|
213
|
+
return n;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function C(e, l, t) {
|
|
217
|
+
e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
|
|
218
|
+
}
|
|
219
|
+
const de = async (e, l) => {
|
|
220
|
+
if (!e || !e.trim())
|
|
221
|
+
return [l];
|
|
222
|
+
if (e.startsWith("#"))
|
|
223
|
+
return ((t) => {
|
|
224
|
+
if (!t) return [];
|
|
225
|
+
const s = t.querySelectorAll(e);
|
|
226
|
+
if (s.length)
|
|
227
|
+
return [...s];
|
|
228
|
+
const n = t.getRootNode();
|
|
229
|
+
return n === t ? [] : getByHashId(n);
|
|
230
|
+
})(l.parentElement);
|
|
231
|
+
try {
|
|
232
|
+
const t = await ce(e), s = new URL(e, location).hash;
|
|
233
|
+
if (s) {
|
|
234
|
+
const n = t.querySelectorAll(s);
|
|
235
|
+
return n.length ? [...n] : [l];
|
|
236
|
+
}
|
|
237
|
+
return [t];
|
|
238
|
+
} catch {
|
|
239
|
+
return [l];
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
function pe(e, l) {
|
|
243
|
+
for (let t of e.attributes)
|
|
244
|
+
t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
|
|
245
|
+
}
|
|
246
|
+
function Z(e, l = 0) {
|
|
247
|
+
const t = {};
|
|
248
|
+
for (const s of e.childNodes) {
|
|
249
|
+
const n = x(s, "data-dce-id") || s.dceId || 0;
|
|
250
|
+
if (!t[n])
|
|
251
|
+
n ? t[n] = 1 : (t[n] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
|
|
252
|
+
else {
|
|
253
|
+
const i = s.dceId = n + "-" + t[n]++;
|
|
254
|
+
s.setAttribute && s.setAttribute("data-dce-id", i);
|
|
255
|
+
}
|
|
256
|
+
s.childNodes.length && Z(s);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function ee(e, l) {
|
|
260
|
+
if (!l.length)
|
|
261
|
+
return K(e);
|
|
262
|
+
const t = {};
|
|
263
|
+
for (let s of e.childNodes)
|
|
264
|
+
t[s.dceId], W(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
|
|
265
|
+
for (let s of [...l]) {
|
|
266
|
+
const n = x(s, "data-dce-id") || s.dceId, i = t[n];
|
|
267
|
+
i ? (W(s) ? i.nodeValue !== s.nodeValue && (i.nodeValue = s.nodeValue) : (pe(s, i), (i.childNodes.length || s.childNodes.length) && ee(i, s.childNodes)), delete t[n]) : e.append(s);
|
|
268
|
+
}
|
|
269
|
+
for (let s of Object.values(t))
|
|
270
|
+
s.remove();
|
|
271
|
+
}
|
|
272
|
+
function fe(e, l) {
|
|
273
|
+
return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
|
|
274
|
+
}
|
|
275
|
+
const he = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${B(t[3])}}${t[4]}`).join(""), B = (e) => {
|
|
276
|
+
if (!e.trim())
|
|
277
|
+
return e;
|
|
278
|
+
const l = e.split("??"), t = l.shift(), s = B(l.join("??"));
|
|
279
|
+
return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
|
|
280
|
+
}, D = (e, l) => {
|
|
281
|
+
const t = e.split("??");
|
|
282
|
+
if (t.length > 1)
|
|
283
|
+
return D(t[0], l) || D(t[1], l);
|
|
284
|
+
e = B(e);
|
|
285
|
+
const s = l.ownerDocument.evaluate(e, l);
|
|
286
|
+
switch (s.resultType) {
|
|
287
|
+
case XPathResult.NUMBER_TYPE:
|
|
288
|
+
return s.numberValue;
|
|
289
|
+
case XPathResult.STRING_TYPE:
|
|
290
|
+
return s.stringValue;
|
|
291
|
+
case XPathResult.BOOLEAN_TYPE:
|
|
292
|
+
return s.booleanValue;
|
|
293
|
+
}
|
|
294
|
+
let n = "";
|
|
295
|
+
for (let i; i = s.iterateNext(); )
|
|
296
|
+
n += i.textContent;
|
|
297
|
+
return n;
|
|
298
|
+
}, xe = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,template,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","), ye = (e, l) => {
|
|
299
|
+
const t = N("xsl:" + e.localName);
|
|
300
|
+
for (let s of e.attributes)
|
|
301
|
+
t.setAttribute(s.name, s.value);
|
|
302
|
+
for (; e.firstChild; )
|
|
303
|
+
t.append(e.firstChild);
|
|
304
|
+
if (e.parentElement)
|
|
305
|
+
e.parentElement.replaceChild(t, e);
|
|
306
|
+
else {
|
|
307
|
+
const s = e.parentElement || l, n = [...s.childNodes];
|
|
308
|
+
n.forEach((i, c) => {
|
|
309
|
+
i === e && (n[c] = t);
|
|
310
|
+
}), s.replaceChildren(...n);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
class be extends HTMLElement {
|
|
314
|
+
static observedAttributes = ["src", "tag", "hidden"];
|
|
315
|
+
async connectedCallback() {
|
|
316
|
+
const l = await de(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
|
|
317
|
+
for (const d of l)
|
|
318
|
+
C(d.templateNode || d.content || d, "style", (u) => {
|
|
319
|
+
const a = u.closest("slot"), o = a ? `slot[name="${a.name}"]` : "";
|
|
320
|
+
u.innerHTML = `${s} ${o}{${u.innerHTML}}`, this.append(u);
|
|
321
|
+
});
|
|
322
|
+
const n = l.map((d) => oe(d)), i = n.map((d, u) => (u = new XSLTProcessor(), u.importStylesheet(d), u));
|
|
323
|
+
Object.defineProperty(this, "xsltString", { get: () => n.map((d) => H(d)).join(`
|
|
324
|
+
`) });
|
|
325
|
+
const c = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, u, a) => a.indexOf(d) === u).map(Q).flat(), m = n.reduce((d, u) => (u.params && d.push(...u.params), d), []);
|
|
326
|
+
class w extends HTMLElement {
|
|
327
|
+
static get observedAttributes() {
|
|
328
|
+
return m.map((u) => x(u, "name"));
|
|
329
|
+
}
|
|
330
|
+
#e = 0;
|
|
331
|
+
connectedCallback() {
|
|
332
|
+
let u = this.childNodes;
|
|
333
|
+
if (this.firstElementChild?.tagName === "TEMPLATE") {
|
|
334
|
+
this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
|
|
335
|
+
const f = this.firstElementChild;
|
|
336
|
+
f.remove(), u = f.content.childNodes;
|
|
337
|
+
for (const r of [...f.content.childNodes])
|
|
338
|
+
if (r.localName === "style") {
|
|
339
|
+
const y = fe(this, "data-dce-style");
|
|
340
|
+
r.innerHTML = `${s}[data-dce-style="${y}"]{${r.innerHTML}}`, f.insertAdjacentElement("beforebegin", r);
|
|
341
|
+
} else
|
|
342
|
+
r.nodeType === 1 ? f.insertAdjacentElement("beforebegin", r) : r.nodeType === 3 && f.insertAdjacentText("beforebegin", r.data);
|
|
343
|
+
}
|
|
344
|
+
const a = M("<datadom/>").documentElement, o = (f, r = "") => ((y) => (r && y.append(S(a, r)), y))(a.ownerDocument.createElement(f));
|
|
345
|
+
X(a, "payload", u, re), this.innerHTML = "";
|
|
346
|
+
const E = X(a, "attributes", this.attributes, (f) => o(f.nodeName, f.value));
|
|
347
|
+
X(a, "dataset", Object.keys(this.dataset), (f) => o(f, this.dataset[f]));
|
|
348
|
+
const v = X(a, "slice", p, (f) => o(f, "")), g = (f) => D(f, v);
|
|
349
|
+
this.xml = a;
|
|
350
|
+
const b = [], $ = () => {
|
|
351
|
+
const f = {};
|
|
352
|
+
for (let r; r = b.pop(); ) {
|
|
353
|
+
const y = x(r.sliceElement, "slice");
|
|
354
|
+
f[y] || (J(v, y, r), f[y] = r);
|
|
355
|
+
}
|
|
356
|
+
Object.keys(f).length !== 0 && R();
|
|
357
|
+
};
|
|
358
|
+
let k;
|
|
359
|
+
this.onSlice = (f) => {
|
|
360
|
+
b.push(f), k || (k = setTimeout(() => {
|
|
361
|
+
$(), k = 0;
|
|
362
|
+
}, 1));
|
|
363
|
+
};
|
|
364
|
+
const R = this.transform = () => {
|
|
365
|
+
if (this.#e)
|
|
366
|
+
debugger;
|
|
367
|
+
this.#e = 1, i.map((r, y) => {
|
|
368
|
+
const I = r.transformToFragment(a.ownerDocument, document);
|
|
369
|
+
return I || console.error(`XSLT transformation error. xsl:
|
|
370
|
+
`, H(n[y]), `
|
|
371
|
+
xml:
|
|
372
|
+
`, H(a)), I;
|
|
373
|
+
}).map((r) => {
|
|
374
|
+
r && (Z(r), ee(this, r.childNodes));
|
|
375
|
+
}), w.observedAttributes.map((r) => {
|
|
376
|
+
let y = x(this.firstElementChild, r);
|
|
377
|
+
y !== x(this, r) && (this.setAttribute(r, y), this.#t(r, y));
|
|
378
|
+
}), C(this, "[slice],[slice-event]", (r) => {
|
|
379
|
+
if (!r.dceInitialized) {
|
|
380
|
+
r.dceInitialized = 1;
|
|
381
|
+
let y = x(r, "slice-event");
|
|
382
|
+
x(r, "custom-validity") && (y += " change submit"), [...new Set((y || "change").split(" "))].forEach((I) => (r.localName === "slice" ? r.parentElement : r).addEventListener(I, (A) => {
|
|
383
|
+
A.sliceElement = r, A.sliceEventSource = A.currentTarget || A.target;
|
|
384
|
+
const te = J(v, x(A.sliceElement, "slice"), A);
|
|
385
|
+
C(this, "[custom-validity]", (z) => {
|
|
386
|
+
if (!z.setCustomValidity)
|
|
387
|
+
return;
|
|
388
|
+
const _ = x(z, "custom-validity");
|
|
389
|
+
try {
|
|
390
|
+
const j = _ && D(_, E);
|
|
391
|
+
z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
|
|
392
|
+
} catch (j) {
|
|
393
|
+
console.error(j, "xPath", _);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
const V = x(r, "custom-validity"), T = V && D(V, E), O = T === !0 ? "" : T;
|
|
397
|
+
if (V) {
|
|
398
|
+
if (r.setCustomValidity ? r.setCustomValidity(O) : r.validationMessage = O, te.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
|
|
399
|
+
return T === !0 ? void 0 : (setTimeout(R, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
|
|
400
|
+
setTimeout(R, 1);
|
|
401
|
+
}
|
|
402
|
+
this.onSlice(A);
|
|
403
|
+
})), (!y || y.includes("init")) && (r.hasAttribute("slice-value") || r.hasAttribute("value") || r.value ? this.onSlice({ type: "init", target: r, sliceElement: r, sliceEventSource: r }) : r.value = g(x(r, "slice")));
|
|
404
|
+
}
|
|
405
|
+
}), this.#e = 0;
|
|
406
|
+
};
|
|
407
|
+
R(), $();
|
|
408
|
+
}
|
|
409
|
+
#t(u, a) {
|
|
410
|
+
let o = this.xml.querySelector(`attributes>${u}`);
|
|
411
|
+
o ? U(o).append(S(o, a)) : (o = N(u, a, this.xml), this.xml.querySelector("attributes").append(o));
|
|
412
|
+
}
|
|
413
|
+
attributeChangedCallback(u, a, o) {
|
|
414
|
+
!this.xml || this.#e || (this.#t(u, o), this.transform());
|
|
415
|
+
}
|
|
416
|
+
get dce() {
|
|
417
|
+
return c;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const P = (d) => {
|
|
421
|
+
window.customElements.get(d) !== w && window.customElements.define(d, w);
|
|
422
|
+
};
|
|
423
|
+
if (t)
|
|
424
|
+
P(t);
|
|
425
|
+
else {
|
|
426
|
+
const d = s;
|
|
427
|
+
this.setAttribute("tag", d), P(d);
|
|
428
|
+
const u = document.createElement(d);
|
|
429
|
+
this.getAttributeNames().forEach((a) => u.setAttribute(a, this.getAttribute(a))), u.append(...[...this.childNodes].filter((a) => a.localName !== "style")), this.append(u);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
get templateNode() {
|
|
433
|
+
return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
|
|
434
|
+
}
|
|
435
|
+
get dce() {
|
|
436
|
+
return this;
|
|
437
|
+
}
|
|
438
|
+
get xslt() {
|
|
439
|
+
return M(this.xsltString);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
window.customElements.define("custom-element", be);
|
|
443
|
+
export {
|
|
444
|
+
be as C,
|
|
445
|
+
H as a,
|
|
446
|
+
ce as b,
|
|
447
|
+
oe as c,
|
|
448
|
+
me as d,
|
|
449
|
+
ue as e,
|
|
450
|
+
J as f,
|
|
451
|
+
Z as g,
|
|
452
|
+
ee as h,
|
|
453
|
+
fe as i,
|
|
454
|
+
he as j,
|
|
455
|
+
B as k,
|
|
456
|
+
D as l,
|
|
457
|
+
pe as m,
|
|
458
|
+
xe as n,
|
|
459
|
+
L as o,
|
|
460
|
+
ye as p,
|
|
461
|
+
G as t,
|
|
462
|
+
M as x
|
|
463
|
+
};
|