@epa-wg/custom-element-dist 0.0.32 → 0.0.34

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 (300) hide show
  1. package/.claude/settings.local.json +18 -0
  2. package/.github/workflows/deploy.yml +59 -0
  3. package/.idea/copilot.data.migration.agent.xml +6 -0
  4. package/.idea/copilot.data.migration.ask.xml +6 -0
  5. package/.idea/copilot.data.migration.edit.xml +6 -0
  6. package/.idea/custom-element-dist.iml +2 -0
  7. package/.storybook/main.ts +20 -21
  8. package/.storybook/preview.ts +23 -25
  9. package/README.md +6 -4
  10. package/coverage/block-navigation.js +1 -1
  11. package/coverage/coverage-final.json +8 -18
  12. package/coverage/index.html +45 -30
  13. package/coverage/sorter.js +21 -7
  14. package/coverage/src/custom-element/coverage.svg +1 -1
  15. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  16. package/coverage/src/custom-element/custom-element.js.html +687 -480
  17. package/coverage/src/custom-element/http-request.js/coverage.svg +1 -1
  18. package/coverage/src/custom-element/http-request.js.html +39 -18
  19. package/coverage/src/custom-element/index.html +35 -35
  20. package/coverage/src/custom-element/local-storage.js.html +1 -1
  21. package/coverage/src/custom-element/location-element.js.html +31 -31
  22. package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
  23. package/coverage/src/custom-element/module-url.js.html +20 -20
  24. package/coverage/src/index.html +1 -1
  25. package/coverage/src/{stories/local-storage.test.stories.ts → material/theme/colors.js}/coverage.svg +1 -1
  26. package/coverage/src/material/theme/colors.js.html +217 -0
  27. package/coverage/src/{stories/location-element.test.stories.ts → material/theme}/coverage.svg +1 -1
  28. package/coverage/src/material/theme/index.html +116 -0
  29. package/coverage/src/mocks/handlers.ts.html +1 -1
  30. package/coverage/src/mocks/index.html +1 -1
  31. package/coverage/src/stories/coverage.svg +1 -1
  32. package/coverage/src/stories/{external-template.test.stories.ts → frame.canvas.ts}/coverage.svg +1 -1
  33. package/coverage/src/stories/frame.canvas.ts.html +175 -0
  34. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  35. package/coverage/src/stories/index.html +14 -179
  36. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  37. package/coverage/src/sum.ts.html +1 -1
  38. package/dist/custom-element-BoYMoUtP.js +619 -0
  39. package/dist/custom-element-BqtjrCRF.cjs +97 -0
  40. package/dist/custom-element-bundle.cjs +1 -1
  41. package/dist/custom-element-bundle.js +3 -3
  42. package/dist/demo/a.html +10 -3
  43. package/dist/demo/a.svg +26 -26
  44. package/dist/demo/attributes.html +153 -0
  45. package/dist/demo/external-templates-sb-6.html +42 -0
  46. package/dist/demo/external-templates-sb-7.html +42 -0
  47. package/dist/demo/html-template.html +5 -4
  48. package/dist/demo/module-url-sb-2.html +46 -0
  49. package/dist/demo/module-url-sb-4.html +48 -0
  50. package/dist/demo/module-url-sb-5.html +53 -0
  51. package/dist/demo/s.xml +3859 -7
  52. package/dist/demo/s.xslt +13 -48
  53. package/dist/demo/s1.xml +3706 -0
  54. package/dist/demo/ss.html +13 -4
  55. package/dist/http-request-DSaowcG1.cjs +1 -0
  56. package/dist/{http-request-BOvP4KTl.js → http-request-DTCzZ1gc.js} +15 -9
  57. package/dist/mockServiceWorker.js +31 -8
  58. package/package.json +25 -26
  59. package/public/demo/a.html +10 -3
  60. package/public/demo/a.svg +26 -26
  61. package/public/demo/attributes.html +153 -0
  62. package/public/demo/external-templates-sb-6.html +42 -0
  63. package/public/demo/external-templates-sb-7.html +42 -0
  64. package/public/demo/html-template.html +5 -4
  65. package/public/demo/module-url-sb-2.html +46 -0
  66. package/public/demo/module-url-sb-4.html +48 -0
  67. package/public/demo/module-url-sb-5.html +53 -0
  68. package/public/demo/s.xml +3859 -7
  69. package/public/demo/s.xslt +13 -48
  70. package/public/demo/s1.xml +3706 -0
  71. package/public/demo/ss.html +13 -4
  72. package/public/mockServiceWorker.js +31 -8
  73. package/src/custom-element/custom-element.d.ts +4 -0
  74. package/src/custom-element/custom-element.js +119 -50
  75. package/src/custom-element/demo/a.html +10 -3
  76. package/src/custom-element/demo/a.svg +26 -26
  77. package/src/custom-element/demo/attributes.html +153 -0
  78. package/src/custom-element/demo/html-template.html +5 -4
  79. package/src/custom-element/demo/s.xml +3859 -7
  80. package/src/custom-element/demo/s.xslt +13 -48
  81. package/src/custom-element/demo/s1.xml +3706 -0
  82. package/src/custom-element/demo/ss.html +13 -4
  83. package/src/custom-element/http-request.js +7 -0
  84. package/src/custom-element/ide/web-types-dce.json +1 -1
  85. package/src/custom-element/ide/web-types-xsl.json +1 -1
  86. package/src/custom-element/index.html +1 -1
  87. package/src/material/angular.css +987 -987
  88. package/src/material/components/action.html +262 -0
  89. package/src/material/components/autocomplete.html +167 -239
  90. package/src/material/components/badge.html +239 -0
  91. package/src/material/components/dropdown.html +7 -13
  92. package/src/material/components/icon-link.html +160 -160
  93. package/src/material/components/icon.html +252 -0
  94. package/src/material/components/input.html +569 -362
  95. package/src/material/components/menu.html +235 -234
  96. package/src/material/components.html +157 -121
  97. package/src/material/demo.css +36 -36
  98. package/src/material/index.html +109 -110
  99. package/src/material/material.css +356 -356
  100. package/src/material/theme/Base-Principles.md +339 -0
  101. package/src/material/theme/README.md +298 -18
  102. package/src/material/theme/UI Domain Model in web applications.svg +1 -0
  103. package/src/material/theme/User Semantic Theme tokens.svg +1 -0
  104. package/src/material/theme/action-pending-poc.html +62 -0
  105. package/src/material/theme/actions-color.html +141 -0
  106. package/src/material/theme/colors-light.html +631 -0
  107. package/src/material/theme/colors-native.html +51 -0
  108. package/src/material/theme/colors-poc.html +66 -0
  109. package/src/material/theme/colors.html +297 -0
  110. package/src/material/theme/colors.js +44 -0
  111. package/src/material/theme/consumer-theme.css +745 -0
  112. package/src/material/theme/semantic.css +132 -113
  113. package/src/material/theme/style-bug.html +123 -0
  114. package/src/material/theme/theme-data.css +43 -0
  115. package/src/material/theme/theme-data.xhtml +2926 -0
  116. package/src/material/theme/todo.md +274 -0
  117. package/src/material/theme/tokens/action-colors.png +0 -0
  118. package/src/material/theme/tokens/cem-article-illustration-4x1-letterbox-2000x500.png +0 -0
  119. package/src/material/theme/tokens/cem-breakpoints.md +519 -0
  120. package/src/material/theme/tokens/cem-colors.md +715 -0
  121. package/src/material/theme/tokens/cem-consumerflow-typography-matrix.svg +198 -0
  122. package/src/material/theme/tokens/cem-coupling.md +372 -0
  123. package/src/material/theme/tokens/cem-data-vs-reading-numerals.svg +164 -0
  124. package/src/material/theme/tokens/cem-dimension.md +625 -0
  125. package/src/material/theme/tokens/cem-layering.md +562 -0
  126. package/src/material/theme/tokens/cem-m3-parity.md +343 -0
  127. package/src/material/theme/tokens/cem-responsive.md +238 -0
  128. package/src/material/theme/tokens/cem-shape.md +691 -0
  129. package/src/material/theme/tokens/cem-stroke-density-illustration-4to1-v3.svg +102 -0
  130. package/src/material/theme/tokens/cem-stroke.md +480 -0
  131. package/src/material/theme/tokens/cem-timing.md +198 -0
  132. package/src/material/theme/tokens/cem-typography-model-stack.svg +64 -0
  133. package/src/material/theme/tokens/cem-voice-fonts-typography.md +718 -0
  134. package/src/material/theme/tokens/cem-voice-ladder.svg +91 -0
  135. package/src/material/theme/tokens/chips.png +0 -0
  136. package/src/material/theme/tokens/columns-page.png +0 -0
  137. package/src/material/theme/tokens/initials.png +0 -0
  138. package/src/material/theme/tokens/nav-buttons.png +0 -0
  139. package/src/material/theme/tokens/script.png +0 -0
  140. package/src/material/theme/tokens/sufler.png +0 -0
  141. package/src/material/theme/tokens/typography-icons.png +0 -0
  142. package/src/mocks/versions.mock.ts +1 -1
  143. package/src/stories/__screenshots__/attributes.test.stories.ts +1 -0
  144. package/src/stories/__screenshots__/dom-merge.test.stories.ts/dom-merge-dom-merge-OrderPreservingOn2ndTransform-1.png +0 -0
  145. package/src/stories/__screenshots__/external-template.test.stories.ts +1 -0
  146. package/src/stories/__screenshots__/module-url.test.stories.ts +1 -0
  147. package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-definition-1.png +0 -0
  148. package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-runtime-change-1.png +0 -0
  149. package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-1.png +0 -0
  150. package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-2.png +0 -0
  151. package/src/stories/__screenshots__/stories.test.ts/attributes-cloneAs-el-newTag--1.png +0 -0
  152. package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---1.png +0 -0
  153. package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---2.png +0 -0
  154. package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---3.png +0 -0
  155. package/src/stories/__screenshots__/stories.test.ts/attributes-mix-to-from--1.png +0 -0
  156. package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-definition-1.png +0 -0
  157. package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-runtime-change-1.png +0 -0
  158. package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-1.png +0 -0
  159. package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-2.png +0 -0
  160. package/src/stories/__screenshots__/stories.test.ts/http-request-cloneAs-el-newTag--1.png +0 -0
  161. package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-headers-and-response-status-and-headers-1.png +0 -0
  162. package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-delayed--5-seconds-response-1.png +0 -0
  163. package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-error-1.png +0 -0
  164. package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---1.png +0 -0
  165. package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---2.png +0 -0
  166. package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---3.png +0 -0
  167. package/src/stories/__screenshots__/stories.test.ts/http-request-mix-to-from--1.png +0 -0
  168. package/src/stories/__screenshots__/stories.test.ts/http-request-url-and-slice-1.png +0 -0
  169. package/src/stories/__screenshots__/stories.test.ts/http-request-url-change-1.png +0 -0
  170. package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-MultipleIfOrderingWorkaround-1.png +0 -0
  171. package/src/stories/attributes.test.stories.ts +83 -17
  172. package/src/stories/dom-merge.test.stories.ts +25 -1
  173. package/src/stories/external-template.test.stories.ts +16 -14
  174. package/src/stories/frame.canvas.ts +31 -0
  175. package/src/stories/module-url.test.stories.ts +29 -61
  176. package/src/stories/xslt-conditionals.test.stories.ts +492 -0
  177. package/src/stories/xslt-if.test.stories.ts +89 -0
  178. package/storybook-static/assets/Color-F6OSRLHC-CzTOSlqB.js +1 -0
  179. package/storybook-static/assets/Configure-7GqRsAoJ.js +165 -0
  180. package/storybook-static/assets/DocsRenderer-CFRXHY34-Duc5rSIm.js +2 -0
  181. package/storybook-static/assets/{attributes.test.stories-D1X6EBrd.js → attributes.test.stories-DYuxF8h1.js} +109 -38
  182. package/storybook-static/assets/{css.test.stories-Cp_g2hE1.js → css.test.stories-LOmvINyb.js} +1 -1
  183. package/storybook-static/assets/custom-element-Bwx7otrT.js +97 -0
  184. package/storybook-static/assets/{dom-merge.test.stories-hbpdCka0.js → dom-merge.test.stories-CEKhWjaS.js} +47 -6
  185. package/storybook-static/assets/entry-preview-BNCt9WBs.js +26 -0
  186. package/storybook-static/assets/entry-preview-docs-CbF8-81D.js +2 -0
  187. package/storybook-static/assets/{external-template.test.stories-BK89h6sk.js → external-template.test.stories-jHu0wsJ-.js} +38 -40
  188. package/storybook-static/assets/{form.test.stories-BfoLe_rw.js → form.test.stories-CUyUnmwP.js} +1 -1
  189. package/storybook-static/assets/frame.canvas-E5n9h6j1.js +1 -0
  190. package/storybook-static/assets/{handlers-yVPwH_Nz.js → handlers-F7GUfMqr.js} +17 -14
  191. package/storybook-static/assets/http-request-BWeEEBkP.js +1 -0
  192. package/storybook-static/assets/{http-request.stories-CBFJS2Ws.js → http-request.stories-wyX5-QOv.js} +1 -1
  193. package/storybook-static/assets/iframe-BS_DPWl0.js +199 -0
  194. package/storybook-static/assets/index-CGuyH0k-.js +240 -0
  195. package/storybook-static/assets/index-DB7LLObI.js +1 -0
  196. package/storybook-static/assets/index-DO1nmyvI.js +11 -0
  197. package/storybook-static/assets/index-V1EGs-wm.js +621 -0
  198. package/storybook-static/assets/{local-storage.test.stories-C0Yzy6Am.js → local-storage.test.stories-BxOhsf1k.js} +1 -1
  199. package/storybook-static/assets/{location-element.test.stories-DNFrEu5A.js → location-element.test.stories-DqhvvUoa.js} +1 -1
  200. package/storybook-static/assets/module-url.test.stories-C1gG9G7Y.js +142 -0
  201. package/storybook-static/assets/preview-1xJJ3sKE.js +1 -0
  202. package/storybook-static/assets/preview-Bn8igYMp.js +1 -0
  203. package/storybook-static/assets/preview-CTOeX_lO.js +1 -0
  204. package/storybook-static/assets/preview-Cwy1XFu2.js +2 -0
  205. package/storybook-static/assets/preview-D6sehqkw.js +50 -0
  206. package/storybook-static/assets/preview-DfTudP20.js +1 -0
  207. package/storybook-static/assets/{set-url.test.stories-BBfLxv2u.js → set-url.test.stories-BKQNdknJ.js} +1 -1
  208. package/storybook-static/assets/{slice-events.test.stories-HcXF8XQI.js → slice-events.test.stories-ChqULCeA.js} +1 -1
  209. package/storybook-static/assets/{slots.test.stories-i6mnIFM2.js → slots.test.stories-BlyLoCRe.js} +1 -1
  210. package/storybook-static/assets/{version-select.test.stories-BsUFH6Va.js → version-select.test.stories-CPGSh1tR.js} +1 -1
  211. package/storybook-static/assets/xslt-conditionals.test.stories-YC6QPqWZ.js +633 -0
  212. package/storybook-static/assets/xslt-if.test.stories-BRSWy2-x.js +71 -0
  213. package/storybook-static/demo/a.html +10 -3
  214. package/storybook-static/demo/a.svg +26 -26
  215. package/storybook-static/demo/attributes.html +153 -0
  216. package/storybook-static/demo/external-templates-sb-6.html +42 -0
  217. package/storybook-static/demo/external-templates-sb-7.html +42 -0
  218. package/storybook-static/demo/html-template.html +5 -4
  219. package/storybook-static/demo/module-url-sb-2.html +46 -0
  220. package/storybook-static/demo/module-url-sb-4.html +48 -0
  221. package/storybook-static/demo/module-url-sb-5.html +53 -0
  222. package/storybook-static/demo/s.xml +3859 -7
  223. package/storybook-static/demo/s.xslt +13 -48
  224. package/storybook-static/demo/s1.xml +3706 -0
  225. package/storybook-static/demo/ss.html +13 -4
  226. package/storybook-static/iframe.html +2 -2
  227. package/storybook-static/index.html +6 -10
  228. package/storybook-static/index.json +1 -1
  229. package/storybook-static/mockServiceWorker.js +31 -8
  230. package/storybook-static/project.json +1 -1
  231. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
  232. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +8 -8
  233. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +394 -0
  234. package/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +233 -0
  235. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  236. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  237. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
  238. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  239. package/storybook-static/sb-addons/interactions-9/manager-bundle.js +58 -58
  240. package/storybook-static/sb-manager/globals-module-info.js +9 -0
  241. package/storybook-static/sb-manager/globals-runtime.js +10719 -10473
  242. package/storybook-static/sb-manager/runtime.js +4944 -6321
  243. package/coverage/src/stories/attributes.test.stories.ts/coverage.svg +0 -10
  244. package/coverage/src/stories/attributes.test.stories.ts.html +0 -814
  245. package/coverage/src/stories/css.test.stories.ts/coverage.svg +0 -10
  246. package/coverage/src/stories/css.test.stories.ts.html +0 -460
  247. package/coverage/src/stories/dom-merge.test.stories.ts/coverage.svg +0 -10
  248. package/coverage/src/stories/dom-merge.test.stories.ts.html +0 -706
  249. package/coverage/src/stories/external-template.test.stories.ts.html +0 -865
  250. package/coverage/src/stories/form.test.stories.ts/coverage.svg +0 -10
  251. package/coverage/src/stories/form.test.stories.ts.html +0 -661
  252. package/coverage/src/stories/local-storage.test.stories.ts.html +0 -1315
  253. package/coverage/src/stories/location-element.test.stories.ts.html +0 -523
  254. package/coverage/src/stories/module-url.test.stories.ts/coverage.svg +0 -10
  255. package/coverage/src/stories/module-url.test.stories.ts.html +0 -640
  256. package/coverage/src/stories/set-url.test.stories.ts/coverage.svg +0 -10
  257. package/coverage/src/stories/set-url.test.stories.ts.html +0 -433
  258. package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +0 -10
  259. package/coverage/src/stories/slice-events.test.stories.ts.html +0 -952
  260. package/coverage/src/stories/slots.test.stories.ts/coverage.svg +0 -10
  261. package/coverage/src/stories/slots.test.stories.ts.html +0 -742
  262. package/coverage/src/stories/version-select.test.stories.ts/coverage.svg +0 -10
  263. package/coverage/src/stories/version-select.test.stories.ts.html +0 -397
  264. package/dist/custom-element-D2wf_rqP.js +0 -576
  265. package/dist/custom-element-Dtzhbjkc.cjs +0 -97
  266. package/dist/http-request-DPrY7mGh.cjs +0 -1
  267. package/storybook-static/assets/Color-F6OSRLHC-BU3iy8jH.js +0 -1
  268. package/storybook-static/assets/Configure-DN6ifayP.js +0 -165
  269. package/storybook-static/assets/DocsRenderer-CFRXHY34-BaVEufDj.js +0 -2
  270. package/storybook-static/assets/custom-element-uuAtIYWS.js +0 -97
  271. package/storybook-static/assets/entry-preview-DHVXbf3x.js +0 -26
  272. package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +0 -2
  273. package/storybook-static/assets/http-request-DNq59pnj.js +0 -1
  274. package/storybook-static/assets/iframe-CJEL_4Nu.js +0 -2
  275. package/storybook-static/assets/index-BcZLpTeD.js +0 -8
  276. package/storybook-static/assets/index-CxRwF5Or.js +0 -234
  277. package/storybook-static/assets/index-D-8MO0q_.js +0 -1
  278. package/storybook-static/assets/index-D5fBh-7N.js +0 -1
  279. package/storybook-static/assets/index-DM-KBPdl.js +0 -1
  280. package/storybook-static/assets/index-RSFf30w1.js +0 -1
  281. package/storybook-static/assets/index-SnjB5uV8.js +0 -769
  282. package/storybook-static/assets/module-url.test.stories-CXibF5Ta.js +0 -208
  283. package/storybook-static/assets/preview-BhhEZcNS.js +0 -1
  284. package/storybook-static/assets/preview-Bnd0XhaF.js +0 -52
  285. package/storybook-static/assets/preview-CNKoaWES.js +0 -1
  286. package/storybook-static/assets/preview-DAeyCMnM.js +0 -1
  287. package/storybook-static/assets/preview-DHPc-V4N.js +0 -1
  288. package/storybook-static/assets/preview-DJMlNTk8.js +0 -2
  289. package/storybook-static/assets/preview-DYzi3Z2p.js +0 -1
  290. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +0 -333
  291. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +0 -40
  292. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
  293. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +0 -391
  294. package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
  295. package/storybook-static/sb-preview/globals.js +0 -33
  296. package/storybook-static/sb-preview/runtime.js +0 -7174
  297. package/test-runner-jest.config.js +0 -15
  298. /package/storybook-static/sb-addons/{essentials-actions-3 → essentials-actions-2}/manager-bundle.js.LEGAL.txt +0 -0
  299. /package/storybook-static/sb-addons/{essentials-controls-2 → essentials-controls-1}/manager-bundle.js.LEGAL.txt +0 -0
  300. /package/storybook-static/sb-addons/{links-1 → essentials-docs-3}/manager-bundle.js.LEGAL.txt +0 -0
