@epa-wg/custom-element-dist 0.0.21 → 0.0.22

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 (171) hide show
  1. package/README.md +4 -4
  2. package/coverage/coverage-final.json +15 -11
  3. package/coverage/index.html +25 -25
  4. package/coverage/src/custom-element/coverage.svg +1 -1
  5. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  6. package/coverage/src/custom-element/custom-element.js.html +604 -421
  7. package/coverage/src/custom-element/custom-element1-1.js/coverage.svg +10 -0
  8. package/coverage/src/custom-element/custom-element1-1.js.html +2374 -0
  9. package/coverage/src/custom-element/custom-element1.js/coverage.svg +10 -0
  10. package/coverage/src/custom-element/custom-element1.js.html +2374 -0
  11. package/coverage/src/custom-element/http-request.js.html +10 -10
  12. package/coverage/src/custom-element/index.html +49 -19
  13. package/coverage/src/custom-element/local-storage.js.html +6 -6
  14. package/coverage/src/custom-element/location-element.js.html +1 -1
  15. package/coverage/src/index.html +1 -1
  16. package/coverage/src/mocks/handlers.ts.html +1 -1
  17. package/coverage/src/mocks/index.html +1 -1
  18. package/coverage/src/stories/{attributes.stories.ts.html → attributes.test.stories.ts.html} +51 -15
  19. package/coverage/src/stories/{css.stories.ts.html → css.test.stories.ts.html} +77 -17
  20. package/coverage/src/stories/{dom-merge.stories.ts.html → dom-merge.test.stories.ts.html} +60 -12
  21. package/coverage/src/stories/{external-template.stories.ts.html → external-template.test.stories.ts.html} +42 -12
  22. package/coverage/src/stories/form.test.stories.ts.html +658 -0
  23. package/coverage/src/stories/http-request.stories.ts.html +7 -7
  24. package/coverage/src/stories/index.html +71 -41
  25. package/coverage/src/stories/{local-storage.stories.ts.html → local-storage.test.stories.ts.html} +56 -20
  26. package/coverage/src/stories/{location-element.stories.ts.html → location-element.test.stories.ts.html} +53 -17
  27. package/coverage/src/stories/renderPlay.ts.html +12 -15
  28. package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +10 -0
  29. package/coverage/src/stories/{slice-events.stories.ts.html → slice-events.test.stories.ts.html} +264 -15
  30. package/coverage/src/stories/slots.test.stories.ts/coverage.svg +10 -0
  31. package/coverage/src/stories/slots.test.stories.ts.html +739 -0
  32. package/coverage/src/sum.ts.html +1 -1
  33. package/dist/custom-element-BISbI4SU.js +463 -0
  34. package/dist/custom-element-N-sWiqGK.cjs +53 -0
  35. package/dist/custom-element-bundle.cjs +1 -1
  36. package/dist/custom-element-bundle.js +2 -2
  37. package/dist/mockServiceWorker.js +1 -1
  38. package/package.json +4 -4
  39. package/public/mockServiceWorker.js +1 -1
  40. package/src/custom-element/custom-element.d.ts +4 -0
  41. package/src/custom-element/custom-element.js +103 -42
  42. package/src/custom-element/custom-element1-1.js +763 -0
  43. package/src/custom-element/custom-element1.js +763 -0
  44. package/src/custom-element/custom-element1.js0 +750 -0
  45. package/src/custom-element/custom-element2.js0 +759 -0
  46. package/src/custom-element/custom-element3.js0 +763 -0
  47. package/src/custom-element/demo/a.html +38 -41
  48. package/src/custom-element/demo/b.html +13 -0
  49. package/src/custom-element/demo/data-slices.html +32 -0
  50. package/src/custom-element/demo/form.html +193 -0
  51. package/src/custom-element/demo/s.xml +19 -14
  52. package/src/custom-element/demo/s.xslt +22 -38
  53. package/src/custom-element/demo/s1.xslt +60 -0
  54. package/src/custom-element/ide/customData-dce.json +14 -1
  55. package/src/custom-element/ide/web-types-dce.json +6 -1
  56. package/src/custom-element/ide/web-types-xsl.json +1 -1
  57. package/src/custom-element/index.html +1 -0
  58. package/src/custom-element.test.ts +24 -8
  59. package/src/stories/{attributes.stories.ts → attributes.test.stories.ts} +19 -7
  60. package/src/stories/{css.stories.ts → css.test.stories.ts} +29 -9
  61. package/src/stories/{dom-merge.stories.ts → dom-merge.test.stories.ts} +19 -3
  62. package/src/stories/{external-template.stories.ts → external-template.test.stories.ts} +13 -3
  63. package/src/stories/form.test.stories.ts +191 -0
  64. package/src/stories/http-request.stories.ts +6 -6
  65. package/src/stories/http-request.test.ts +0 -9
  66. package/src/stories/{local-storage.stories.ts → local-storage.test.stories.ts} +24 -12
  67. package/src/stories/{location-element.stories.ts → location-element.test.stories.ts} +21 -9
  68. package/src/stories/renderPlay.ts +1 -2
  69. package/src/stories/{slice-events.stories.ts → slice-events.test.stories.ts} +88 -5
  70. package/src/stories/slots.test.stories.ts +218 -0
  71. package/storybook-static/assets/{Color-RQJUDNI5-C4yZhNbM.js → Color-PRSJMWNM-e4s261EJ.js} +1 -1
  72. package/storybook-static/assets/{Configure-C7d36rng.js → Configure-DWut7txe.js} +1 -1
  73. package/storybook-static/assets/DocsRenderer-K4EAMTCU-CaXVGjCl.js +2 -0
  74. package/storybook-static/assets/WithTooltip-KJL26V4Q--B8vdnMi.js +1 -0
  75. package/storybook-static/assets/{attributes.stories-ZB0RTY1d.js → attributes.test.stories-IuwazrdL.js} +21 -21
  76. package/storybook-static/assets/css.test.stories-D9WaxrEv.js +96 -0
  77. package/storybook-static/assets/custom-element-BV8-hRQS.js +219 -0
  78. package/storybook-static/assets/{dom-merge.stories-CgHZUABU.js → dom-merge.test.stories-BhbNeum_.js} +5 -6
  79. package/storybook-static/assets/{entry-preview-CQqNFx4W.js → entry-preview-DrgzXgwT.js} +1 -1
  80. package/storybook-static/assets/{entry-preview-docs-CWgqLfd3.js → entry-preview-docs-Bxv0qQWs.js} +1 -1
  81. package/storybook-static/assets/{external-template.stories-DtSLMxvg.js → external-template.test.stories-Bpr_wxBo.js} +23 -24
  82. package/storybook-static/assets/form.test.stories-3tURbEdv.js +250 -0
  83. package/storybook-static/assets/{formatter-B5HCVTEV-tKeEfJA9.js → formatter-2WMMO6ZP-SJtgH3vM.js} +5 -5
  84. package/storybook-static/assets/http-request.stories-8K_qSs8C.js +300 -0
  85. package/storybook-static/assets/iframe-CM82WlGY.js +2 -0
  86. package/storybook-static/assets/index-CEZitmnt.js +548 -0
  87. package/storybook-static/assets/index-CVRyq5ci.js +27 -0
  88. package/storybook-static/assets/{index-DnEJ_bKa.js → index-D1MP-Zis.js} +1 -1
  89. package/storybook-static/assets/index-DNL-IEpS.js +1 -0
  90. package/storybook-static/assets/index-DXimoRZY.js +1 -0
  91. package/storybook-static/assets/index-DuIEV_9C.js +13 -0
  92. package/storybook-static/assets/{lit-element-B4_0akdT.js → lit-element-CenEXOuS.js} +2 -2
  93. package/storybook-static/assets/{local-storage.stories-BkO6djDz.js → local-storage.test.stories-CtisAQBB.js} +28 -24
  94. package/storybook-static/assets/{location-element.stories-DCIOUd0D.js → location-element.test.stories-5O_t_m4Y.js} +11 -11
  95. package/storybook-static/assets/preview-4Up_z4Em.js +7 -0
  96. package/storybook-static/assets/{preview-CkgAD_DE.js → preview-5Y0XiZgz.js} +2 -2
  97. package/storybook-static/assets/preview-BKCN0mOr.js +1 -0
  98. package/storybook-static/assets/preview-DRnyIGXK.js +48 -0
  99. package/storybook-static/assets/preview-FpHGYA1q.js +1 -0
  100. package/storybook-static/assets/{preview-PxUn-cIn.js → preview-TCN6m6T-.js} +1 -1
  101. package/storybook-static/assets/slice-events.test.stories-BSXCLIA5.js +231 -0
  102. package/storybook-static/assets/slots.test.stories-B1vqfHmN.js +214 -0
  103. package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-BWFH_0wQ.js +1 -0
  104. package/storybook-static/iframe.html +153 -10
  105. package/storybook-static/index.html +1 -1
  106. package/storybook-static/index.json +1 -1
  107. package/storybook-static/mockServiceWorker.js +1 -1
  108. package/storybook-static/project.json +1 -1
  109. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +35 -29
  110. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +1 -1
  111. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  112. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +5 -5
  113. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +35 -35
  114. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  115. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  116. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
  117. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  118. package/storybook-static/sb-addons/interactions-10/manager-bundle.js +18 -16
  119. package/storybook-static/sb-addons/links-1/manager-bundle.js +1 -1
  120. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +1 -1
  121. package/storybook-static/sb-manager/WithTooltip-KJL26V4Q-5LS5AN27.js +1 -0
  122. package/storybook-static/sb-manager/{chunk-S4VOIVUE.js → chunk-B3YDJJJH.js} +9 -9
  123. package/storybook-static/sb-manager/{chunk-FEE35O7J.js → chunk-BLWCBWKL.js} +3 -3
  124. package/storybook-static/sb-manager/{chunk-XCO5HRLK.js → chunk-GUVK2GTO.js} +3 -3
  125. package/storybook-static/sb-manager/chunk-LFRML3ZV.js +186 -0
  126. package/storybook-static/sb-manager/chunk-MC7RAF2B.js +274 -0
  127. package/storybook-static/sb-manager/{chunk-XP3HGWTR.js → chunk-ZR5JZWHI.js} +1 -1
  128. package/storybook-static/sb-manager/{formatter-B5HCVTEV-7DCBOGO6.js → formatter-2WMMO6ZP-JI7RHVTW.js} +1 -1
  129. package/storybook-static/sb-manager/globals-module-info.js +1 -1
  130. package/storybook-static/sb-manager/globals-runtime.js +1 -1
  131. package/storybook-static/sb-manager/index.js +1 -1
  132. package/storybook-static/sb-manager/runtime.js +1 -1
  133. package/storybook-static/sb-manager/{syntaxhighlighter-JOJW2KGS-VF6EEVPI.js → syntaxhighlighter-BP7B2CQK-WOJYHKQR.js} +1 -1
  134. package/storybook-static/sb-preview/runtime.js +28 -11
  135. package/vite.config.js +5 -5
  136. package/dist/custom-element-B4v-KaIh.cjs +0 -53
  137. package/dist/custom-element-_g0GTup2.js +0 -436
  138. package/src/stories/attributes.test.ts +0 -14
  139. package/src/stories/css.test.ts +0 -12
  140. package/src/stories/dom-merge.test.ts +0 -12
  141. package/src/stories/external-template.test.ts +0 -12
  142. package/src/stories/local-storage.test.ts +0 -12
  143. package/src/stories/location-element.test.ts +0 -14
  144. package/src/stories/slice-events.test.ts +0 -12
  145. package/storybook-static/assets/DocsRenderer-K4EAMTCU-BLMupvSb.js +0 -2
  146. package/storybook-static/assets/WithTooltip-Y7J54OF7-BAQSPSFk.js +0 -1
  147. package/storybook-static/assets/css.stories-CLSX-Xxd.js +0 -86
  148. package/storybook-static/assets/custom-element-BLZZ00dz.js +0 -53
  149. package/storybook-static/assets/http-request.stories-CUzlXO89.js +0 -300
  150. package/storybook-static/assets/iframe-gCvlWuoC.js +0 -2
  151. package/storybook-static/assets/index-CBQwM6ST.js +0 -508
  152. package/storybook-static/assets/index-CDavW7r9.js +0 -193
  153. package/storybook-static/assets/index-CQA5dlr6.js +0 -13
  154. package/storybook-static/assets/index-DgaNIR0t.js +0 -1
  155. package/storybook-static/assets/index-Dkj0J1ds.js +0 -1
  156. package/storybook-static/assets/preview-C6t8KBFr.js +0 -1
  157. package/storybook-static/assets/preview-CYD85dwb.js +0 -7
  158. package/storybook-static/assets/preview-D8LadFCz.js +0 -48
  159. package/storybook-static/assets/preview-DNpCpRPf.js +0 -1
  160. package/storybook-static/assets/slice-events.stories-DXKjXI37.js +0 -115
  161. package/storybook-static/assets/syntaxhighlighter-JOJW2KGS-C04pIVD3.js +0 -1
  162. package/storybook-static/sb-manager/WithTooltip-Y7J54OF7-CEHQ77YF.js +0 -1
  163. package/storybook-static/sb-manager/chunk-E3WK6ZOZ.js +0 -234
  164. package/storybook-static/sb-manager/chunk-E6ABNH5R.js +0 -183
  165. /package/coverage/src/stories/{attributes.stories.ts → attributes.test.stories.ts}/coverage.svg +0 -0
  166. /package/coverage/src/stories/{css.stories.ts → css.test.stories.ts}/coverage.svg +0 -0
  167. /package/coverage/src/stories/{dom-merge.stories.ts → dom-merge.test.stories.ts}/coverage.svg +0 -0
  168. /package/coverage/src/stories/{external-template.stories.ts → external-template.test.stories.ts}/coverage.svg +0 -0
  169. /package/coverage/src/stories/{local-storage.stories.ts → form.test.stories.ts}/coverage.svg +0 -0
  170. /package/coverage/src/stories/{location-element.stories.ts → local-storage.test.stories.ts}/coverage.svg +0 -0
  171. /package/coverage/src/stories/{slice-events.stories.ts → location-element.test.stories.ts}/coverage.svg +0 -0
package/vite.config.js CHANGED
@@ -5,10 +5,10 @@ export default {
5
5
  build : {
6
6
  target : 'esnext',
7
7
  lib : {
8
- entry: resolve( __dirname, 'src/custom-element/index.js' ),
9
- name : 'CustomElement',
8
+ entry : resolve( __dirname, 'src/custom-element/index.js' ),
9
+ name : 'CustomElement',
10
10
  fileName: 'custom-element-bundle',
11
- formats:['es','cjs']
11
+ formats : [ 'es', 'cjs' ]
12
12
  },
13
13
  minify : true,
14
14
  rollupOptions: {
@@ -42,8 +42,8 @@ export default {
42
42
  headless: true,
43
43
  },
44
44
  include :
45
- [ 'src/**/*.{test,spec}.?(c|m)[jt]s?(x)'
46
- // , 'src/stories/css.stories.ts'
45
+ [ 'src/**/*.{test,spec}.?(c|m)[jt]s?(x)'
46
+ , 'src/stories/*.test.stories.ts'
47
47
  ],
48
48
  coverage: {
49
49
  reporter: [ 'text', 'json', 'html', 'coverage-svg' ],
@@ -1,53 +0,0 @@
1
- "use strict";const P="http://www.w3.org/1999/XSL/Transform",I="http://www.w3.org/1999/xhtml",ne="http://exslt.org/common",h=(e,l)=>e.getAttribute?.(l),X=e=>e.nodeType===3,ae=e=>typeof e=="string",re=e=>e&&typeof e.nodeType=="number",N=(e,l="",t=document)=>(s=>(l&&s.append(w(t.ownerDocument||t,l)),s))((t.ownerDocument||t).createElement(e)),w=(e,l)=>(e.ownerDocument||e).createTextNode(l),F=e=>{for(;e.firstChild;)e.firstChild.remove();return e},R=e=>(e.getAttributeNames().map(l=>e.removeAttribute(l)),F(e)),oe=e=>(e?.setAttribute("xmlns:xsl",P),e),ie=e=>(e?.setAttribute("xmlns:xhtml",I),oe(e)),_=(e,l)=>{const t=e.ownerDocument.createElementNS(e.namespaceURI,l);for(let s of e.attributes)t.setAttribute(s.name,s.value);for(;e.firstChild;)t.append(e.firstChild);return t};function S(e){return new DOMParser().parseFromString(e,"application/xml")}function $(e){return new XMLSerializer().serializeToString(e)}function j(e,l,t,s){const n=p=>e.ownerDocument.createElement(p),f=((p,b,u)=>(b.append(u=n(p)),u))(l,e);return[...t].forEach(p=>f.append(s(p))),f}function ce(e){return e.slot||(e.setAttribute||(e=N("span",e.textContent.replaceAll(`
2
- `,""))),e.setAttribute("slot","")),e}function D(e,l,t){const s=typeof e;if(s==="function")debugger;if(s==="string")return N(l,e,t);if(s==="number")return N(l,""+e,t);if(e instanceof Array){const r=N("array");return e.map(f=>r.append(D(f,l,t))),r}const n=N(l,"",t);for(let r in e)re(e[r])||typeof e[r]=="function"||e[r]instanceof Window||(typeof e[r]!="object"?n.setAttribute(r,e[r]):n.append(D(e[r],r,t)));return n}function U(e){if(C(e,"*",l=>[...l.childNodes].filter(t=>t.nodeType===3).forEach(t=>{if(t.parentNode.localName==="style")return;const s=t.data.matchAll(/{([^}]*)}/g);if(s){let n=0,r=p=>w(t,p||""),f=[];if([...s].forEach(p=>{p.index>n&&f.push(r(p.input.substring(n,p.index)));const b=e.querySelector("value-of").cloneNode();b.setAttribute("select",p[1]),f.push(b),n=p.index+p[0].length}),n<t.data.length&&f.push(r(t.data.substring(n,t.data.length))),f.length){for(let p of f)l.insertBefore(p,t);l.removeChild(t)}}})),"all"in e){let l=1;for(let t of e.all)t.setAttribute&&!t.tagName.startsWith("xsl:")&&t.setAttribute("data-dce-id",""+l++)}return e}function B(e,l="xsl:stylesheet"){if(e.tagName===l||e.documentElement?.tagName===l)return U(e);const t=S(`<xsl:stylesheet version="1.0" xmlns:xsl="${P}" xmlns:xhtml="${I}" xmlns:exsl="${ne}" exclude-result-prefixes="exsl" >
3
- <xsl:output method="xml" />
4
- <xsl:template match="/"><dce-root xmlns="${I}"><xsl:apply-templates select="*"/></dce-root></xsl:template>
5
- <xsl:template match="*[name()='template']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
6
- <xsl:template match="*"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
7
- <xsl:template match="*[name()='svg']|*[name()='math']"><xsl:apply-templates mode="sanitize" select="."/></xsl:template>
8
- <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>
9
- <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>
10
- <xsl:template mode="sanitize" match="*|@*"><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></xsl:template>
11
- <xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
12
- <xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
13
- <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>
14
- <xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
15
- </xsl:stylesheet>`),s=new XSLTProcessor,n=(a=>{C(a,"script",g=>g.remove());const i=a.content??a.firstElementChild?.content??a.body??a;te.forEach(g=>C(i,g,x=>se(x,i)));const E=a.firstElementChild?.content||a.content,v=g=>{const x=S("<xhtml/>"),T=x.importNode(g,!0);return x.replaceChild(T,x.documentElement),ie(T)};if(E){const g=N("div");return[...E.childNodes].map(x=>g.append(x.cloneNode(!0))),v(g)}return v(a.documentElement||a.body||a)})(e),r=S(`<xsl:stylesheet version="1.0"
16
- xmlns:xsl="${P}"
17
- xmlns:xhtml="${I}"
18
- xmlns:dce="urn:schemas-epa-wg:dce"
19
- xmlns:exsl="http://exslt.org/common"
20
- exclude-result-prefixes="exsl"
21
- >
22
- <xsl:template match="ignore">
23
- <xsl:choose>
24
- <xsl:when test="//attr">{//attr}</xsl:when>
25
- <xsl:otherwise>{def}</xsl:otherwise>
26
- </xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
27
- <xsl:template mode="payload" match="attributes"></xsl:template>
28
- <xsl:template match="/">
29
- <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
30
- </xsl:template>
31
- <xsl:template name="slot" >
32
- <xsl:param name="slotname" />
33
- <xsl:param name="defaultvalue" />
34
- <xsl:choose>
35
- <xsl:when test="//payload/*[@slot=$slotname]">
36
- <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
37
- </xsl:when>
38
- <xsl:otherwise>
39
- <xsl:copy-of select="$defaultvalue"/>
40
- </xsl:otherwise>
41
- </xsl:choose>
42
- </xsl:template>
43
- <xsl:variable name="js-injected-body">
44
- <xsl:call-template name="slot" >
45
- <xsl:with-param name="slotname" select="''"/>
46
- <xsl:with-param name="defaultvalue"/>
47
- </xsl:call-template>
48
- </xsl:variable>
49
- </xsl:stylesheet>`);s.importStylesheet(t);const f=s.transformToFragment(n,document),p=(a,i)=>a.querySelector(i),b=p(r,'template[mode="payload"]');if(!f)return console.error("transformation error",{xml:n.outerHTML,xsl:$(t)});const u=[];[...f.querySelectorAll("dce-root>attribute")].forEach(a=>{const i=_(a,"xsl:param"),E=h(a,"name");b.append(i);let v=h(i,"select")?.split("??");v||(v=["//"+E,`'${i.textContent}'`],R(i),i.setAttribute("name",E));let g;if(v?.length>1){i.removeAttribute("select");const x=p(r,'template[match="ignore"]>choose').cloneNode(!0);R(x.firstElementChild).append(w(x,"{"+v[0]+"}")),R(x.lastElementChild).append(w(x,"{"+v[1]+"}")),x.firstElementChild.setAttribute("test",v[0]),i.append(x),g=x.cloneNode(!0)}else g=_(a,"xsl:value-of");g.removeAttribute("name"),a.append(g),a.removeAttribute("select"),u.push(i)}),[...f.querySelectorAll("[value]")].filter(a=>a.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach(a=>{const i=h(a,"value");i&&a.setAttribute("value",ee(i))});for(const a of f.childNodes)b.append(r.importNode(a,!0));[...b.querySelectorAll("template")].forEach(a=>b.ownerDocument.documentElement.append(a));const L=p(r,'call-template[name="slot"]'),d=a=>{const i=L.cloneNode(!0),E=h(a,"name")||"";E&&i.firstElementChild.setAttribute("select",`'${E}'`);for(let v of a.childNodes)i.lastElementChild.append(v);return i};C(b,"slot",a=>a.parentNode.replaceChild(d(a),a));const c=U(r);return c.params=u,c}async function W(e){return await new Promise((t,s)=>{const n=new XMLHttpRequest;n.open("GET",e),n.responseType="document",n.onload=()=>{n.readyState===n.DONE&&n.status===200&&t(n.responseXML||N("div",n.responseText)),s(n.statusText)},n.addEventListener("error",r=>s(r)),n.send()})}function G(e,l,t=!1){if(e===l)return!0;if(typeof e!="object"||e===null||typeof l!="object"||l===null||Object.keys(e).length!==Object.keys(l).length)return t;for(let s in e)if(!(s in l)||!G(e[s],l[s]))return t;return!0}const Y=(e,l)=>l.split("|").map(t=>t.trim()).map(t=>{if(t.includes("/")){const s=[],n=e.ownerDocument.evaluate(t,e);for(let r;r=n.iterateNext();)s.push(r);return s}return[...e.childNodes].find(s=>s.localName===t)||N(t)}).flat();function J(e,l,t,s){Y(e,l).map(n=>{const r=e.ownerDocument,f=t.sliceEventSource,p=t.sliceElement,b=()=>[...n.childNodes].filter(u=>u.nodeType===3||u.localName==="value").map(u=>u.remove());if(f.getAttributeNames().map(u=>n.setAttribute(u,h(f,u))),[...n.childNodes].filter(u=>u.localName==="event").map(u=>u.remove()),t.type==="init"&&b(),n.append(D(t,"event",r)),p.hasAttribute("slice-value")){f.value===void 0?n.removeAttribute("value"):n.setAttribute("value",f.value);const u=k(h(p,"slice-value"),n);b(),n.append(w(r,u))}else{const u=f.value??h(p,"value");b(),u==null?[...n.childNodes].filter(A=>A.localName!=="event").map(A=>A.remove()):ae(u)?n.append(w(r,u)):n.append(D(u,"value",n.ownerDocument))}})}function C(e,l,t){e.querySelectorAll&&[...e.querySelectorAll(l)].forEach(t)}const K=(e,l)=>(t=>e===t?null:t&&(t.querySelector(l)||K(t,l)))(e.getRootNode()),me=async(e,l)=>{if(!e||!e.trim())return[l];if(e.startsWith("#"))return(t=>{if(!t)return[];const s=t.querySelectorAll(e);if(s.length)return[...s];const n=t.getRootNode();return n===t?[]:K(n)})(l.parentElement);try{const t=await W(e),s=new URL(e,location).hash;if(s){const n=t.querySelectorAll(s);return n.length?[...n]:[l]}return[t]}catch{return[l]}};function Q(e,l){if(X(e)){if(!X(l))debugger;return}for(let t of e.attributes)t.namespaceURI?l.setAttributeNS(t.namespaceURI,t.name,t.value):l.setAttribute(t.name,t.value),t.name==="value"&&(l.value=t.value)}function M(e,l=0){const t={};for(const s of e.childNodes){const n=h(s,"data-dce-id")||s.dceId||0;if(!t[n])n?t[n]=1:(t[n]=s.dceId=++l,s.setAttribute&&s.setAttribute("data-dce-id",s.dceId));else{const r=s.dceId=n+"-"+t[n]++;s.setAttribute&&s.setAttribute("data-dce-id",r)}s.childNodes.length&&M(s)}}function H(e,l){if(!l.length)return F(e);const t={};for(let s of e.childNodes)t[s.dceId],X(s)?(s.data.trim(),t[s.dceId||0]=s):t[h(s,"data-dce-id")||0]=s;for(let s of[...l]){const n=h(s,"data-dce-id")||s.dceId,r=t[n];r?(X(s)?r.nodeValue!==s.nodeValue&&(r.nodeValue=s.nodeValue):(Q(s,r),(r.childNodes.length||s.childNodes.length)&&H(r,s.childNodes)),delete t[n]):e.append(s)}for(let s of Object.values(t))s.remove()}function Z(e,l){return e.hasAttribute(l)||e.setAttribute(l,crypto.randomUUID()),e.getAttribute(l)}const ee=e=>[...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map(t=>`${t[1]}{${q(t[3])}}${t[4]}`).join(""),q=e=>{if(!e.trim())return e;const l=e.split("??"),t=l.shift(),s=q(l.join("??"));return l.length?`concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )`:e},k=(e,l)=>{e=q(e);const t=l.ownerDocument.evaluate(e,l);switch(t.resultType){case XPathResult.NUMBER_TYPE:return t.numberValue;case XPathResult.STRING_TYPE:return t.stringValue}let s="";for(let n;n=t.iterateNext();)s+=n.textContent;return s},te="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(","),se=(e,l)=>{const t=N("xsl:"+e.localName);for(let s of e.attributes)t.setAttribute(s.name,s.value);for(;e.firstChild;)t.append(e.firstChild);if(e.parentElement)e.parentElement.replaceChild(t,e);else{const s=e.parentElement||l,n=[...s.childNodes];n.forEach((r,f)=>{r===e&&(n[f]=t)}),s.replaceChildren(...n)}};class le extends HTMLElement{static observedAttributes=["src","tag","hidden"];async connectedCallback(){const l=await me(h(this,"src"),this),t=h(this,"tag"),s=t||"dce-"+crypto.randomUUID();for(const d of l)C(d.templateNode||d.content||d,"style",c=>{const a=c.closest("slot"),i=a?`slot[name="${a.name}"]`:"";c.innerHTML=`${s} ${i}{${c.innerHTML}}`,this.append(c)});const n=l.map(d=>B(d)),r=n.map((d,c)=>(c=new XSLTProcessor,c.importStylesheet(d),c));Object.defineProperty(this,"xsltString",{get:()=>n.map(d=>$(d)).join(`
50
- `)});const f=this,p=[...this.templateNode.querySelectorAll("[slice]")],b=p.map(d=>h(d,"slice")).filter(d=>!d.includes("/")).filter((d,c,a)=>a.indexOf(d)===c),u=n.reduce((d,c)=>(c.params&&d.push(...c.params),d),[]);class A extends HTMLElement{static get observedAttributes(){return u.map(c=>h(c,"name"))}#e=0;connectedCallback(){let c=this.childNodes;if(this.firstElementChild?.tagName==="TEMPLATE"){const m=this.firstElementChild;m.remove(),c=m.content.childNodes;for(const o of[...m.content.childNodes])if(o.localName==="style"){const y=Z(this,"data-dce-style");o.innerHTML=`${s}[data-dce-style="${y}"]{${o.innerHTML}}`,m.insertAdjacentElement("beforebegin",o)}else o.nodeType===1?m.insertAdjacentElement("beforebegin",o):o.nodeType===3&&m.insertAdjacentText("beforebegin",o.data)}const a=S("<datadom/>").documentElement,i=(m,o="")=>(y=>(o&&y.append(w(a,o)),y))(a.ownerDocument.createElement(m));j(a,"payload",c,ce),this.innerHTML="",j(a,"attributes",this.attributes,m=>i(m.nodeName,m.value)),j(a,"dataset",Object.keys(this.dataset),m=>i(m,this.dataset[m]));const E=j(a,"slice",b,m=>i(m,"")),v=m=>k(m,E);this.xml=a;const g=[],x=()=>{const m={};for(let o;o=g.pop();){const y=h(o.sliceElement,"slice");m[y]||(J(E,y,o),m[y]=o)}Object.keys(m).length!==0&&O()};let T;this.onSlice=m=>{m.stopPropagation?.(),m.sliceEventSource=m.currentTarget||m.target,g.push(m),T||(T=setTimeout(()=>{x(),T=0},10))};const O=this.transform=()=>{if(this.#e)debugger;this.#e=1,r.map((o,y)=>{const z=o.transformToFragment(a.ownerDocument,document);return z||console.error(`XSLT transformation error. xsl:
51
- `,$(n[y]),`
52
- xml:
53
- `,$(a)),z}).map(o=>{o&&(M(o),H(this,o.childNodes))}),A.observedAttributes.map(o=>{let y=h(this.firstElementChild,o);y!==h(this,o)&&(this.setAttribute(o,y),this.#t(o,y))}),C(this,"[slice]",o=>{if(!o.dceInitialized){o.dceInitialized=1;const y=h(o,"slice-event");(y||"change").split(" ").forEach(z=>(o.localName==="slice"?o.parentElement:o).addEventListener(z,V=>{V.sliceElement=o,this.onSlice(V)})),(!y||y.includes("init"))&&(o.hasAttribute("slice-value")||o.hasAttribute("value")||o.value?this.onSlice({type:"init",target:o,sliceElement:o}):o.value=v(h(o,"slice")))}}),this.#e=0};O(),x()}#t(c,a){let i=this.xml.querySelector(`attributes>${c}`);i?R(i).append(w(i,a)):(i=N(c,a,this.xml),this.xml.querySelector("attributes").append(i))}attributeChangedCallback(c,a,i){!this.xml||this.#e||(this.#t(c,i),this.transform())}get dce(){return f}}const L=d=>{window.customElements.get(d)!==A&&window.customElements.define(d,A)};if(t)L(t);else{const d=s;this.setAttribute("tag",d),L(d);const c=document.createElement(d);this.getAttributeNames().forEach(a=>c.setAttribute(a,this.getAttribute(a))),c.append(...[...this.childNodes].filter(a=>a.localName!=="style")),this.append(c)}}get templateNode(){return this.firstElementChild?.tagName==="TEMPLATE"?this.firstElementChild.content:this}get dce(){return this}get xslt(){return S(this.xsltString)}}window.customElements.define("custom-element",le);exports.CustomElement=le;exports.assureSlices=Y;exports.assureUID=Z;exports.assureUnique=M;exports.createXsltFromDom=B;exports.deepEqual=G;exports.evalCurly=ee;exports.event2slice=J;exports.merge=H;exports.mergeAttr=Q;exports.obj2node=D;exports.tagUid=U;exports.toXsl=se;exports.xPath=k;exports.xPathDefaults=q;exports.xhrTemplate=W;exports.xml2dom=S;exports.xmlString=$;exports.xslTags=te;
@@ -1,436 +0,0 @@
1
- const q = "http://www.w3.org/1999/XSL/Transform", z = "http://www.w3.org/1999/xhtml", W = "http://exslt.org/common", h = (e, l) => e.getAttribute?.(l), I = (e) => e.nodeType === 3, G = (e) => typeof e == "string", Y = (e) => e && typeof e.nodeType == "number", E = (e, l = "", t = document) => ((s) => (l && s.append(w(t.ownerDocument || t, l)), s))((t.ownerDocument || t).createElement(e)), w = (e, l) => (e.ownerDocument || e).createTextNode(l), O = (e) => {
2
- for (; e.firstChild; )
3
- e.firstChild.remove();
4
- return e;
5
- }, j = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), O(e)), J = (e) => (e?.setAttribute("xmlns:xsl", q), e), K = (e) => (e?.setAttribute("xmlns:xhtml", z), J(e)), k = (e, l) => {
6
- const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
7
- for (let s of e.attributes)
8
- t.setAttribute(s.name, s.value);
9
- for (; e.firstChild; )
10
- t.append(e.firstChild);
11
- return t;
12
- };
13
- function C(e) {
14
- return new DOMParser().parseFromString(e, "application/xml");
15
- }
16
- function R(e) {
17
- return new XMLSerializer().serializeToString(e);
18
- }
19
- function D(e, l, t, s) {
20
- const n = (p) => e.ownerDocument.createElement(p), f = ((p, y, u) => (y.append(u = n(p)), u))(l, e);
21
- return [...t].forEach((p) => f.append(s(p))), f;
22
- }
23
- function Q(e) {
24
- return e.slot || (e.setAttribute || (e = E("span", e.textContent.replaceAll(`
25
- `, ""))), e.setAttribute("slot", "")), e;
26
- }
27
- function X(e, l, t) {
28
- const s = typeof e;
29
- if (s === "function")
30
- debugger;
31
- if (s === "string")
32
- return E(l, e, t);
33
- if (s === "number")
34
- return E(l, "" + e, t);
35
- if (e instanceof Array) {
36
- const r = E("array");
37
- return e.map((f) => r.append(X(f, l, t))), r;
38
- }
39
- const n = E(l, "", t);
40
- for (let r in e)
41
- Y(e[r]) || typeof e[r] == "function" || e[r] instanceof Window || (typeof e[r] != "object" ? n.setAttribute(r, e[r]) : n.append(X(e[r], r, t)));
42
- return n;
43
- }
44
- function H(e) {
45
- if (S(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3).forEach((t) => {
46
- if (t.parentNode.localName === "style")
47
- return;
48
- const s = t.data.matchAll(/{([^}]*)}/g);
49
- if (s) {
50
- let n = 0, r = (p) => w(t, p || ""), f = [];
51
- if ([...s].forEach((p) => {
52
- p.index > n && f.push(r(p.input.substring(n, p.index)));
53
- const y = e.querySelector("value-of").cloneNode();
54
- y.setAttribute("select", p[1]), f.push(y), n = p.index + p[0].length;
55
- }), n < t.data.length && f.push(r(t.data.substring(n, t.data.length))), f.length) {
56
- for (let p of f)
57
- l.insertBefore(p, t);
58
- l.removeChild(t);
59
- }
60
- }
61
- })), "all" in e) {
62
- let l = 1;
63
- for (let t of e.all)
64
- t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
65
- }
66
- return e;
67
- }
68
- function Z(e, l = "xsl:stylesheet") {
69
- if (e.tagName === l || e.documentElement?.tagName === l)
70
- return H(e);
71
- const t = C(`<xsl:stylesheet version="1.0" xmlns:xsl="${q}" xmlns:xhtml="${z}" xmlns:exsl="${W}" exclude-result-prefixes="exsl" >
72
- <xsl:output method="xml" />
73
- <xsl:template match="/"><dce-root xmlns="${z}"><xsl:apply-templates select="*"/></dce-root></xsl:template>
74
- <xsl:template match="*[name()='template']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
75
- <xsl:template match="*"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
76
- <xsl:template match="*[name()='svg']|*[name()='math']"><xsl:apply-templates mode="sanitize" select="."/></xsl:template>
77
- <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>
78
- <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>
79
- <xsl:template mode="sanitize" match="*|@*"><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></xsl:template>
80
- <xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
81
- <xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
82
- <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>
83
- <xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
84
- </xsl:stylesheet>`), s = new XSLTProcessor(), n = ((a) => {
85
- S(a, "script", (g) => g.remove());
86
- const i = a.content ?? a.firstElementChild?.content ?? a.body ?? a;
87
- ie.forEach((g) => S(i, g, (x) => ce(x, i)));
88
- const N = a.firstElementChild?.content || a.content, v = (g) => {
89
- const x = C("<xhtml/>"), T = x.importNode(g, !0);
90
- return x.replaceChild(T, x.documentElement), K(T);
91
- };
92
- if (N) {
93
- const g = E("div");
94
- return [...N.childNodes].map((x) => g.append(x.cloneNode(!0))), v(g);
95
- }
96
- return v(a.documentElement || a.body || a);
97
- })(e), r = C(
98
- `<xsl:stylesheet version="1.0"
99
- xmlns:xsl="${q}"
100
- xmlns:xhtml="${z}"
101
- xmlns:dce="urn:schemas-epa-wg:dce"
102
- xmlns:exsl="http://exslt.org/common"
103
- exclude-result-prefixes="exsl"
104
- >
105
- <xsl:template match="ignore">
106
- <xsl:choose>
107
- <xsl:when test="//attr">{//attr}</xsl:when>
108
- <xsl:otherwise>{def}</xsl:otherwise>
109
- </xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
110
- <xsl:template mode="payload" match="attributes"></xsl:template>
111
- <xsl:template match="/">
112
- <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
113
- </xsl:template>
114
- <xsl:template name="slot" >
115
- <xsl:param name="slotname" />
116
- <xsl:param name="defaultvalue" />
117
- <xsl:choose>
118
- <xsl:when test="//payload/*[@slot=$slotname]">
119
- <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
120
- </xsl:when>
121
- <xsl:otherwise>
122
- <xsl:copy-of select="$defaultvalue"/>
123
- </xsl:otherwise>
124
- </xsl:choose>
125
- </xsl:template>
126
- <xsl:variable name="js-injected-body">
127
- <xsl:call-template name="slot" >
128
- <xsl:with-param name="slotname" select="''"/>
129
- <xsl:with-param name="defaultvalue"/>
130
- </xsl:call-template>
131
- </xsl:variable>
132
- </xsl:stylesheet>`
133
- );
134
- s.importStylesheet(t);
135
- const f = s.transformToFragment(n, document), p = (a, i) => a.querySelector(i), y = p(r, 'template[mode="payload"]');
136
- if (!f)
137
- return console.error("transformation error", { xml: n.outerHTML, xsl: R(t) });
138
- const u = [];
139
- [...f.querySelectorAll("dce-root>attribute")].forEach((a) => {
140
- const i = k(a, "xsl:param"), N = h(a, "name");
141
- y.append(i);
142
- let v = h(i, "select")?.split("??");
143
- v || (v = ["//" + N, `'${i.textContent}'`], j(i), i.setAttribute("name", N));
144
- let g;
145
- if (v?.length > 1) {
146
- i.removeAttribute("select");
147
- const x = p(r, 'template[match="ignore"]>choose').cloneNode(!0);
148
- j(x.firstElementChild).append(w(x, "{" + v[0] + "}")), j(x.lastElementChild).append(w(x, "{" + v[1] + "}")), x.firstElementChild.setAttribute("test", v[0]), i.append(x), g = x.cloneNode(!0);
149
- } else
150
- g = k(a, "xsl:value-of");
151
- g.removeAttribute("name"), a.append(g), a.removeAttribute("select"), u.push(i);
152
- }), [...f.querySelectorAll("[value]")].filter((a) => a.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((a) => {
153
- const i = h(a, "value");
154
- i && a.setAttribute("value", oe(i));
155
- });
156
- for (const a of f.childNodes)
157
- y.append(r.importNode(a, !0));
158
- [...y.querySelectorAll("template")].forEach((a) => y.ownerDocument.documentElement.append(a));
159
- const $ = p(r, 'call-template[name="slot"]'), d = (a) => {
160
- const i = $.cloneNode(!0), N = h(a, "name") || "";
161
- N && i.firstElementChild.setAttribute("select", `'${N}'`);
162
- for (let v of a.childNodes)
163
- i.lastElementChild.append(v);
164
- return i;
165
- };
166
- S(y, "slot", (a) => a.parentNode.replaceChild(d(a), a));
167
- const c = H(r);
168
- return c.params = u, c;
169
- }
170
- async function ee(e) {
171
- return await new Promise((t, s) => {
172
- const n = new XMLHttpRequest();
173
- n.open("GET", e), n.responseType = "document", n.onload = () => {
174
- n.readyState === n.DONE && n.status === 200 && t(n.responseXML || E("div", n.responseText)), s(n.statusText);
175
- }, n.addEventListener("error", (r) => s(r)), n.send();
176
- });
177
- }
178
- function te(e, l, t = !1) {
179
- if (e === l)
180
- return !0;
181
- if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
182
- return t;
183
- for (let s in e)
184
- if (!(s in l) || !te(e[s], l[s]))
185
- return t;
186
- return !0;
187
- }
188
- const se = (e, l) => l.split("|").map((t) => t.trim()).map((t) => {
189
- if (t.includes("/")) {
190
- const s = [], n = e.ownerDocument.evaluate(t, e);
191
- for (let r; r = n.iterateNext(); )
192
- s.push(r);
193
- return s;
194
- }
195
- return [...e.childNodes].find((s) => s.localName === t) || E(t);
196
- }).flat();
197
- function le(e, l, t, s) {
198
- se(e, l).map((n) => {
199
- const r = e.ownerDocument, f = t.sliceEventSource, p = t.sliceElement, y = () => [...n.childNodes].filter((u) => u.nodeType === 3 || u.localName === "value").map((u) => u.remove());
200
- if (f.getAttributeNames().map((u) => n.setAttribute(u, h(f, u))), [...n.childNodes].filter((u) => u.localName === "event").map((u) => u.remove()), t.type === "init" && y(), n.append(X(t, "event", r)), p.hasAttribute("slice-value")) {
201
- f.value === void 0 ? n.removeAttribute("value") : n.setAttribute("value", f.value);
202
- const u = B(h(p, "slice-value"), n);
203
- y(), n.append(w(r, u));
204
- } else {
205
- const u = f.value ?? h(p, "value");
206
- y(), u == null ? [...n.childNodes].filter((A) => A.localName !== "event").map((A) => A.remove()) : G(u) ? n.append(w(r, u)) : n.append(X(u, "value", n.ownerDocument));
207
- }
208
- });
209
- }
210
- function S(e, l, t) {
211
- e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
212
- }
213
- const V = (e, l) => ((t) => e === t ? null : t && (t.querySelector(l) || V(t, l)))(e.getRootNode()), ne = async (e, l) => {
214
- if (!e || !e.trim())
215
- return [l];
216
- if (e.startsWith("#"))
217
- return ((t) => {
218
- if (!t)
219
- return [];
220
- const s = t.querySelectorAll(e);
221
- if (s.length)
222
- return [...s];
223
- const n = t.getRootNode();
224
- return n === t ? [] : V(n);
225
- })(l.parentElement);
226
- try {
227
- const t = await ee(e), s = new URL(e, location).hash;
228
- if (s) {
229
- const n = t.querySelectorAll(s);
230
- return n.length ? [...n] : [l];
231
- }
232
- return [t];
233
- } catch {
234
- return [l];
235
- }
236
- };
237
- function ae(e, l) {
238
- if (I(e)) {
239
- if (!I(l))
240
- debugger;
241
- return;
242
- }
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 _(e, l = 0) {
247
- const t = {};
248
- for (const s of e.childNodes) {
249
- const n = h(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 r = s.dceId = n + "-" + t[n]++;
254
- s.setAttribute && s.setAttribute("data-dce-id", r);
255
- }
256
- s.childNodes.length && _(s);
257
- }
258
- }
259
- function F(e, l) {
260
- if (!l.length)
261
- return O(e);
262
- const t = {};
263
- for (let s of e.childNodes)
264
- t[s.dceId], I(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[h(s, "data-dce-id") || 0] = s;
265
- for (let s of [...l]) {
266
- const n = h(s, "data-dce-id") || s.dceId, r = t[n];
267
- r ? (I(s) ? r.nodeValue !== s.nodeValue && (r.nodeValue = s.nodeValue) : (ae(s, r), (r.childNodes.length || s.childNodes.length) && F(r, s.childNodes)), delete t[n]) : e.append(s);
268
- }
269
- for (let s of Object.values(t))
270
- s.remove();
271
- }
272
- function re(e, l) {
273
- return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
274
- }
275
- const oe = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${M(t[3])}}${t[4]}`).join(""), M = (e) => {
276
- if (!e.trim())
277
- return e;
278
- const l = e.split("??"), t = l.shift(), s = M(l.join("??"));
279
- return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
280
- }, B = (e, l) => {
281
- e = M(e);
282
- const t = l.ownerDocument.evaluate(e, l);
283
- switch (t.resultType) {
284
- case XPathResult.NUMBER_TYPE:
285
- return t.numberValue;
286
- case XPathResult.STRING_TYPE:
287
- return t.stringValue;
288
- }
289
- let s = "";
290
- for (let n; n = t.iterateNext(); )
291
- s += n.textContent;
292
- return s;
293
- }, ie = "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(","), ce = (e, l) => {
294
- const t = E("xsl:" + e.localName);
295
- for (let s of e.attributes)
296
- t.setAttribute(s.name, s.value);
297
- for (; e.firstChild; )
298
- t.append(e.firstChild);
299
- if (e.parentElement)
300
- e.parentElement.replaceChild(t, e);
301
- else {
302
- const s = e.parentElement || l, n = [...s.childNodes];
303
- n.forEach((r, f) => {
304
- r === e && (n[f] = t);
305
- }), s.replaceChildren(...n);
306
- }
307
- };
308
- class me extends HTMLElement {
309
- static observedAttributes = ["src", "tag", "hidden"];
310
- async connectedCallback() {
311
- const l = await ne(h(this, "src"), this), t = h(this, "tag"), s = t || "dce-" + crypto.randomUUID();
312
- for (const d of l)
313
- S(d.templateNode || d.content || d, "style", (c) => {
314
- const a = c.closest("slot"), i = a ? `slot[name="${a.name}"]` : "";
315
- c.innerHTML = `${s} ${i}{${c.innerHTML}}`, this.append(c);
316
- });
317
- const n = l.map((d) => Z(d)), r = n.map((d, c) => (c = new XSLTProcessor(), c.importStylesheet(d), c));
318
- Object.defineProperty(this, "xsltString", { get: () => n.map((d) => R(d)).join(`
319
- `) });
320
- const f = this, p = [...this.templateNode.querySelectorAll("[slice]")], y = p.map((d) => h(d, "slice")).filter((d) => !d.includes("/")).filter((d, c, a) => a.indexOf(d) === c), u = n.reduce((d, c) => (c.params && d.push(...c.params), d), []);
321
- class A extends HTMLElement {
322
- static get observedAttributes() {
323
- return u.map((c) => h(c, "name"));
324
- }
325
- #e = 0;
326
- connectedCallback() {
327
- let c = this.childNodes;
328
- if (this.firstElementChild?.tagName === "TEMPLATE") {
329
- const m = this.firstElementChild;
330
- m.remove(), c = m.content.childNodes;
331
- for (const o of [...m.content.childNodes])
332
- if (o.localName === "style") {
333
- const b = re(this, "data-dce-style");
334
- o.innerHTML = `${s}[data-dce-style="${b}"]{${o.innerHTML}}`, m.insertAdjacentElement("beforebegin", o);
335
- } else
336
- o.nodeType === 1 ? m.insertAdjacentElement("beforebegin", o) : o.nodeType === 3 && m.insertAdjacentText("beforebegin", o.data);
337
- }
338
- const a = C("<datadom/>").documentElement, i = (m, o = "") => ((b) => (o && b.append(w(a, o)), b))(a.ownerDocument.createElement(m));
339
- D(a, "payload", c, Q), this.innerHTML = "", D(a, "attributes", this.attributes, (m) => i(m.nodeName, m.value)), D(a, "dataset", Object.keys(this.dataset), (m) => i(m, this.dataset[m]));
340
- const N = D(a, "slice", y, (m) => i(m, "")), v = (m) => B(m, N);
341
- this.xml = a;
342
- const g = [], x = () => {
343
- const m = {};
344
- for (let o; o = g.pop(); ) {
345
- const b = h(o.sliceElement, "slice");
346
- m[b] || (le(N, b, o), m[b] = o);
347
- }
348
- Object.keys(m).length !== 0 && P();
349
- };
350
- let T;
351
- this.onSlice = (m) => {
352
- m.stopPropagation?.(), m.sliceEventSource = m.currentTarget || m.target, g.push(m), T || (T = setTimeout(() => {
353
- x(), T = 0;
354
- }, 10));
355
- };
356
- const P = this.transform = () => {
357
- if (this.#e)
358
- debugger;
359
- this.#e = 1, r.map((o, b) => {
360
- const L = o.transformToFragment(a.ownerDocument, document);
361
- return L || console.error(`XSLT transformation error. xsl:
362
- `, R(n[b]), `
363
- xml:
364
- `, R(a)), L;
365
- }).map((o) => {
366
- o && (_(o), F(this, o.childNodes));
367
- }), A.observedAttributes.map((o) => {
368
- let b = h(this.firstElementChild, o);
369
- b !== h(this, o) && (this.setAttribute(o, b), this.#t(o, b));
370
- }), S(this, "[slice]", (o) => {
371
- if (!o.dceInitialized) {
372
- o.dceInitialized = 1;
373
- const b = h(o, "slice-event");
374
- (b || "change").split(" ").forEach((L) => (o.localName === "slice" ? o.parentElement : o).addEventListener(L, (U) => {
375
- U.sliceElement = o, this.onSlice(U);
376
- })), (!b || b.includes("init")) && (o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value ? this.onSlice({ type: "init", target: o, sliceElement: o }) : o.value = v(h(o, "slice")));
377
- }
378
- }), this.#e = 0;
379
- };
380
- P(), x();
381
- }
382
- #t(c, a) {
383
- let i = this.xml.querySelector(`attributes>${c}`);
384
- i ? j(i).append(w(i, a)) : (i = E(c, a, this.xml), this.xml.querySelector("attributes").append(i));
385
- }
386
- attributeChangedCallback(c, a, i) {
387
- !this.xml || this.#e || (this.#t(c, i), this.transform());
388
- }
389
- get dce() {
390
- return f;
391
- }
392
- }
393
- const $ = (d) => {
394
- window.customElements.get(d) !== A && window.customElements.define(d, A);
395
- };
396
- if (t)
397
- $(t);
398
- else {
399
- const d = s;
400
- this.setAttribute("tag", d), $(d);
401
- const c = document.createElement(d);
402
- this.getAttributeNames().forEach((a) => c.setAttribute(a, this.getAttribute(a))), c.append(...[...this.childNodes].filter((a) => a.localName !== "style")), this.append(c);
403
- }
404
- }
405
- get templateNode() {
406
- return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
407
- }
408
- get dce() {
409
- return this;
410
- }
411
- get xslt() {
412
- return C(this.xsltString);
413
- }
414
- }
415
- window.customElements.define("custom-element", me);
416
- export {
417
- me as C,
418
- R as a,
419
- ee as b,
420
- Z as c,
421
- te as d,
422
- se as e,
423
- le as f,
424
- _ as g,
425
- F as h,
426
- re as i,
427
- oe as j,
428
- M as k,
429
- B as l,
430
- ae as m,
431
- ie as n,
432
- X as o,
433
- ce as p,
434
- H as t,
435
- C as x
436
- };
@@ -1,14 +0,0 @@
1
- import {describe} from 'vitest';
2
-
3
- import '../custom-element/custom-element.js';
4
- import meta from "./attributes.stories.ts";
5
-
6
- import * as Stories from "./attributes.stories.ts";
7
- import {playStories} from './renderPlay';
8
-
9
-
10
- describe('attributes', () =>
11
- {
12
- localStorage.clear();
13
- playStories( Stories, meta );
14
- });
@@ -1,12 +0,0 @@
1
- import {describe} from 'vitest';
2
-
3
- import '../custom-element/custom-element.js';
4
- import meta from "./css.stories.ts";
5
-
6
- import * as Stories from "./css.stories.ts";
7
- import {playStories} from './renderPlay';
8
-
9
- describe('Css', () =>
10
- {
11
- playStories( Stories, meta );
12
- });
@@ -1,12 +0,0 @@
1
- import {describe, it} from 'vitest';
2
-
3
- import '../custom-element/custom-element.js';
4
- import meta from "./dom-merge.stories.ts";
5
-
6
- import * as Stories from "./dom-merge.stories.ts";
7
- import {playStories} from './renderPlay';
8
-
9
- describe('dom-merge', () => {
10
- localStorage.clear();
11
- playStories( Stories, meta );
12
- });
@@ -1,12 +0,0 @@
1
- import {describe, it} from 'vitest';
2
-
3
- import '../custom-element/custom-element.js';
4
- import meta from "./external-template.stories.ts";
5
-
6
- import * as Stories from "./external-template.stories.ts";
7
- import {playStories} from './renderPlay';
8
-
9
- describe('external-template', () => {
10
- localStorage.clear();
11
- playStories( Stories, meta );
12
- });
@@ -1,12 +0,0 @@
1
- import {describe} from 'vitest';
2
-
3
- import '../custom-element/custom-element.js';
4
- import meta from "./local-storage.stories.ts";
5
-
6
- import * as Stories from "./local-storage.stories.ts";
7
- import {playStories} from './renderPlay';
8
-
9
- describe('local-storage', () => {
10
- localStorage.clear();
11
- playStories( Stories, meta );
12
- });
@@ -1,14 +0,0 @@
1
- import {describe, it} from 'vitest';
2
- import {type StoryObj} from "@storybook/web-components";
3
-
4
-
5
- import '../custom-element/custom-element.js';
6
- import meta from "./location-element.stories.ts";
7
-
8
- import * as Stories from "./location-element.stories.ts";
9
- import {playStories} from './renderPlay';
10
-
11
- describe('location-element', () => {
12
- localStorage.clear();
13
- playStories( Stories, meta );
14
- });
@@ -1,12 +0,0 @@
1
- import {describe} from 'vitest';
2
-
3
- import '../custom-element/custom-element.js';
4
- import meta from "./slice-events.stories.ts";
5
-
6
- import * as Stories from "./slice-events.stories.ts";
7
- import {playStories} from './renderPlay';
8
-
9
- describe('slice-events', () => {
10
- localStorage.clear();
11
- playStories( Stories, meta );
12
- });
@@ -1,2 +0,0 @@
1
- const __vite__fileDeps=["./index-DgaNIR0t.js","./index-DnEJ_bKa.js","./index-CBQwM6ST.js","./iframe-gCvlWuoC.js","./index-Cc7K62zD.js","./index-Dkj0J1ds.js","./index-DrFu-skq.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
2
- import{_ as l}from"./iframe-gCvlWuoC.js";import{r as h,R as o,d as a,C as E,A as R,H as x,D as y}from"./index-CBQwM6ST.js";import"../sb-preview/runtime.js";import"./index-Cc7K62zD.js";import"./index-Dkj0J1ds.js";import"./index-DrFu-skq.js";var c={},m=h;c.createRoot=m.createRoot,c.hydrateRoot=m.hydrateRoot;var n=new Map,D=({callback:e,children:t})=>{let r=a.useRef();return a.useLayoutEffect(()=>{r.current!==e&&(r.current=e,e())},[e]),t},_=async(e,t)=>{let r=await w(t);return new Promise(s=>{r.render(o.createElement(D,{callback:()=>s(null)},e))})},v=(e,t)=>{let r=n.get(e);r&&(r.unmount(),n.delete(e))},w=async e=>{let t=n.get(e);return t||(t=c.createRoot(e),n.set(e,t)),t},f={code:E,a:R,...x},g=class extends a.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){let{showException:t}=this.props;t(e)}render(){let{hasError:e}=this.state,{children:t}=this.props;return e?null:o.createElement(o.Fragment,null,t)}},L=class{constructor(){this.render=async(e,t,r)=>{let s={...f,...t?.components},u=y;return new Promise((i,d)=>{l(()=>import("./index-DgaNIR0t.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(({MDXProvider:p})=>_(o.createElement(g,{showException:d,key:Math.random()},o.createElement(p,{components:s},o.createElement(u,{context:e,docsParameter:t}))),r)).then(()=>i())})},this.unmount=e=>{v(e)}}};export{L as DocsRenderer,f as defaultComponents};
@@ -1 +0,0 @@
1
- import{W as a,W as T,b as e}from"./index-CBQwM6ST.js";import"./iframe-gCvlWuoC.js";import"../sb-preview/runtime.js";import"./index-Cc7K62zD.js";import"./index-Dkj0J1ds.js";import"./index-DrFu-skq.js";export{a as WithToolTipState,T as WithTooltip,e as WithTooltipPure};