@@ -1,60 +1,70 @@
1
- import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"./custom-element-uuAtIYWS.js";function w(i){return new Promise(a=>setTimeout(a,i))}function f(i){const{title:a,body:e}=i;return`
1
+ import{w as c,e as t,u as E}from"./index-CGuyH0k-.js";import{m as g,a as y,c as H}from"./custom-element-Bwx7otrT.js";function x(o){return new Promise(e=>setTimeout(e,o))}function T(o){const{title:e,body:a}=o;return`
2
2
  <fieldset>
3
- <legend>${a}</legend>
4
- ${e}
3
+ <legend>${e}</legend>
4
+ ${a}
5
5
  </fieldset>
6
- `}const T={title:"attributes",render:f},r={args:{title:"cloneAs(el,newTag)",body:`
6
+ `}const I={title:"attributes",render:T};function n(o){const e=document.createElement("div");return e.innerHTML=o,e.firstElementChild}const u={args:{title:"cloneAs(el,newTag)",body:`
7
7
  <p><code>cloneAs()</code> used for conversion of <code>attribute</code> to <code>xsl:param</code></p>
8
8
  <attribute data-testid="t1" >default_P1 </attribute>
9
9
  <attribute data-testid="t2" select="'always_p2'" ></attribute>
10
10
  <attribute data-testid="t3" ></attribute>
11
- `},play:async({canvasElement:i})=>{const a=c(i),e=async s=>{const o=await a.findByTestId(s),n=x(o,"xsl:param");for(let p of o.attributes)await t(p.value).toEqual(n.getAttribute(p.name));await t(n.textContent).toEqual(o.textContent)};await e("t1"),await e("t2"),await e("t3")}},u={args:{title:"mix(to,from)",body:`
11
+ `},play:async({canvasElement:o})=>{const e=c(o),a=async i=>{const r=await e.findByTestId(i),d=H(r,"xsl:param");for(let p of r.attributes)await t(p.value).toEqual(d.getAttribute(p.name));await t(d.textContent).toEqual(r.textContent)};await a("t1"),await a("t2"),await a("t3")}},l={args:{title:"mix(to,from)",body:`
12
12
  <p><code>mix(to,from)</code> used for <code>attribute</code> collections</p>
13
- `},play:async()=>{await t(y({},{a:1,b:"2"})).toEqual({a:1,b:"2"})}},d={args:{title:"Attributes definition",body:`
13
+ `},play:async()=>{await t(g({},{a:1,b:"2"})).toEqual({a:1,b:"2"})}},b={args:{title:"mergeAttr( from, to )",body:`
14
+ <p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
15
+ `},play:async()=>{const o=n('<br title="a" id="b" readonly />'),e=n("<br removed/>");await t(e).toHaveAttribute("removed"),y(o,e),await t(e).toHaveAttribute("title","a"),await t(e).toHaveAttribute("id","b"),await t(e).toHaveAttribute("readonly"),await t(e.getAttributeNames().length).toEqual(3),await t(e).not.toHaveAttribute("removed")}},m={args:{title:"mergeAttr( from, to )",body:`
16
+ <p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
17
+ <p><code>dceExportedAttributes</code> property on target element defines the set of attributes which
18
+ would not be removed from target element</p>
19
+ `},play:async()=>{const o=n('<br id="b" readonly />'),e=n("<br removed/>");e.dceExportedAttributes=new Set(["enforced"]),e.setAttribute("enforced","defined by inner component"),await t(e).toHaveAttribute("enforced"),y(o,e),await t(e).toHaveAttribute("id","b"),await t(e).toHaveAttribute("readonly"),await t(e).not.toHaveAttribute("removed"),await t(e).toHaveAttribute("enforced","defined by inner component")}},w={args:{title:"mergeAttr( from, to )",body:`
20
+ <p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
21
+ <p><code>dce-exported-attributes</code> attribute on target element defines the space separated list of attributes which
22
+ would not be removed from target element</p>
23
+ `},play:async()=>{const o=n('<br id="b" readonly />'),e=n('<br removed dce-exported-attributes="enforced"/>');e.setAttribute("enforced","defined by inner component"),await t(e).toHaveAttribute("enforced"),y(o,e),await t(e).toHaveAttribute("id","b"),await t(e).toHaveAttribute("readonly"),await t(e).not.toHaveAttribute("removed"),await t(e).toHaveAttribute("enforced","defined by inner component")}},s={args:{title:"Attributes definition",body:`
14
24
  <p>Params needed to declare DCE attributes and track the attributes changes. It also is used by IDE and validation.</p>
15
25
  <custom-element tag="dce-link" >
16
26
  <template>
17
27
  <attribute name="p1">default_P1</attribute>
18
28
  <attribute name="p2" select="'always_p2'" ></attribute>
19
- <attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
29
+ <attribute name="p3" select="//attributes/@p3 ?? 'def_P3' "></attribute>
20
30
  p1: <code data-testid="p1">{$p1}</code> <br/>
21
31
  p2: <code data-testid="p2">{$p2}</code> <br/>
22
32
  p3: <code data-testid="p3">{$p3}</code>
23
33
  </template>
24
34
  </custom-element>
25
35
  <dce-link id="dce1"></dce-link>
26
- `},play:async({canvasElement:i})=>{d.args.title;const a=c(i);t(await await a.findByTestId("p1")).toHaveTextContent("default_P1"),t(await await a.findByTestId("p2")).toHaveTextContent("always_p2"),t(await await a.findByTestId("p3")).toHaveTextContent("def_P3")}},l={args:{title:"Attributes runtime change",body:`
36
+ `},play:async({canvasElement:o})=>{const e=c(o);t(await await e.findByTestId("p1")).toHaveTextContent("default_P1"),t(await await e.findByTestId("p2")).toHaveTextContent("always_p2"),t(await await e.findByTestId("p3")).toHaveTextContent("def_P3")}},v={args:{title:"Attributes runtime change",body:`
27
37
  <p>Params needed to declare DCE attributes and track the attributes changes. It also be used by IDE and validation.</p>
28
38
  <custom-element tag="dce-link2" >
29
39
  <template>
30
40
  <attribute name="p1">default_P1 </attribute>
31
41
  <attribute name="p2" select="'always_p2'" ></attribute>
32
- <attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
42
+ <attribute name="p3" select="//attributes/@p3 ?? 'def_P3' "></attribute>
33
43
  p1: <code data-testid="t1">{$p1}</code> <br/>
34
44
  p2: <code data-testid="t2">{$p2}</code> <br/>
35
45
  p3: <code data-testid="t3">{$p3}</code>
36
46
  </template>
37
47
  </custom-element>
38
48
  <section>
39
- <dce-link2 id="dce2" p1="123" p2="override ignored as select is defined"></dce-link2> <br>
49
+ <dce-link2 id="dce2" p1="123" p2="override ignored as select is defined"></dce-link2> <br/>
40
50
  <div><input id="i1" value="P1"> <button onclick="dce2.setAttribute('p1',i1.value)"> set p1</button> </div>
41
51
  <div><input id="i2" value="P2"> <button onclick="dce2.setAttribute('p2',i2.value)"> set p2</button> </div>
42
52
  <div><input id="i3" value="P3"> <button onclick="dce2.setAttribute('p3',i3.value)"> set p3</button> </div>
43
53
  </section>
44
- `},play:async({canvasElement:i})=>{const a=c(i),e=async o=>await a.findByTestId(o);await w(20),t(await e("t1")).toHaveTextContent("123"),t(await e("t2")).toHaveTextContent("always_p2"),t(await e("t3")).toHaveTextContent("def_P3");const s=window.dce2;s.setAttribute("P1",i1.value),await t(await a.findByText("P1")).toBeInTheDocument(),t(await e("t1")).toHaveTextContent("P1"),s.setAttribute("p2",i2.value),t(a.getByTestId("t2")).toHaveTextContent("always_p2"),s.setAttribute("p3",i3.value),await t(await a.findByText("P3")).toBeInTheDocument(),t(a.getByTestId("t3")).toHaveTextContent("P3")}},b={args:{title:"Instance Attributes",body:`
54
+ `},play:async({canvasElement:o})=>{const e=c(o),a=async r=>await e.findByTestId(r);await x(20),t(await a("t1")).toHaveTextContent("123"),t(await a("t2")).toHaveTextContent("always_p2"),t(await a("t3")).toHaveTextContent("def_P3");const i=window.dce2;i.setAttribute("P1",i1.value),await t(await e.findByText("P1")).toBeInTheDocument(),t(await a("t1")).toHaveTextContent("P1"),i.setAttribute("p2",i2.value),t(e.getByTestId("t2")).toHaveTextContent("always_p2"),i.setAttribute("p3",i3.value),await t(await e.findByText("P3")).toBeInTheDocument(),t(e.getByTestId("t3")).toHaveTextContent("P3")}},f={args:{title:"Instance Attributes",body:`
45
55
  <p>Params needed to declare DCE attributes and track the attributes changes. It also is used by IDE and validation.</p>
46
56
  <custom-element tag="dce-link3" >
47
57
  <template>
48
58
  <attribute name="p1">default_P1 </attribute>
49
59
  <attribute name="p2" select="'always_p2'" ></attribute>
50
- <attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
60
+ <attribute name="p3" select="//attributes/p3 ?? 'def_P3' "></attribute>
51
61
  p1: <code data-testid="p1">{$p1}</code> <br/>
52
62
  p2: <code data-testid="p2">{$p2}</code> <br/>
53
63
  p3: <code data-testid="p3">{$p3}</code>
54
64
  </template>
55
65
  </custom-element>
56
66
  <dce-link3 id="dce3" p1="123" p3="qwe"></dce-link3> |
57
- `},play:async({canvasElement:i})=>{d.args.title;const a=c(i),e=async s=>(await a.findByTestId(s)).textContent.trim();await w(20),t(await e("p1")).toEqual("123"),t(await e("p2")).toEqual("always_p2"),t(await e("p3")).toEqual("qwe")}},m={args:{title:"Instance Attributes",body:`
67
+ `},play:async({canvasElement:o})=>{s.args.title;const e=c(o),a=async i=>(await e.findByTestId(i)).textContent.trim();await x(200),t(await a("p1")).toEqual("123"),t(await a("p2")).toEqual("always_p2"),t(await a("p3")).toEqual("qwe")}},A={args:{title:"Instance Attributes",body:`
58
68
  <p>Attributes with value(p2) or <code>select</code>(p3) should be propagated to DCE</p>
59
69
  <p>p1 attribute is not propagated as does not have the value.</p>
60
70
  <custom-element tag="sample-el">
@@ -62,11 +72,11 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
62
72
  <attribute name="data-testid"></attribute>
63
73
  <attribute name="p1"></attribute>
64
74
  <attribute name="p2">DEFAULT VALUE</attribute>
65
- <attribute name="p3" select=" //from-input ?? 'abc' "></attribute>
75
+ <attribute name="p3" select=" //from-input "></attribute>
66
76
  <input slice="from-input" slice-event="input"/><br/>
67
77
  p1:<code data-testid="{$data-testid}-p1" >{ $p1 }</code><br/>
68
78
  p2:<code data-testid="{$data-testid}-p2" >{ $p2 }</code><br/>
69
- p2:<code data-testid="{$data-testid}-p3" >{ $p3 }</code><br/>
79
+ p3:<code data-testid="{$data-testid}-p3" >{ $p3 }</code><br/>
70
80
  //from-input: {//from-input} <hr/>
71
81
  </template>
72
82
  </custom-element>
@@ -74,7 +84,7 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
74
84
  <sample-el data-testid="t1" value="123" ></sample-el>
75
85
  <sample-el data-testid="t2" p1="P1" p2="123" p3="P3" ></sample-el>
76
86
  <sample-el data-testid="t3" ></sample-el>
77
- `},play:async({canvasElement:i})=>{const a=c(i),e=async p=>(await a.findByTestId(p)).textContent?.trim();await w(20),await t(await e("t1-p1")).toEqual(""),await t(await e("t1-p2")).toEqual("DEFAULT VALUE"),await t(await e("t1-p3")).toEqual("abc");const s=await a.findByTestId("t1");await t(s).toHaveAttribute("value","123"),await t(s).toHaveAttribute("p2","DEFAULT VALUE"),await t(s).toHaveAttribute("p3","abc"),await t(s).not.toHaveAttribute("p1"),await t(await e("t2-p1")).toEqual("P1"),await t(await e("t2-p2")).toEqual("123"),await t(await e("t2-p3")).toEqual("abc");const o=await a.findByTestId("t2");await t(o).toHaveAttribute("p1","P1"),await t(o).toHaveAttribute("p2","123"),await t(o).toHaveAttribute("p3","abc"),await t(await e("t3-p1")).toEqual(""),await t(await e("t3-p2")).toEqual("DEFAULT VALUE"),await t(await e("t3-p3")).toEqual("abc");const n=await a.findByTestId("t3");await t(s).not.toHaveAttribute("p1"),await t(n).toHaveAttribute("p2","DEFAULT VALUE"),await t(n).toHaveAttribute("p3","abc"),n.querySelector("input")?.focus(),await v.keyboard("DCE"),await t(n).toHaveAttribute("p3","DCE")}};r.parameters={...r.parameters,docs:{...r.parameters?.docs,source:{originalSource:`{
87
+ `},play:async({canvasElement:o})=>{const e=c(o),a=async p=>(await e.findByTestId(p)).textContent?.trim();await x(20),await t(await a("t1-p1")).toEqual(""),await t(await a("t1-p2")).toEqual("DEFAULT VALUE"),await t(await a("t1-p3")).toEqual("");const i=await e.findByTestId("t1");await t(i).toHaveAttribute("value","123"),await t(i).toHaveAttribute("p2","DEFAULT VALUE"),await t(i).toHaveAttribute("p3",""),await t(i).not.toHaveAttribute("p1"),await t(await a("t2-p1")).toEqual("P1"),await t(await a("t2-p2")).toEqual("123"),await t(await a("t2-p3")).toEqual("");const r=await e.findByTestId("t2");await t(r).toHaveAttribute("p1","P1"),await t(r).toHaveAttribute("p2","123"),await t(r).toHaveAttribute("p3",""),await t(await a("t3-p1")).toEqual(""),await t(await a("t3-p2")).toEqual("DEFAULT VALUE"),await t(await a("t3-p3")).toEqual("");const d=await e.findByTestId("t3");await t(i).not.toHaveAttribute("p1"),await t(d).toHaveAttribute("p2","DEFAULT VALUE"),await t(d).toHaveAttribute("p3",""),d.querySelector("input")?.focus(),await E.keyboard("DCE"),await t(d).toHaveAttribute("p3","DCE")}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
78
88
  args: {
79
89
  title: 'cloneAs(el,newTag)',
80
90
  body: \`
@@ -100,7 +110,7 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
100
110
  await cmp('t2');
101
111
  await cmp('t3');
102
112
  }
103
- }`,...r.parameters?.docs?.source}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
113
+ }`,...u.parameters?.docs?.source}}};l.parameters={...l.parameters,docs:{...l.parameters?.docs,source:{originalSource:`{
104
114
  args: {
105
115
  title: 'mix(to,from)',
106
116
  body: \`
@@ -116,7 +126,70 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
116
126
  b: '2'
117
127
  });
118
128
  }
119
- }`,...u.parameters?.docs?.source}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
129
+ }`,...l.parameters?.docs?.source}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
130
+ args: {
131
+ title: 'mergeAttr( from, to )',
132
+ body: \`
133
+ <p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
134
+ \`
135
+ },
136
+ play: async () => {
137
+ const from = html2Element('<br title="a" id="b" readonly />');
138
+ const to = html2Element('<br removed/>');
139
+ await expect(to).toHaveAttribute('removed');
140
+ mergeAttr(from!, to);
141
+ await expect(to).toHaveAttribute('title', 'a');
142
+ await expect(to).toHaveAttribute('id', 'b');
143
+ await expect(to).toHaveAttribute('readonly');
144
+ await expect(to.getAttributeNames().length).toEqual(3);
145
+ await expect(to).not.toHaveAttribute('removed');
146
+ }
147
+ }`,...b.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
148
+ args: {
149
+ title: 'mergeAttr( from, to )',
150
+ body: \`
151
+ <p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
152
+ <p><code>dceExportedAttributes</code> property on target element defines the set of attributes which
153
+ would not be removed from target element</p>
154
+ \`
155
+ },
156
+ play: async () => {
157
+ const from = html2Element('<br id="b" readonly />');
158
+ const to = html2Element('<br removed/>') as (HTMLElement & {
159
+ dceExportedAttributes: Set<string>;
160
+ });
161
+ to.dceExportedAttributes = new Set(['enforced']);
162
+ to.setAttribute('enforced', "defined by inner component");
163
+ await expect(to).toHaveAttribute('enforced');
164
+ mergeAttr(from, to);
165
+ await expect(to).toHaveAttribute('id', 'b');
166
+ await expect(to).toHaveAttribute('readonly');
167
+ await expect(to).not.toHaveAttribute('removed');
168
+ await expect(to).toHaveAttribute('enforced', "defined by inner component");
169
+ }
170
+ }`,...m.parameters?.docs?.source}}};w.parameters={...w.parameters,docs:{...w.parameters?.docs,source:{originalSource:`{
171
+ args: {
172
+ title: 'mergeAttr( from, to )',
173
+ body: \`
174
+ <p><code>mergeAttr( from, to )</code> used for <code>attribute</code> collections</p>
175
+ <p><code>dce-exported-attributes</code> attribute on target element defines the space separated list of attributes which
176
+ would not be removed from target element</p>
177
+ \`
178
+ },
179
+ play: async () => {
180
+ const from = html2Element('<br id="b" readonly />');
181
+ const to = html2Element('<br removed dce-exported-attributes="enforced"/>') as (HTMLElement & {
182
+ dceExportedAttributes: Set<string>;
183
+ });
184
+ to.setAttribute('enforced', "defined by inner component");
185
+ await expect(to).toHaveAttribute('enforced');
186
+ mergeAttr(from, to);
187
+ await expect(to).toHaveAttribute('id', 'b');
188
+ await expect(to).toHaveAttribute('readonly');
189
+ await expect(to).not.toHaveAttribute('removed');
190
+ await expect(to).toHaveAttribute('enforced', "defined by inner component");
191
+ }
192
+ }`,...w.parameters?.docs?.source}}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
120
193
  args: {
121
194
  title: 'Attributes definition',
122
195
  body: \`
@@ -125,7 +198,7 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
125
198
  <template>
126
199
  <attribute name="p1">default_P1</attribute>
127
200
  <attribute name="p2" select="'always_p2'" ></attribute>
128
- <attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
201
+ <attribute name="p3" select="//attributes/@p3 ?? 'def_P3' "></attribute>
129
202
  p1: <code data-testid="p1">{$p1}</code> <br/>
130
203
  p2: <code data-testid="p2">{$p2}</code> <br/>
131
204
  p3: <code data-testid="p3">{$p3}</code>
@@ -137,14 +210,12 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
137
210
  play: async ({
138
211
  canvasElement
139
212
  }) => {
140
- const titleText = AttributeDefaults.args!.title as string;
141
- const canvas = within(canvasElement),
142
- code = async id => (await canvas.findByTestId(id)).textContent.trim();
213
+ const canvas = within(canvasElement);
143
214
  expect(await await canvas.findByTestId('p1')).toHaveTextContent('default_P1');
144
215
  expect(await await canvas.findByTestId('p2')).toHaveTextContent('always_p2');
145
216
  expect(await await canvas.findByTestId('p3')).toHaveTextContent('def_P3');
146
217
  }
147
- }`,...d.parameters?.docs?.source}}};l.parameters={...l.parameters,docs:{...l.parameters?.docs,source:{originalSource:`{
218
+ }`,...s.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
148
219
  args: {
149
220
  title: 'Attributes runtime change',
150
221
  body: \`
@@ -153,14 +224,14 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
153
224
  <template>
154
225
  <attribute name="p1">default_P1 </attribute>
155
226
  <attribute name="p2" select="'always_p2'" ></attribute>
156
- <attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
227
+ <attribute name="p3" select="//attributes/@p3 ?? 'def_P3' "></attribute>
157
228
  p1: <code data-testid="t1">{$p1}</code> <br/>
158
229
  p2: <code data-testid="t2">{$p2}</code> <br/>
159
230
  p3: <code data-testid="t3">{$p3}</code>
160
231
  </template>
161
232
  </custom-element>
162
233
  <section>
163
- <dce-link2 id="dce2" p1="123" p2="override ignored as select is defined"></dce-link2> <br>
234
+ <dce-link2 id="dce2" p1="123" p2="override ignored as select is defined"></dce-link2> <br/>
164
235
  <div><input id="i1" value="P1"> <button onclick="dce2.setAttribute('p1',i1.value)"> set p1</button> </div>
165
236
  <div><input id="i2" value="P2"> <button onclick="dce2.setAttribute('p2',i2.value)"> set p2</button> </div>
166
237
  <div><input id="i3" value="P3"> <button onclick="dce2.setAttribute('p3',i3.value)"> set p3</button> </div>
@@ -189,7 +260,7 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
189
260
  await expect(await canvas.findByText('P3')).toBeInTheDocument();
190
261
  expect(canvas.getByTestId('t3')).toHaveTextContent('P3'); // set p3 in runtime
191
262
  }
192
- }`,...l.parameters?.docs?.source}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
263
+ }`,...v.parameters?.docs?.source}}};f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
193
264
  args: {
194
265
  title: 'Instance Attributes',
195
266
  body: \`
@@ -198,7 +269,7 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
198
269
  <template>
199
270
  <attribute name="p1">default_P1 </attribute>
200
271
  <attribute name="p2" select="'always_p2'" ></attribute>
201
- <attribute name="p3" select="//p3 ?? 'def_P3' "></attribute>
272
+ <attribute name="p3" select="//attributes/p3 ?? 'def_P3' "></attribute>
202
273
  p1: <code data-testid="p1">{$p1}</code> <br/>
203
274
  p2: <code data-testid="p2">{$p2}</code> <br/>
204
275
  p3: <code data-testid="p3">{$p3}</code>
@@ -213,12 +284,12 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
213
284
  const titleText = AttributeDefaults.args!.title as string;
214
285
  const canvas = within(canvasElement),
215
286
  code = async id => (await canvas.findByTestId(id)).textContent.trim();
216
- await sleep(20);
287
+ await sleep(200);
217
288
  expect(await code('p1')).toEqual('123');
218
289
  expect(await code('p2')).toEqual('always_p2');
219
290
  expect(await code('p3')).toEqual('qwe');
220
291
  }
221
- }`,...b.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
292
+ }`,...f.parameters?.docs?.source}}};A.parameters={...A.parameters,docs:{...A.parameters?.docs,source:{originalSource:`{
222
293
  args: {
223
294
  title: 'Instance Attributes',
224
295
  body: \`
@@ -229,11 +300,11 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
229
300
  <attribute name="data-testid"></attribute>
230
301
  <attribute name="p1"></attribute>
231
302
  <attribute name="p2">DEFAULT VALUE</attribute>
232
- <attribute name="p3" select=" //from-input ?? 'abc' "></attribute>
303
+ <attribute name="p3" select=" //from-input "></attribute>
233
304
  <input slice="from-input" slice-event="input"/><br/>
234
305
  p1:<code data-testid="{$data-testid}-p1" >{ $p1 }</code><br/>
235
306
  p2:<code data-testid="{$data-testid}-p2" >{ $p2 }</code><br/>
236
- p2:<code data-testid="{$data-testid}-p3" >{ $p3 }</code><br/>
307
+ p3:<code data-testid="{$data-testid}-p3" >{ $p3 }</code><br/>
237
308
  //from-input: {//from-input} <hr/>
238
309
  </template>
239
310
  </custom-element>
@@ -251,28 +322,28 @@ import{w as c,e as t,u as v}from"./index-CxRwF5Or.js";import{m as y,c as x}from"
251
322
  await sleep(20);
252
323
  await expect(await code('t1-p1')).toEqual('');
253
324
  await expect(await code('t1-p2')).toEqual('DEFAULT VALUE');
254
- await expect(await code('t1-p3')).toEqual('abc');
325
+ await expect(await code('t1-p3')).toEqual('');
255
326
  const t1 = await canvas.findByTestId('t1');
256
327
  await expect(t1).toHaveAttribute('value', '123');
257
328
  await expect(t1).toHaveAttribute('p2', 'DEFAULT VALUE');
258
- await expect(t1).toHaveAttribute('p3', 'abc');
329
+ await expect(t1).toHaveAttribute('p3', '');
259
330
  await expect(t1).not.toHaveAttribute('p1');
260
331
  await expect(await code('t2-p1')).toEqual('P1');
261
332
  await expect(await code('t2-p2')).toEqual('123');
262
- await expect(await code('t2-p3')).toEqual('abc');
333
+ await expect(await code('t2-p3')).toEqual('');
263
334
  const t2 = await canvas.findByTestId('t2');
264
335
  await expect(t2).toHaveAttribute('p1', 'P1');
265
336
  await expect(t2).toHaveAttribute('p2', '123');
266
- await expect(t2).toHaveAttribute('p3', 'abc');
337
+ await expect(t2).toHaveAttribute('p3', '');
267
338
  await expect(await code('t3-p1')).toEqual('');
268
339
  await expect(await code('t3-p2')).toEqual('DEFAULT VALUE');
269
- await expect(await code('t3-p3')).toEqual('abc');
340
+ await expect(await code('t3-p3')).toEqual('');
270
341
  const t3 = await canvas.findByTestId('t3');
271
342
  await expect(t1).not.toHaveAttribute('p1');
272
343
  await expect(t3).toHaveAttribute('p2', 'DEFAULT VALUE');
273
- await expect(t3).toHaveAttribute('p3', 'abc');
344
+ await expect(t3).toHaveAttribute('p3', '');
274
345
  t3.querySelector('input')?.focus();
275
346
  await userEvent.keyboard('DCE');
276
347
  await expect(t3).toHaveAttribute('p3', 'DCE');
277
348
  }
278
- }`,...m.parameters?.docs?.source}}};const g=["CloneAs","Mix","AttributeDefaults","AttributesRuntimeChange","InstanceAttributes","AttributesPropagationUp"];export{d as AttributeDefaults,m as AttributesPropagationUp,l as AttributesRuntimeChange,r as CloneAs,b as InstanceAttributes,u as Mix,g as __namedExportsOrder,T as default};
349
+ }`,...A.parameters?.docs?.source}}};const C=["CloneAs","Mix","MergeAttr","dceExportedAttributes","dceExportedAttributes_attr","AttributeDefaults","AttributesRuntimeChange","InstanceAttributes","AttributesPropagationUp"];export{s as AttributeDefaults,A as AttributesPropagationUp,v as AttributesRuntimeChange,u as CloneAs,f as InstanceAttributes,b as MergeAttr,l as Mix,C as __namedExportsOrder,m as dceExportedAttributes,w as dceExportedAttributes_attr,I as default};
@@ -1,4 +1,4 @@
1
- import{w as i,e as t}from"./index-CxRwF5Or.js";import"./custom-element-uuAtIYWS.js";const g={title:"",tag:"",style:"",slot:"",payload:""};function p(n){const{title:e,tag:o,style:s,slot:a,payload:l}={...g,...n};return`
1
+ import{w as i,e as t}from"./index-CGuyH0k-.js";import"./custom-element-Bwx7otrT.js";const g={title:"",tag:"",style:"",slot:"",payload:""};function p(n){const{title:e,tag:o,style:s,slot:a,payload:l}={...g,...n};return`
2
2
  <fieldset>
3
3
  <legend>${e}</legend>
4
4
  <custom-element ${o?`tag="${o}"`:""} >
@@ -0,0 +1,97 @@
1
+ const K="http://www.w3.org/1999/XSL/Transform",R="http://www.w3.org/1999/xhtml",ye="http://exslt.org/common",d=(e,l)=>e?.getAttribute?.(l),se=e=>e.nodeType===3,ge=e=>typeof e=="string",le=e=>e&&typeof e.nodeType=="number",L=(e,l)=>(e.ownerDocument||e).createTextNode(l),ce=e=>{for(;e.firstChild;)e.firstChild.remove();return e},F=e=>(e.getAttributeNames().map(l=>e.removeAttribute(l)),ce(e)),me=e=>(e?.setAttribute("xmlns:xsl",K),e),ue=e=>(e?.setAttribute("xmlns:xhtml",R),me(e)),de=e=>/^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e),ne=(e,l)=>(Object.keys(l).map(t=>e[t]=l[t]),e),C=(e,l="",t=document)=>{const s=n=>(o=>(l&&o.append(L(t.ownerDocument||t,l)),o))((t.ownerDocument||t).createElement(n));if(de(e))return s(e);const a=s("dce-object");return a.setAttribute("dce-object-name",e),a},ae=(e,l)=>{const t=e.ownerDocument.createElementNS(e.namespaceURI,l);for(let s of e.attributes)t.setAttribute(s.name,s.value);for(let s of e.childNodes)t.append(s.cloneNode(!0));return t};function O(e){return new DOMParser().parseFromString(e,"application/xml")}function q(e){return new XMLSerializer().serializeToString(e)}function B(e,l,t,s){const a=y=>e.ownerDocument.createElement(y),o=((y,x,v)=>(x.append(v=a(y)),v))(l,e);return[...t].forEach(y=>o.append(s(y))),o}function Ae(e){return e.slot||(e.setAttribute||(e=C("span",e.textContent.replaceAll(`
2
+ `,""))),e.setAttribute("slot","")),e}function J(e,l){e.getAttributeNames().forEach(t=>l.includes(t)||e.removeAttribute(t))}const ie=e=>[...e].filter(l=>!(l.nodeType===3&&l.data.trim()===""));function I(e,l,t){const s=typeof e;if(s==="string")return C(l,e,t);if(s==="number")return C(l,""+e,t);if(le(e)){const n=C(l);return n.append(e),n}if(e instanceof Array){const n=C("array","",t);return e.map(o=>n.append(I(o,l,t))),n}if(e instanceof FormData){const n=C("form-data","",t);for(const o of e)n.append(I(o[1],o[0],t));return n}const a=C(l,"",t);for(let n in e)typeof e[n]=="function"||e[n]instanceof Window||le(e[n])&&!(n==="data"||n==="value")||(typeof e[n]!="object"&&de(n)?a.setAttribute(n,e[n]):a.append(I(e[n],n,t)));return a}function re(e){if(j(e,"*",l=>[...l.childNodes].filter(t=>t.nodeType===3&&t.parentNode.localName!=="style"&&t.data).forEach(t=>{const s=t.data,a=s.matchAll(/{([^}]*)}/g);if(a){let n=0,o=x=>L(t,x),y=[];if([...a].forEach(x=>{x.index>n&&y.push(o(x.input.substring(n,x.index)));const v=e.querySelector("value-of").cloneNode();v.setAttribute("select",x[1]),y.push(v),n=x.index+x[0].length}),n<s.length&&y.push(o(s.substring(n,s.length))),y.length){for(let x of y)l.insertBefore(x,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 ve(e,l="xsl:stylesheet"){const t=[],s={},a={};if(e.tagName===l||e.documentElement?.tagName===l)return re(ne(e,{declaredAttributes:t,hardcodedAttributes:s,exposedAttributes:a}));const n=O(`<xsl:stylesheet version="1.0" xmlns:xsl="${K}" xmlns:xhtml="${R}" xmlns:exsl="${ye}" exclude-result-prefixes="exsl" >
3
+ <xsl:output method="xml"/>
4
+ <xsl:template match="/"><dce-root xmlns="${R}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
5
+ <xsl:template match="*[name()='template']">
6
+ <xsl:apply-templates mode="sanitize" select="*|text()"/>
7
+ </xsl:template>
8
+ <xsl:template match="*">
9
+ <xsl:apply-templates mode="sanitize" select="*|text()"/>
10
+ </xsl:template>
11
+ <xsl:template match="*[name()='svg']|*[name()='math']">
12
+ <xsl:apply-templates mode="sanitize" select="."/>
13
+ </xsl:template>
14
+ <xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]">
15
+ <xsl:copy>
16
+ <xsl:apply-templates mode="sanitize" select="@*"/>
17
+ <xsl:value-of select="text()"></xsl:value-of>
18
+ </xsl:copy>
19
+ </xsl:template>
20
+ <xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]">
21
+ <xsl:element name="{local-name()}">
22
+ <xsl:apply-templates mode="sanitize" select="@*"/>
23
+ <xsl:value-of select="text()"></xsl:value-of>
24
+ </xsl:element>
25
+ </xsl:template>
26
+ <xsl:template mode="sanitize" match="*|@*">
27
+ <xsl:copy>
28
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
29
+ </xsl:copy>
30
+ </xsl:template>
31
+ <xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
32
+ <xsl:template mode="sanitize" match="text()">
33
+ <dce-text>
34
+ <xsl:copy/>
35
+ </dce-text>
36
+ </xsl:template>
37
+ <xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']">
38
+ <xsl:copy>
39
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
40
+ </xsl:copy>
41
+ </xsl:template>
42
+ <xsl:template mode="sanitize" match="xhtml:*">
43
+ <xsl:element name="{local-name()}">
44
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
45
+ </xsl:element>
46
+ </xsl:template>
47
+ <xsl:template mode="sanitize" match="xhtml:input">
48
+ <xsl:element name="{local-name()}">
49
+ <xsl:apply-templates mode="sanitize" select="*[not(name()='slice')]|@*|text()"/>
50
+ </xsl:element>
51
+ <xsl:for-each select="slice">
52
+ <xsl:copy>
53
+ <xsl:attribute name="for" >^</xsl:attribute>
54
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
55
+ </xsl:copy>
56
+ </xsl:for-each>
57
+ </xsl:template>
58
+ </xsl:stylesheet>`),o=new XSLTProcessor,y=(i=>{j(i,"custom-element",f=>{f.firstElementChild.localName==="template"&&([...f.firstElementChild.content.childNodes].forEach(b=>f.append(b)),f.firstElementChild.remove())}),j(i,"script",f=>f.remove());const r=i.content??i.firstElementChild?.content??i.body??i;$e.forEach(f=>j(r,f,b=>Le(b,r)));const h=i.firstElementChild?.content||i.content,g=f=>{const b=O("<xhtml/>"),T=b.importNode(f,!0);return b.replaceChild(T,b.documentElement),T.namespaceURI===R&&!d(T,"xmlns")&&T.setAttribute("xmlns",R),ue(T)};if(h){const f=C("div");return[...h.childNodes].map(b=>f.append(b.cloneNode(!0))),g(f)}return g(i.documentElement||i.body||i)})(e),x=O(`<xsl:stylesheet version="1.0"
59
+ xmlns:xsl="${K}"
60
+ xmlns:xhtml="${R}"
61
+ xmlns:dce="urn:schemas-epa-wg:dce"
62
+ xmlns:exsl="http://exslt.org/common"
63
+ exclude-result-prefixes="exsl"
64
+ >
65
+ <xsl:template match="ignore">
66
+ <xsl:choose>
67
+ <xsl:when test="//attr">{//attr}</xsl:when>
68
+ <xsl:otherwise>{def}</xsl:otherwise>
69
+ </xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
70
+ <xsl:template mode="payload" match="attributes"></xsl:template>
71
+ <xsl:template match="/">
72
+ <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
73
+ </xsl:template>
74
+ <xsl:template name="slot" >
75
+ <xsl:param name="slotname" />
76
+ <xsl:param name="defaultvalue" />
77
+ <xsl:choose>
78
+ <xsl:when test="//payload/*[@slot=$slotname]">
79
+ <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
80
+ </xsl:when>
81
+ <xsl:otherwise>
82
+ <xsl:copy-of select="$defaultvalue"/>
83
+ </xsl:otherwise>
84
+ </xsl:choose>
85
+ </xsl:template>
86
+ <xsl:variable name="js-injected-body">
87
+ <xsl:call-template name="slot" >
88
+ <xsl:with-param name="slotname" select="''"/>
89
+ <xsl:with-param name="defaultvalue"/>
90
+ </xsl:call-template>
91
+ </xsl:variable>
92
+ </xsl:stylesheet>`);o.importStylesheet(n);const v=o.transformToFragment(y,document),u=(i,r)=>i.querySelector(r),w=u(x,'template[mode="payload"]');if(!v)return console.error("transformation error",{xml:y.outerHTML,xsl:q(n)});if(v.firstElementChild.localName!=="dce-root"){const i=v.ownerDocument.createElement("dce-root");[...v.childNodes].forEach(r=>i.append(r)),v.append(i)}[...v.querySelectorAll("[test]")].forEach(i=>{const r=d(i,"test"),h=r.replace(/hasBoolAttribute\((.*?)\)/g,(g,f,b,T,M)=>{const D=f.substring(1);return`(not($${D} = 'false') and ($${D} = '' or $${D} = '${D}' or $${D} = 'true' ))`});r!==h&&i.setAttribute("test",h)}),[...v.querySelectorAll("dce-root>attribute")].forEach(i=>{J(i,"namespace,name,select");const r=ae(i,"xsl:param"),h=d(i,"name");if(t.push(h),i.childNodes.length&&(s[h]=i.textContent),w.append(r),i.hasAttribute("select")){a[h]=d(i,"select"),J(r,"select,name");let g=d(i,"select").split("??"),f;if(g?.length>1){r.removeAttribute("select");const b=u(x,'template[match="ignore"]>choose').cloneNode(!0);F(b.firstElementChild).append(L(b,"{"+g[0]+"}")),b.firstElementChild.setAttribute("test",g[0]);for(let T=1;T<g.length-1;T++){const M=b.firstElementChild.cloneNode(!0);F(M).append(L(b,"{"+g[T]+"}")),M.setAttribute("test",g[T]),b.insertBefore(M,b.lastElementChild)}F(b.lastElementChild).append(L(b,"{"+g[g.length-1]+"}")),r.append(b),f=b.cloneNode(!0)}else f=ae(i,"xsl:value-of");f.removeAttribute("name"),i.append(f),i.removeAttribute("select")}else J(r,"name"),r.setAttribute("select","/datadom/attributes/"+h),s[h]||i.remove()}),[...v.querySelectorAll("[value]")].filter(i=>i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach(i=>{const r=d(i,"value");r&&i.setAttribute("value",Ce(r))});for(const i of v.childNodes)w.append(x.importNode(i,!0));[...w.getElementsByTagName("xsl:template")].forEach(i=>w.ownerDocument.documentElement.append(i));const k=u(x,'call-template[name="slot"]'),H=i=>{const r=k.cloneNode(!0),h=d(i,"name");h&&r.firstElementChild.setAttribute("select",`'${h}'`);for(let g of i.childNodes)r.lastElementChild.append(g);return r};j(w,"slot",i=>i.parentNode.replaceChild(H(i),i));const p=re(x);return ne(p,{declaredAttributes:t,hardcodedAttributes:s,exposedAttributes:a}),p}async function Ee(e){return await new Promise((t,s)=>{const a=new XMLHttpRequest;a.open("GET",e),a.responseType="document",a.onload=()=>{a.readyState===a.DONE&&a.status===200?t(a.responseXML?.body||a.responseXML||C("div",a.responseText)):s(`${a.statusText} - ${e}`)},a.addEventListener("error",n=>s(n)),a.send()})}const pe=e=>e.split("|").map(l=>l.trim()).filter(l=>l),Ne=(e,l)=>pe(l).map(t=>{let s=e.ownerDocument,a=n=>(e.append(n),n);if(t.includes("/")){const n=[],o=s.evaluate(t,e);for(let y;y=o.iterateNext();)n.push(y);return n}return[...e.childNodes].find(n=>n.localName===t)||a(C(t,"",s))}).flat();function oe(e,l,t,s){if(!t.sliceProcessed)return t.sliceProcessed=1,Ne(e,l??"").map(a=>{const n=e.ownerDocument,o=t.sliceEventSource,y=t.sliceElement,x=()=>[...a.childNodes].filter(u=>u.nodeType===3||u.localName==="value"||u.localName==="form-data").map(u=>u.remove());o.getAttributeNames().map(u=>a.setAttribute(u,d(o,u))),[...a.childNodes].filter(u=>u.localName==="event").map(u=>u.remove()),"validationMessage"in o&&a.setAttribute("validation-message",o.validationMessage),t.type==="init"&&x(),a.append(I(t,"event",n));const v=(o.type==="checkbox"||o.type==="radio")&&!o.checked;if(y.hasAttribute("slice-value")){o.value===void 0?a.removeAttribute("value"):a.setAttribute("value",o.value);const u=v?"":P(d(y,"slice-value"),a);x(),a.append(L(n,u))}else{if("elements"in o)return x(),a.append(I(new FormData(o),"value",a.ownerDocument)),a;const u=v?"":o.value??d(o,"value");if(x(),u==null)[...a.childNodes].filter(w=>w.localName!=="event").map(w=>w.remove()),a.removeAttribute("value");else{const w=ge(u)?L(n,u):I(u,"value",a.ownerDocument);a.append(w),a.setAttribute("value",u)}}return a})}function j(e,l,t){e.querySelectorAll&&[...e.querySelectorAll(l)].forEach(t)}const we=async(e,l)=>{if(!e||!e.trim())return[l];if(e.startsWith("#"))return(t=>{const s=t.querySelectorAll(e);return[...s.length?s:t.getRootNode().querySelectorAll(e)]})(l.parentElement);try{const[t,s]=e.split("#");if(e.charAt(0)===".")e=new URL(t,l.closest("[base]")?.getAttribute("base")||location).href;else try{e=import.meta.resolve(t),s&&(e+="#"+s)}catch(n){console.error(n.message)}const a=await Ee(e);if(l.setAttributeNS("xml","base",e),s){const n=a.querySelectorAll("#"+s);return n.length?[...n]:(console.error("template not found",e+"#"+s),[l])}return[a]}catch{return[l]}};function he(e,l){for(let n of e.attributes)try{const o=n.name;if(o.startsWith("xmlns"))continue;n.namespaceURI?(!l.hasAttributeNS(n.namespaceURI,o)||l.getAttributeNS(n.namespaceURI,o)!==n.value)&&l.setAttributeNS(n.namespaceURI,o,n.value):(!l.hasAttribute(o)||l.getAttribute(o)!==n.value)&&l.setAttribute(n.name,n.value),n.name==="value"&&(l.value=n.value)}catch(o){console.warn("attribute assignment error",o?.message||o)}const t=l.dceExportedAttributes,s=l.getAttribute("dce-exported-attributes"),a=s?new Set(s.split(" ")):null;for(let n of l.getAttributeNames())!e.hasAttribute(n)&&!t?.has(n)&&!a?.has(n)&&l.removeAttribute(n)}function fe(e,l=0){const t={};for(const s of e.childNodes){const a=d(s,"data-dce-id")||s.dceId||0;if(!t[a])a?t[a]=1:(t[a]=s.dceId=++l,s.setAttribute&&s.setAttribute("data-dce-id",s.dceId));else{const n=s.dceId=a+"-"+t[a]++;s.setAttribute&&s.setAttribute("data-dce-id",n)}s.childNodes.length&&fe(s)}}function Te(e,l,t){t=1*t;for(let s of e.childNodes)if((s.dceId??s.getAttribute("data-dce-id")*1)>t)return e.insertBefore(l,s);e.append(l)}function xe(e,l){if(e.firstElementChild?.localName==="dce-root"&&l[0]?.localName!=="dce-root")return;if(!l.length)return e.firstElementChild?.localName!=="dce-root"&&ce(e);const t={};for(let s of e.childNodes)t[s.dceId],se(s)?(s.data.trim(),t[s.dceId||0]=s):t[d(s,"data-dce-id")||0]=s;for(let s of[...l]){const a=d(s,"data-dce-id")||s.dceId,n=t[a];n?(se(s)?n.nodeValue!==s.nodeValue&&(n.nodeValue=s.nodeValue):(he(s,n),(n.childNodes.length||s.childNodes.length)&&xe(n,s.childNodes)),delete t[a]):Te(e,s,a)}for(let s of Object.values(t))s.localName!=="dce-root"&&s.remove()}function Se(e,l){return e.hasAttribute(l)||e.setAttribute(l,crypto.randomUUID()),e.getAttribute(l)}const Ce=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},P=(e,l)=>{const t=e.split("??");if(t.length>1)return P(t[0],l)||P(t[1],l);e=Q(e);const s=l.ownerDocument.evaluate(e,l);switch(s.resultType){case XPathResult.NUMBER_TYPE:return s.numberValue;case XPathResult.STRING_TYPE:return s.stringValue;case XPathResult.BOOLEAN_TYPE:return s.booleanValue}let a="";for(let n;n=s.iterateNext();)a+=n.textContent;return a},$e="stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,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(","),Le=(e,l)=>{const t=C("xsl:"+e.localName);for(let a of e.attributes)t.setAttribute(a.name,a.value);for(;e.firstChild;)t.append(e.firstChild);const s=e.localName==="if"||e.localName==="choose"?(()=>{const a=C("span");return a.append(t),a})():t;if(e.parentElement)e.parentElement.replaceChild(s,e);else{const a=e.parentElement||l,n=[...a.childNodes];n.forEach((o,y)=>{o===e&&(n[y]=s)}),a.replaceChildren(...n)}};class De extends HTMLElement{static observedAttributes=["src","tag","hidden"];async connectedCallback(){this.firstElementChild&&this.firstElementChild.localName!=="template"&&console.log(`custom-element used without template wrapping content
93
+ `,this.outerHTML);const l=await we(d(this,"src"),this),t=d(this,"tag"),s=t||"dce-"+crypto.randomUUID();for(const p of l)j(p.templateNode||p.content||p,"style",i=>{const r=i.closest("slot"),h=r?`slot[name="${r.name}"]`:"";i.innerHTML=`${s} ${h}{${i.innerHTML}}`,this.append(i)});const a=l.map(p=>ve(p)),n=a.map((p,i)=>{i=new XSLTProcessor;try{i.importStylesheet(p)}catch(r){console.error(r,q(p))}return i});Object.defineProperty(this,"xsltString",{get:()=>a.map(p=>q(p)).join(`
94
+ `)});const o=this,y=[...this.templateNode.querySelectorAll("[slice]")],x=y.map(p=>d(p,"slice")).filter(p=>!p.includes("/")).filter((p,i,r)=>r.indexOf(p)===i).map(pe).flat(),{declaredAttributes:v,hardcodedAttributes:u,exposedAttributes:w}=a[0],ee=new Set([...Object.keys(u),...Object.keys(w)]);class k extends HTMLElement{static get observedAttributes(){return v}#e=0;get dceExportedAttributes(){return ee}connectedCallback(){let i=ie(this.childNodes);if(this.firstElementChild?.tagName==="TEMPLATE"){this.firstElementChild!==this.lastElementChild&&console.error("payload should have TEMPLATE as only child",this.outerHTML);const c=this.firstElementChild;c.remove(),i=ie(c.content.childNodes);for(const E of i)if(E.localName==="style"){const m=Se(this,"data-dce-style");E.innerHTML=`${s}[data-dce-style="${m}"]{${E.innerHTML}}`,c.insertAdjacentElement("beforebegin",E)}else E.nodeType===1?c.insertAdjacentElement("beforebegin",E):E.nodeType===3&&c.insertAdjacentText("beforebegin",E.data)}const r=O("<datadom/>").documentElement,h=(c,E="")=>(m=>(E&&m.append(L(r,E)),m))(r.ownerDocument.createElement(c)),g=B(r,"payload",i,Ae);me(g),ue(g),this.innerHTML="";const f=B(r,"attributes",this.attributes,c=>h(c.nodeName,c.value)),b=c=>this.hasAttribute(c)||[...f.children].find(E=>E.localName===c);he(this,f),Object.keys(u).map(c=>b(c)||f.append(h(c,u[c]))),Object.keys(w).map(c=>b(c)||f.append(h(c))),B(r,"dataset",Object.keys(this.dataset),c=>h(c,this.dataset[c]));const T=B(r,"slice",x,c=>h(c,"")),M=c=>P(c,T);this.xml=r;const D=[],te=()=>{const c={};for(let E;E=D.pop();){const m=d(E.sliceElement,"slice");c[m]||(oe(T,m,E),c[m]=E)}Object.keys(c).length!==0&&V()};let W;this.onSlice=c=>{D.push(c),W||(W=setTimeout(()=>{te(),W=0},1))};const V=this.transform=()=>{if(this.#e)debugger;this.#e=1;const c=()=>{n.map((A,S)=>{const _=A.transformToFragment(r.ownerDocument,document);return _||console.error(`XSLT transformation error. xsl:
95
+ `,q(a[S]),`
96
+ xml:
97
+ `,q(r)),_}).map(A=>{A&&(fe(A),xe(this,A.childNodes))});let N=0;return Object.entries(u).map(([A,S])=>{!this.hasAttribute(A)&&S!==d(this,A)&&(this.setAttribute(A,S),this.#t(A,S),N++)}),Object.keys(w).map(A=>{let S=d(this.firstElementChild,A);S!==d(this,A)&&(this.setAttribute(A,S),this.#t(A,S),N++)}),N};c()&&c()&&console.warn("model update should not be the result of transform more than once");function E(m){let N=m;if(m.localName==="slice"){const A=d(m,"for");if(A||(N=m.parentElement),A==="^")do N=N.previousElementSibling;while(N.localName==="slice");else N=this.querySelector(A);if(!N)return console.warn(`can not find selector in "slice for=${A}" `,m.outerHTML);d(m,"slice")||m.setAttribute("slice",d(m,"name"))}return N}j(this,"[slice],[slice-event]",m=>{let N=d(m,"slice-event");const A=m.hasAttribute("slice-value")||m.hasAttribute("value")||m.value,S=E(m);m.dceInitialized||(m.dceInitialized=1,S.hasAttribute("custom-validity")&&(N+=" change submit"),[...new Set((N||"change").split(" "))].forEach(_=>S.addEventListener(_,$=>{$.sliceElement=m,$.sliceEventSource=$.currentTarget||$.target,$.sliceProcessed=0;const be=oe(T,d($.sliceElement,"slice"),$);j(this,"[custom-validity]",X=>{if(!X.setCustomValidity)return;const Z=d(X,"custom-validity");try{const U=Z&&P(Z,f);X.setCustomValidity(U===!0?"":U===!1?"invalid":U)}catch(U){console.error(U,"xPath",Z)}});const Y=d(S,"custom-validity"),z=Y&&P(Y,f),G=z===!0?"":z;if(Y){if(m.setCustomValidity?m.setCustomValidity(G):m.validationMessage=G,be.map(X=>X.setAttribute("validation-message",G)),$.type==="submit")return z===!0?void 0:(setTimeout(V,1),!!z===z?(z||$.preventDefault(),z):z?($.preventDefault(),!1):void 0);setTimeout(V,1)}this.onSlice($)})),(!N||N.includes("init"))&&(A?this.onSlice({type:"init",target:S,sliceElement:m,sliceEventSource:S}):m.value=M(d(m,"slice"))))}),this.#e=0};V(),te()}#t(i,r){i==="value"&&(this.value=r);const h=this.xml.querySelector("attributes");let g=this.xml.querySelector(`attributes>${i}`);g?F(g).append(L(g,r)):(g=C(i,r,this.xml),h.append(g)),this.#e||h.setAttribute(i,r),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{[i]:r}}))}attributeChangedCallback(i,r,h){!this.xml||this.#e||(this.#t(i,h),this.transform())}get dce(){return o}}const H=p=>{window.customElements.get(p)!==k&&window.customElements.define(p,k)};if(t)H(t);else{const p=s;this.setAttribute("tag",p),H(p);const i=document.createElement(p);this.getAttributeNames().forEach(r=>i.setAttribute(r,this.getAttribute(r))),i.append(...[...this.childNodes].filter(r=>r.localName!=="style")),this.append(i)}}get templateNode(){return this.firstElementChild?.tagName==="TEMPLATE"?this.firstElementChild.content:this}get dce(){return this}get xslt(){return O(this.xsltString)}}window.customElements.define("custom-element",De);export{he as a,ae as c,ne as m};
@@ -1,9 +1,9 @@
1
- import{w as d,e as a,u as c,f as u}from"./index-CxRwF5Or.js";import"./custom-element-uuAtIYWS.js";function p(n){return new Promise(e=>setTimeout(e,n))}function m(n){const{title:e,body:t}=n;return`
1
+ import{w as d,e as a,u as c,f as m}from"./index-CGuyH0k-.js";import"./custom-element-Bwx7otrT.js";function p(n){return new Promise(e=>setTimeout(e,n))}function g(n){const{title:e,body:t}=n;return`
2
2
  <fieldset>
3
3
  <legend>${e}</legend>
4
4
  ${t}
5
5
  </fieldset>
6
- `}const h={title:"dom-merge",render:m},s={args:{title:"Chars count in textarea",body:`
6
+ `}const h={title:"dom-merge",render:g},s={args:{title:"Chars count in textarea",body:`
7
7
  <p>Counter update happens on change event(focus change). The update should not interfere with the input</p>
8
8
  <custom-element>
9
9
  <form>
@@ -68,7 +68,7 @@ import{w as d,e as a,u as c,f as u}from"./index-CxRwF5Or.js";import"./custom-ele
68
68
  </if>
69
69
  </form>
70
70
  </custom-element>
71
- `},play:async({canvasElement:n})=>{const e=r.args.title,t=d(n);await t.findByText(e),await u.click(await t.findByTestId("cb1")),await a(await t.findByText("#1")).toBeInTheDocument(),await u.click(t.getByTestId("cb2")),await a(await t.findByText("#2")).toBeInTheDocument(),await a(t.getByTestId("beforeC1").nextElementSibling).toEqual(t.getByTestId("isC1"))}},l={args:{title:"read system validity message",body:`
71
+ `},play:async({canvasElement:n})=>{const e=r.args.title,t=d(n);await t.findByText(e),await m.click(await t.findByTestId("cb1")),await a(await t.findByText("#1")).toBeInTheDocument(),await m.click(t.getByTestId("cb2")),await a(await t.findByText("#2")).toBeInTheDocument(),await a(t.getByTestId("beforeC1").nextElementSibling.textContent).toEqual("#1")}},l={args:{title:"read system validity message",body:`
72
72
  <p>validationMessage propagated into slice as 'validation-message' attribute</p>
73
73
  <ol>
74
74
  <li> type in input field</li>
@@ -89,7 +89,22 @@ import{w as d,e as a,u as c,f as u}from"./index-CxRwF5Or.js";import"./custom-ele
89
89
  </form>
90
90
  </template>
91
91
  </custom-element>
92
- `},play:async({canvasElement:n})=>{const e=l.args.title,t=d(n);await t.findByText(e),await c.type(t.getByTestId("inp1"),"Hi"),await c.clear(t.getByTestId("inp1")),await c.click(t.getByTestId("btn1")),await a(await t.findByTestId("var1")).toBeInTheDocument(),await a(t.getByTestId("var1").textContent).toEqual(t.getByTestId("inp1").validationMessage),await a(t.getByTestId("var1").textContent.length>1).toEqual(!0)}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
92
+ `},play:async({canvasElement:n})=>{const e=l.args.title,t=d(n);await t.findByText(e),await c.type(t.getByTestId("inp1"),"Hi"),await c.clear(t.getByTestId("inp1")),await c.click(t.getByTestId("btn1")),await a(await t.findByTestId("var1")).toBeInTheDocument(),await a(t.getByTestId("var1").textContent).toEqual(t.getByTestId("inp1").validationMessage),await a(t.getByTestId("var1").textContent.length>1).toEqual(!0)}},u={args:{title:"Render inner components",body:`
93
+ <template id="test-icon">
94
+ <attribute name="img"></attribute>
95
+ <i>{img}</i>
96
+ </template>
97
+ <template id="test-button">
98
+ <attribute name="text"></attribute>
99
+ <button>
100
+ <slot>{text}</slot>
101
+ </button>
102
+ </template>
103
+
104
+ <custom-element src="#test-icon" tag="test-icon"></custom-element>
105
+ <custom-element src="#test-button" tag="test-button"></custom-element>
106
+ <test-button>icon:<test-icon img="👍"></test-icon></test-button>
107
+ `},play:async({canvasElement:n})=>{const e=d(n);await a(await e.findByText("👍")).toBeInTheDocument()}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
93
108
  args: {
94
109
  title: 'Chars count in textarea',
95
110
  body: \`
@@ -216,7 +231,7 @@ import{w as d,e as a,u as c,f as u}from"./index-CxRwF5Or.js";import"./custom-ele
216
231
  await expect(await canvas.findByText('#1')).toBeInTheDocument();
217
232
  await fireEvent.click(canvas.getByTestId('cb2'));
218
233
  await expect(await canvas.findByText('#2')).toBeInTheDocument();
219
- await expect(canvas.getByTestId("beforeC1").nextElementSibling).toEqual(canvas.getByTestId("isC1"));
234
+ await expect(canvas.getByTestId("beforeC1").nextElementSibling.textContent).toEqual('#1');
220
235
  }
221
236
  }`,...r.parameters?.docs?.source}}};l.parameters={...l.parameters,docs:{...l.parameters?.docs,source:{originalSource:`{
222
237
  args: {
@@ -257,4 +272,30 @@ import{w as d,e as a,u as c,f as u}from"./index-CxRwF5Or.js";import"./custom-ele
257
272
  await expect(canvas.getByTestId("var1").textContent).toEqual(canvas.getByTestId("inp1").validationMessage);
258
273
  await expect(canvas.getByTestId("var1").textContent.length > 1).toEqual(true);
259
274
  }
260
- }`,...l.parameters?.docs?.source}}};const y=["CharsCountInTextarea","WordCountOnType","OrderPreservingOn2ndTransform","ReadSystemValidityMessage"];export{s as CharsCountInTextarea,r as OrderPreservingOn2ndTransform,l as ReadSystemValidityMessage,o as WordCountOnType,y as __namedExportsOrder,h as default};
275
+ }`,...l.parameters?.docs?.source}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
276
+ args: {
277
+ title: 'Render inner components',
278
+ body: \`
279
+ <template id="test-icon">
280
+ <attribute name="img"></attribute>
281
+ <i>{img}</i>
282
+ </template>
283
+ <template id="test-button">
284
+ <attribute name="text"></attribute>
285
+ <button>
286
+ <slot>{text}</slot>
287
+ </button>
288
+ </template>
289
+
290
+ <custom-element src="#test-icon" tag="test-icon"></custom-element>
291
+ <custom-element src="#test-button" tag="test-button"></custom-element>
292
+ <test-button>icon:<test-icon img="👍"></test-icon></test-button>
293
+ \`
294
+ },
295
+ play: async ({
296
+ canvasElement
297
+ }) => {
298
+ const canvas = within(canvasElement);
299
+ await expect(await canvas.findByText('👍')).toBeInTheDocument();
300
+ }
301
+ }`,...u.parameters?.docs?.source}}};const f=["CharsCountInTextarea","WordCountOnType","OrderPreservingOn2ndTransform","ReadSystemValidityMessage","EmbedDCE"];export{s as CharsCountInTextarea,u as EmbedDCE,r as OrderPreservingOn2ndTransform,l as ReadSystemValidityMessage,o as WordCountOnType,f as __namedExportsOrder,h as default};