@epa-wg/custom-element-dist 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai/mcp/mcp.json +0 -0
- package/.claude/settings.local.json +4 -1
- package/.storybook/preview.ts +7 -1
- package/.yarn/install-state.gz +0 -0
- package/README.md +5 -5
- package/dist/{custom-element-BzDjIYMe.js → custom-element-BqBcmDiN.js} +5 -2
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +2 -2
- package/dist/{custom-element-Bssk9jRy.cjs → custom-element-jpOyXHF6.cjs} +1 -1
- package/dist/demo/for-each.html +213 -0
- package/package.json +4 -4
- package/public/demo/for-each.html +213 -0
- package/src/custom-element/custom-element.js +3 -0
- package/src/custom-element/demo/for-each.html +213 -0
- package/src/custom-element/ide/web-types-dce.json +1 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +2 -1
- package/src/material/theme/colors-native.html +32 -1
- package/src/mocks/versions.mock.ts +1 -1
- package/src/stories/__screenshots__/http-request.test.ts/http-request-http-request-headers-and-response-status-and-headers-1.png +0 -0
- package/src/stories/__screenshots__/http-request.test.ts/http-request-http-request-with-delayed--5-seconds-response-1.png +0 -0
- package/src/stories/__screenshots__/http-request.test.ts/http-request-http-request-with-error-1.png +0 -0
- package/src/stories/__screenshots__/http-request.test.ts/http-request-url-and-slice-1.png +0 -0
- package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
- package/src/stories/__screenshots__/slots.test.stories.ts/slots-slots-TemplateWithAttributesAndCondition-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-BooleanAndCondition-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-BooleanOrCondition-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-ChooseNoAttribute-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-ChooseOtherwise-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-ChooseSecondWhen-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-ChooseWhenOtherwise-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-IfFalse-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-IfNotExists-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-IfTrue-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-MultipleIfOrderingIssue-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-MultipleInstances-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-NestedConditions-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-NestedConditionsInactive-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-NumericComparison-1.png +0 -0
- package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-NumericComparisonLow-1.png +0 -0
- package/src/stories/__screenshots__/xslt-for-each.test.stories.ts/xslt-for-each-xslt-for-each-MultipleIfOrderingIssue-1.png +0 -0
- package/src/stories/__screenshots__/xslt-if.test.stories.ts/xslt-if-xslt-if-MultipleIfOrderingIssue-1.png +0 -0
- package/src/stories/attributes.test.stories.ts +2 -0
- package/src/stories/dom-merge.test.stories.ts +1 -0
- package/src/stories/external-template.test.stories.ts +5 -3
- package/src/stories/http-request.stories.ts +2 -1
- package/src/stories/module-url.test.stories.ts +1 -0
- package/src/stories/slice-events.test.stories.ts +3 -0
- package/src/stories/xslt-for-each.test.stories.ts +99 -1
- package/storybook-static/assets/{Color-F6OSRLHC-DeDlDLjU.js → Color-F6OSRLHC-FZZzFn7T.js} +1 -1
- package/storybook-static/assets/{Configure-CH_tIP5N.js → Configure-DyfktOJO.js} +1 -1
- package/storybook-static/assets/{DocsRenderer-CFRXHY34-Bc9EPsUI.js → DocsRenderer-CFRXHY34-5isVpCzj.js} +2 -2
- package/storybook-static/assets/{attributes.test.stories-BtamFQkF.js → attributes.test.stories-CrDC-RXf.js} +4 -3
- package/storybook-static/assets/{css.test.stories-BfNxLgwr.js → css.test.stories-ChWnZJwa.js} +1 -1
- package/storybook-static/assets/{custom-element-CnmjNo0g.js → custom-element-wuk8gYiP.js} +1 -1
- package/storybook-static/assets/{dom-merge.test.stories-DxnitrLK.js → dom-merge.test.stories-DkarPqD_.js} +2 -2
- package/storybook-static/assets/{external-template.test.stories-BTsww7B0.js → external-template.test.stories-DCboR8sG.js} +17 -16
- package/storybook-static/assets/{form.test.stories-DNJFtPJb.js → form.test.stories-BjeeUu0b.js} +1 -1
- package/storybook-static/assets/handlers-B7UMnC7v.js +291 -0
- package/storybook-static/assets/{http-request.stories-DgrBNle8.js → http-request.stories-WIldq1MC.js} +2 -2
- package/storybook-static/assets/{iframe-DiVWehoI.js → iframe-CBHPj1E5.js} +2 -2
- package/storybook-static/assets/{index-w6iX3YlR.js → index-BL0FQnAE.js} +3 -3
- package/storybook-static/assets/{index-CdEbhcV9.js → index-CzwPLrca.js} +1 -1
- package/storybook-static/assets/{local-storage.test.stories-Hwq80yUr.js → local-storage.test.stories-DLMK0p2s.js} +1 -1
- package/storybook-static/assets/{location-element.test.stories-mEhZzm7x.js → location-element.test.stories-BroqoLMS.js} +1 -1
- package/storybook-static/assets/{module-url.test.stories-Bj46iT0V.js → module-url.test.stories-B-0dibET.js} +2 -2
- package/storybook-static/assets/{preview-BjbXcJci.js → preview-BG24UPL5.js} +2 -2
- package/storybook-static/assets/preview-C1KnQPMW.js +50 -0
- package/storybook-static/assets/{set-url.test.stories-hzxLcqmm.js → set-url.test.stories-Dhq4YQyr.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-DVyXFRU1.js → slice-events.test.stories-BZJGIFku.js} +17 -15
- package/storybook-static/assets/{slots.test.stories-CS544nS4.js → slots.test.stories-DKivHwZH.js} +1 -1
- package/storybook-static/assets/{version-select.test.stories-D36nfYBq.js → version-select.test.stories-Dntyd7qb.js} +1 -1
- package/storybook-static/assets/{xslt-conditionals.test.stories-BS1PTIHe.js → xslt-conditionals.test.stories-Iq5iQNRj.js} +1 -1
- package/storybook-static/assets/{xslt-for-each.test.stories-CtPS20RK.js → xslt-for-each.test.stories-BMygBmj8.js} +132 -12
- package/storybook-static/assets/{xslt-if.test.stories-DcHrAMSY.js → xslt-if.test.stories-CVrFWdAX.js} +1 -1
- package/storybook-static/demo/for-each.html +213 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.json +1 -1
- package/storybook-static/project.json +1 -1
- package/vite.config.js +2 -1
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/coverage-final.json +0 -12
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -176
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/src/coverage.svg +0 -10
- package/coverage/src/custom-element/coverage.svg +0 -10
- package/coverage/src/custom-element/custom-element.js/coverage.svg +0 -10
- package/coverage/src/custom-element/custom-element.js.html +0 -3034
- package/coverage/src/custom-element/http-request.js/coverage.svg +0 -10
- package/coverage/src/custom-element/http-request.js.html +0 -373
- package/coverage/src/custom-element/index.html +0 -176
- package/coverage/src/custom-element/local-storage.js/coverage.svg +0 -10
- package/coverage/src/custom-element/local-storage.js.html +0 -361
- package/coverage/src/custom-element/location-element.js/coverage.svg +0 -10
- package/coverage/src/custom-element/location-element.js.html +0 -412
- package/coverage/src/custom-element/module-url.js/coverage.svg +0 -10
- package/coverage/src/custom-element/module-url.js.html +0 -187
- package/coverage/src/index.html +0 -116
- package/coverage/src/material/theme/colors.js/coverage.svg +0 -10
- package/coverage/src/material/theme/colors.js.html +0 -217
- package/coverage/src/material/theme/coverage.svg +0 -10
- package/coverage/src/material/theme/index.html +0 -116
- package/coverage/src/mocks/coverage.svg +0 -10
- package/coverage/src/mocks/handlers.ts/coverage.svg +0 -10
- package/coverage/src/mocks/handlers.ts.html +0 -196
- package/coverage/src/mocks/index.html +0 -116
- package/coverage/src/stories/coverage.svg +0 -10
- package/coverage/src/stories/frame.canvas.ts/coverage.svg +0 -10
- package/coverage/src/stories/frame.canvas.ts.html +0 -175
- package/coverage/src/stories/http-request.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/http-request.stories.ts.html +0 -817
- package/coverage/src/stories/index.html +0 -146
- package/coverage/src/stories/testStoryBook.ts/coverage.svg +0 -10
- package/coverage/src/stories/testStoryBook.ts.html +0 -169
- package/coverage/src/sum.ts/coverage.svg +0 -10
- package/coverage/src/sum.ts.html +0 -94
- package/storybook-static/assets/handlers-Dvg8CAeR.js +0 -470
- package/storybook-static/assets/preview-CfuT8gak.js +0 -50
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>for-each - Declarative Custom Element implementation demo</title>
|
|
6
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
7
|
+
|
|
8
|
+
<script type="module" src="../custom-element.js"></script>
|
|
9
|
+
<style>
|
|
10
|
+
@import "./demo.css";
|
|
11
|
+
|
|
12
|
+
table {
|
|
13
|
+
border-collapse: collapse;
|
|
14
|
+
margin: 1rem 0;
|
|
15
|
+
}
|
|
16
|
+
th, td {
|
|
17
|
+
border: 1px solid #ccc;
|
|
18
|
+
padding: 0.5rem;
|
|
19
|
+
}
|
|
20
|
+
th {
|
|
21
|
+
background: #f0f0f0;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
|
|
27
|
+
<nav>
|
|
28
|
+
<a href="../index.html"><h3><code>custom-element</code> demo</h3></a>
|
|
29
|
+
<h3>for-each loop</h3>
|
|
30
|
+
<p>The <code><for-each></code> element iterates over a node-set selected by XPath expression
|
|
31
|
+
and renders its content for each node.</p>
|
|
32
|
+
<p><b>XHTML namespace use</b><br/>
|
|
33
|
+
HTML elements like <code><table></code>, <code><tr></code>, <code><td></code>
|
|
34
|
+
have strict content model rules - only specific child elements are permitted.
|
|
35
|
+
For example, <code><table></code> only allows <code><thead></code>,
|
|
36
|
+
<code><tbody></code>, <code><tr></code> as children; <code><tr></code>
|
|
37
|
+
only allows <code><th></code> or <code><td></code>.<br/>
|
|
38
|
+
When the browser parses HTML, it moves non-permitted elements (like <code><for-each></code>)
|
|
39
|
+
outside the table before JavaScript runs.<br/>
|
|
40
|
+
Using <code>xhtml:</code> namespace prefix (e.g., <code><xhtml:table></code>,
|
|
41
|
+
<code><xhtml:tr></code>) prevents the browser from recognizing these as standard HTML
|
|
42
|
+
elements during initial parsing, preserving the template structure for DCE to process correctly.
|
|
43
|
+
See examples 4 and 6.
|
|
44
|
+
</p>
|
|
45
|
+
</nav>
|
|
46
|
+
|
|
47
|
+
<html-demo-element legend="1. Simple for-each"
|
|
48
|
+
description="Loop over inline XML data and render each item">
|
|
49
|
+
<template>
|
|
50
|
+
<custom-element>
|
|
51
|
+
<template>
|
|
52
|
+
<xsl:variable name="fruits">
|
|
53
|
+
<item>Apple</item>
|
|
54
|
+
<item>Banana</item>
|
|
55
|
+
<item>Cherry</item>
|
|
56
|
+
</xsl:variable>
|
|
57
|
+
<ul>
|
|
58
|
+
<for-each select="exsl:node-set($fruits)/*">
|
|
59
|
+
<li>{.}</li>
|
|
60
|
+
</for-each>
|
|
61
|
+
</ul>
|
|
62
|
+
</template>
|
|
63
|
+
</custom-element>
|
|
64
|
+
</template>
|
|
65
|
+
</html-demo-element>
|
|
66
|
+
|
|
67
|
+
<html-demo-element legend="2. for-each with position()"
|
|
68
|
+
description="Using position() to number items in the loop">
|
|
69
|
+
<template>
|
|
70
|
+
<custom-element>
|
|
71
|
+
<template>
|
|
72
|
+
<xsl:variable name="colors">
|
|
73
|
+
<color hex="#ff0000">Red</color>
|
|
74
|
+
<color hex="#00ff00">Green</color>
|
|
75
|
+
<color hex="#0000ff">Blue</color>
|
|
76
|
+
</xsl:variable>
|
|
77
|
+
<for-each select="exsl:node-set($colors)/*">
|
|
78
|
+
<div style="padding: 0.5rem; background: {@hex}; color: white;">
|
|
79
|
+
{position()}. {.}
|
|
80
|
+
</div>
|
|
81
|
+
</for-each>
|
|
82
|
+
</template>
|
|
83
|
+
</custom-element>
|
|
84
|
+
</template>
|
|
85
|
+
</html-demo-element>
|
|
86
|
+
|
|
87
|
+
<html-demo-element legend="3. Conditional for-each"
|
|
88
|
+
description="Initially empty, items shown when checkbox is checked">
|
|
89
|
+
<template>
|
|
90
|
+
<custom-element>
|
|
91
|
+
<template>
|
|
92
|
+
<xsl:variable name="items">
|
|
93
|
+
<item>First</item>
|
|
94
|
+
<item>Second</item>
|
|
95
|
+
<item>Third</item>
|
|
96
|
+
</xsl:variable>
|
|
97
|
+
<label>
|
|
98
|
+
<input type="checkbox" slice="show-items" value="yes"/>
|
|
99
|
+
Show items
|
|
100
|
+
</label>
|
|
101
|
+
<variable name="show" select="//show-items = 'yes'"></variable>
|
|
102
|
+
<div>
|
|
103
|
+
BEFORE
|
|
104
|
+
<for-each select="exsl:node-set($items)/*[$show]">
|
|
105
|
+
<span style="margin: 0 0.25rem; padding: 0.25rem; background: #e0e0ff;">
|
|
106
|
+
{position()}:{.}
|
|
107
|
+
</span>
|
|
108
|
+
</for-each>
|
|
109
|
+
AFTER
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
112
|
+
</custom-element>
|
|
113
|
+
</template>
|
|
114
|
+
</html-demo-element>
|
|
115
|
+
|
|
116
|
+
<html-demo-element legend="4. Nested for-each (Table)"
|
|
117
|
+
description="Nested loops to render table rows and cells">
|
|
118
|
+
<template>
|
|
119
|
+
<custom-element>
|
|
120
|
+
<template>
|
|
121
|
+
<xsl:variable name="table-data">
|
|
122
|
+
<row><cell>A1</cell><cell>A2</cell><cell>A3</cell></row>
|
|
123
|
+
<row><cell>B1</cell><cell>B2</cell><cell>B3</cell></row>
|
|
124
|
+
<row><cell>C1</cell><cell>C2</cell><cell>C3</cell></row>
|
|
125
|
+
</xsl:variable>
|
|
126
|
+
<variable name="rows" select="exsl:node-set($table-data)/*"></variable>
|
|
127
|
+
<xhtml:table>
|
|
128
|
+
<xhtml:thead>
|
|
129
|
+
<xhtml:tr>
|
|
130
|
+
<xhtml:th>Col 1</xhtml:th>
|
|
131
|
+
<xhtml:th>Col 2</xhtml:th>
|
|
132
|
+
<xhtml:th>Col 3</xhtml:th>
|
|
133
|
+
</xhtml:tr>
|
|
134
|
+
</xhtml:thead>
|
|
135
|
+
<xhtml:tbody>
|
|
136
|
+
<for-each select="$rows">
|
|
137
|
+
<xhtml:tr>
|
|
138
|
+
<for-each select="*">
|
|
139
|
+
<xhtml:td>{.}</xhtml:td>
|
|
140
|
+
</for-each>
|
|
141
|
+
</xhtml:tr>
|
|
142
|
+
</for-each>
|
|
143
|
+
</xhtml:tbody>
|
|
144
|
+
</xhtml:table>
|
|
145
|
+
</template>
|
|
146
|
+
</custom-element>
|
|
147
|
+
</template>
|
|
148
|
+
</html-demo-element>
|
|
149
|
+
|
|
150
|
+
<html-demo-element legend="5. for-each with attributes"
|
|
151
|
+
description="Access element attributes within the loop">
|
|
152
|
+
<template>
|
|
153
|
+
<custom-element>
|
|
154
|
+
<template>
|
|
155
|
+
<xsl:variable name="users">
|
|
156
|
+
<user id="1" role="admin">Alice</user>
|
|
157
|
+
<user id="2" role="editor">Bob</user>
|
|
158
|
+
<user id="3" role="viewer">Charlie</user>
|
|
159
|
+
</xsl:variable>
|
|
160
|
+
<for-each select="exsl:node-set($users)/*">
|
|
161
|
+
<div style="padding: 0.5rem; margin: 0.25rem 0; border-left: 3px solid #007bff;">
|
|
162
|
+
<strong>#{@id}</strong> {.}
|
|
163
|
+
<em>({@role})</em>
|
|
164
|
+
</div>
|
|
165
|
+
</for-each>
|
|
166
|
+
</template>
|
|
167
|
+
</custom-element>
|
|
168
|
+
</template>
|
|
169
|
+
</html-demo-element>
|
|
170
|
+
|
|
171
|
+
<html-demo-element legend="6. Dynamic table with toggle"
|
|
172
|
+
description="Table rows appear/disappear based on checkbox state">
|
|
173
|
+
<template>
|
|
174
|
+
<custom-element>
|
|
175
|
+
<template>
|
|
176
|
+
<xsl:variable name="products">
|
|
177
|
+
<product price="10">Widget</product>
|
|
178
|
+
<product price="25">Gadget</product>
|
|
179
|
+
<product price="15">Gizmo</product>
|
|
180
|
+
</xsl:variable>
|
|
181
|
+
<variable name="items" select="exsl:node-set($products)/*"></variable>
|
|
182
|
+
<label>
|
|
183
|
+
<input type="checkbox" slice="show-products" value="yes"/>
|
|
184
|
+
Show products
|
|
185
|
+
</label>
|
|
186
|
+
<variable name="visible" select="//show-products = 'yes'"></variable>
|
|
187
|
+
<xhtml:table>
|
|
188
|
+
<xhtml:thead>
|
|
189
|
+
<xhtml:tr>
|
|
190
|
+
<xhtml:th>#</xhtml:th>
|
|
191
|
+
<xhtml:th>Product</xhtml:th>
|
|
192
|
+
<xhtml:th>Price</xhtml:th>
|
|
193
|
+
</xhtml:tr>
|
|
194
|
+
</xhtml:thead>
|
|
195
|
+
<xhtml:tbody>
|
|
196
|
+
<for-each select="$items[$visible]">
|
|
197
|
+
<xhtml:tr>
|
|
198
|
+
<xhtml:td>{position()}</xhtml:td>
|
|
199
|
+
<xhtml:td>{.}</xhtml:td>
|
|
200
|
+
<xhtml:td>${@price}</xhtml:td>
|
|
201
|
+
</xhtml:tr>
|
|
202
|
+
</for-each>
|
|
203
|
+
</xhtml:tbody>
|
|
204
|
+
</xhtml:table>
|
|
205
|
+
</template>
|
|
206
|
+
</custom-element>
|
|
207
|
+
</template>
|
|
208
|
+
</html-demo-element>
|
|
209
|
+
|
|
210
|
+
<script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
|
|
211
|
+
|
|
212
|
+
</body>
|
|
213
|
+
</html>
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
<a href="./demo/attributes.html" >attributes </a> |
|
|
55
55
|
<a href="./demo/data-slices.html" >data slices/events </a> |
|
|
56
56
|
<a href="./demo/form.html" >Form validation </a> |
|
|
57
|
-
<a href="./demo/dom-merge.html" >DOM merge on dynamic update </a
|
|
57
|
+
<a href="./demo/dom-merge.html" >DOM merge on dynamic update </a> |
|
|
58
|
+
<a href="./demo/for-each.html" >for-each loop in TABLE </a><br/>
|
|
58
59
|
<a href="./demo/npm-versions-demo.html">npm version </a>
|
|
59
60
|
</section>
|
|
60
61
|
</nav>
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
<style>
|
|
7
7
|
|
|
8
8
|
figure>table {
|
|
9
|
+
background-color: lightgreen;
|
|
10
|
+
caption{ background-color: Canvas; color: CanvasText; }
|
|
9
11
|
tbody>tr {
|
|
10
12
|
background-image: repeating-linear-gradient(45deg, transparent, transparent 0.25em, grey 0.25em, green 0.5em);
|
|
11
13
|
td{ background-image: linear-gradient(to right, lightgreen, lightyellow); }
|
|
@@ -19,7 +21,36 @@
|
|
|
19
21
|
<figure class="table-container">
|
|
20
22
|
<figcaption><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/system-color"> Native browser colors </a>
|
|
21
23
|
</figcaption>
|
|
22
|
-
<table class="dashed-diagonal-background" style="
|
|
24
|
+
<table class="dashed-diagonal-background" style="color-scheme: light;">
|
|
25
|
+
<caption>Light mode</caption>
|
|
26
|
+
<thead>
|
|
27
|
+
<tr>
|
|
28
|
+
<th>Sample</th><th>background </th><th>text color </th><th>Description</th>
|
|
29
|
+
</tr>
|
|
30
|
+
</thead>
|
|
31
|
+
<tbody>
|
|
32
|
+
<tr><td style="background-color: AccentColor; color:AccentColorText " >AccentColor </td><td><code>AccentColor </code></td><td><code> AccentColorText </code></td> <td>Background of accented user interface controls. </td> </tr>
|
|
33
|
+
<tr><td style="background-color: AccentColorText; color:AccentColor " >AccentColorText </td><td><code>AccentColorText </code></td><td><code> AccentColor </code></td><td>Text of accented user interface controls. </td></tr>
|
|
34
|
+
<tr><td style="background-color: ActiveText; color:Canvas " >ActiveText </td><td><code>ActiveText </code></td><td><code> Canvas </code></td><td>Text of active links. </td></tr>
|
|
35
|
+
<tr><td style="background-color: Highlight; color:HighlightText " >Highlight </td><td><code>Highlight </code></td><td><code> HighlightText </code></td><td>Background of selected items. </td></tr>
|
|
36
|
+
<tr><td style="background-color: LinkText; color:Canvas " >LinkText </td><td><code>LinkText </code></td><td><code> Canvas </code></td><td>Text of non-active, non-visited links. </td></tr>
|
|
37
|
+
<tr><td style="background-color: SelectedItem; color:SelectedItemText " >SelectedItem </td><td><code>SelectedItem </code></td><td><code> SelectedItemText </code></td><td>Background of selected items, for example, a selected checkbox. </td></tr>
|
|
38
|
+
<tr><td style="background-color: VisitedText; color:Canvas " >VisitedText </td><td><code>VisitedText </code></td><td><code> Canvas </code></td><td>Text of visited links. </td></tr>
|
|
39
|
+
<tr><td style="background-color: Mark; color:MarkText " >Mark </td><td><code>Mark </code></td><td><code> MarkText </code></td><td>Background of text that has been specially marked (such as by the HTML <code>mark</code> element). </td></tr>
|
|
40
|
+
<tr><td style="background-color: CanvasText; color:Canvas " >CanvasText </td><td><code>CanvasText </code></td><td><code> Canvas </code></td><td>Text color in application content or documents. </td></tr>
|
|
41
|
+
<tr><td style="background-color: ButtonText; color:Canvas " >ButtonText </td><td><code>ButtonText </code></td><td><code> Canvas </code></td><td>Text color of controls. </td></tr>
|
|
42
|
+
<tr><td style="background-color: FieldText; color:Canvas " >FieldText </td><td><code>FieldText </code></td><td><code> Canvas </code></td><td>Text in input fields. </td></tr>
|
|
43
|
+
<tr><td style="background-color: MarkText; color:Mark " >MarkText </td><td><code>MarkText </code></td><td><code> Mark </code></td><td>Text that has been specially marked (such as by the HTML <code>mark</code> element). </td></tr>
|
|
44
|
+
<tr><td style="background-color: ButtonBorder; color:Canvas " >ButtonBorder </td><td><code>ButtonBorder </code></td><td><code> Canvas </code></td><td>Base border color of controls. </td></tr>
|
|
45
|
+
<tr><td style="background-color: GrayText; color:ButtonFace " >GrayText </td><td><code>GrayText </code></td><td><code> ButtonFace </code></td><td>Text color for disabled items (for example, a disabled control). </td></tr>
|
|
46
|
+
<tr><td style="background-color: ButtonFace; color:CanvasText " >ButtonFace </td><td><code>ButtonFace </code></td><td><code> CanvasText </code></td><td>Background color of controls. </td></tr>
|
|
47
|
+
<tr><td style="background-color: Canvas; color:CanvasText " >Canvas </td><td><code>Canvas </code></td><td><code> CanvasText </code></td><td>Background of application content or documents. </td></tr>
|
|
48
|
+
<tr><td style="background-color: Field; color:CanvasText " >Field </td><td><code>Field </code></td><td><code> CanvasText </code></td><td>Background of input fields. </td></tr>
|
|
49
|
+
<tr><td style="background-color: HighlightText; color:Highlight " >HighlightText </td><td><code>HighlightText </code></td><td><code> Highlight </code></td><td>Text color of selected items. </td></tr>
|
|
50
|
+
<tr><td style="background-color: SelectedItemText; color:SelectedItem " >SelectedItemText</td><td><code>SelectedItemText</code></td><td><code> SelectedItem </code></td><td>Text of selected items. </td></tr>
|
|
51
|
+
</tbody></table>
|
|
52
|
+
<table class="dashed-diagonal-background" style="color-scheme: dark;">
|
|
53
|
+
<caption>Dark mode</caption>
|
|
23
54
|
<thead>
|
|
24
55
|
<tr>
|
|
25
56
|
<th>Sample</th><th>background </th><th>text color </th><th>Description</th>
|
|
Binary file
|
|
Binary file
|
package/src/stories/__screenshots__/http-request.test.ts/http-request-http-request-with-error-1.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -25,6 +25,7 @@ const meta =
|
|
|
25
25
|
{ title: 'attributes'
|
|
26
26
|
// , tags: ['autodocs']
|
|
27
27
|
, render
|
|
28
|
+
, parameters: { test:{ dangerouslyIgnoreUnhandledErrors: true}}
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
export default meta;
|
|
@@ -290,6 +291,7 @@ export const AttributesPropagationUp:Story =
|
|
|
290
291
|
|
|
291
292
|
t3.querySelector('input')?.focus();
|
|
292
293
|
await userEvent.keyboard('DCE');
|
|
294
|
+
await canvas.findByText('//from-input: DCE')
|
|
293
295
|
await expect( t3 ).toHaveAttribute('p3','DCE');
|
|
294
296
|
|
|
295
297
|
},
|
|
@@ -24,6 +24,7 @@ function render(args: TProps)
|
|
|
24
24
|
const meta =
|
|
25
25
|
{ title: 'external-templates'
|
|
26
26
|
, render
|
|
27
|
+
, parameters: { test:{ dangerouslyIgnoreUnhandledErrors: true}}
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
export default meta;
|
|
@@ -151,6 +152,7 @@ export const ExternalHtmlFileInline:Story =
|
|
|
151
152
|
const canvas = within(canvasElement);
|
|
152
153
|
await canvas.findByText(ExternalHtmlFileInline.args!.title as string);
|
|
153
154
|
await canvas.findByText('👋');
|
|
155
|
+
await canvas.findByText('👌');
|
|
154
156
|
const t5 = canvasElement.innerHTML;
|
|
155
157
|
expect(t5).to.include('👋');
|
|
156
158
|
expect(t5).to.include('👌');
|
|
@@ -169,7 +171,7 @@ export const HtmlWithinHtmlFile:Story =
|
|
|
169
171
|
{
|
|
170
172
|
const canvas = within(canvasElement);
|
|
171
173
|
await canvas.findByText(HtmlWithinHtmlFile.args!.title as string);
|
|
172
|
-
expect(await canvas.findByText('👋')).toBeInTheDocument();
|
|
174
|
+
await expect(await canvas.findByText('👋')).toBeInTheDocument();
|
|
173
175
|
},
|
|
174
176
|
};
|
|
175
177
|
|
|
@@ -183,7 +185,7 @@ export const SvgWithinHtmlFile:Story =
|
|
|
183
185
|
{
|
|
184
186
|
const canvas = within(canvasElement);
|
|
185
187
|
await canvas.findByText(SvgWithinHtmlFile.args!.title as string);
|
|
186
|
-
expect(await canvas.findByTestId('svg-test')).toBeInTheDocument();
|
|
188
|
+
await expect(await canvas.findByTestId('svg-test')).toBeInTheDocument();
|
|
187
189
|
},
|
|
188
190
|
};
|
|
189
191
|
|
|
@@ -199,7 +201,7 @@ export const MathMLWithinHtmlFile:Story =
|
|
|
199
201
|
const frCanvas = await frameCanvas('fr',canvas);
|
|
200
202
|
|
|
201
203
|
const ml = await frCanvas.findByTestId('ml-test');
|
|
202
|
-
expect(ml.firstElementChild.localName).toEqual('mrow');
|
|
204
|
+
await expect(ml.firstElementChild.localName).toEqual('mrow');
|
|
203
205
|
},
|
|
204
206
|
};
|
|
205
207
|
|
|
@@ -226,6 +226,7 @@ export const CheckboxUnchecked:Story =
|
|
|
226
226
|
await userEvent.click ( cb );
|
|
227
227
|
await expect( await canvas.findByText('slice: V1')).toBeInTheDocument();
|
|
228
228
|
await userEvent.click ( cb );
|
|
229
|
+
await expect( await canvas.findByText('slice:')).toBeInTheDocument();
|
|
229
230
|
await expect( p.textContent).toEqual('slice: ');
|
|
230
231
|
|
|
231
232
|
},
|
|
@@ -250,6 +251,8 @@ export const CheckboxSliceValue:Story =
|
|
|
250
251
|
await userEvent.click ( cb );
|
|
251
252
|
await expect( await canvas.findByText('slice: V1')).toBeInTheDocument();
|
|
252
253
|
await userEvent.click ( cb );
|
|
254
|
+
await expect( await canvas.findByText('slice:')).toBeInTheDocument();
|
|
255
|
+
|
|
253
256
|
await expect( p.textContent).toEqual('slice: ');
|
|
254
257
|
|
|
255
258
|
},
|
|
@@ -27,7 +27,12 @@ function render(args: TProps) {
|
|
|
27
27
|
|
|
28
28
|
const meta = {
|
|
29
29
|
title: 'xslt/for-each',
|
|
30
|
-
render
|
|
30
|
+
render,
|
|
31
|
+
parameters: {
|
|
32
|
+
test: {
|
|
33
|
+
dangerouslyIgnoreUnhandledErrors: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
export default meta;
|
|
@@ -324,6 +329,99 @@ export const ForEach_0_2_N: Story = {
|
|
|
324
329
|
};
|
|
325
330
|
|
|
326
331
|
|
|
332
|
+
const Table3x3Data = `
|
|
333
|
+
<rows>
|
|
334
|
+
<r id="1"><d>A1</d><d>A2</d><d>A3</d></r>
|
|
335
|
+
<r id="2"><d>B1</d><d>B2</d><d>B3</d></r>
|
|
336
|
+
<r id="3"><d>C1</d><d>C2</d><d>C3</d></r>
|
|
337
|
+
</rows>`;
|
|
338
|
+
|
|
339
|
+
export const ForEach_Table_3x3: Story = {
|
|
340
|
+
args: {
|
|
341
|
+
title: 'Table 3x3: initially empty, rows shown by checkbox, content stays inside table',
|
|
342
|
+
tag: 'for-each-table-3x3',
|
|
343
|
+
template: `
|
|
344
|
+
<xsl:variable name="rows-data">${Table3x3Data}</xsl:variable>
|
|
345
|
+
<variable name="rows" select="exsl:node-set($rows-data)/*/*"></variable>
|
|
346
|
+
<label><input type="checkbox" data-testid="toggle-rows" slice="show-rows" value="yes" /> Show rows</label>
|
|
347
|
+
<variable name="show-rows" select="//show-rows = 'yes'"></variable>
|
|
348
|
+
<pre data-testid="just-text">
|
|
349
|
+
JUST_TEXT_BEFORE
|
|
350
|
+
<for-each select="$rows[$show-rows]">
|
|
351
|
+
<for-each select="*">
|
|
352
|
+
{.} #
|
|
353
|
+
</for-each>
|
|
354
|
+
</for-each>
|
|
355
|
+
JUST_TEXT_AFTER
|
|
356
|
+
</pre>
|
|
357
|
+
<div data-testid="container">
|
|
358
|
+
TEXT_BEFORE
|
|
359
|
+
<xhtml:table data-testid="the-table">
|
|
360
|
+
<xhtml:thead>
|
|
361
|
+
<xhtml:tr><xhtml:th>Col A</xhtml:th><xhtml:th>Col B</xhtml:th><xhtml:th>Col C</xhtml:th></xhtml:tr>
|
|
362
|
+
</xhtml:thead>
|
|
363
|
+
<xhtml:tbody data-testid="table-body">
|
|
364
|
+
<for-each select="$rows[$show-rows]">
|
|
365
|
+
<xhtml:tr data-testid="row-{@id}">
|
|
366
|
+
<for-each select="*">
|
|
367
|
+
<xhtml:td>{.}</xhtml:td>
|
|
368
|
+
</for-each>
|
|
369
|
+
</xhtml:tr>
|
|
370
|
+
</for-each>
|
|
371
|
+
</xhtml:tbody>
|
|
372
|
+
</xhtml:table>
|
|
373
|
+
TEXT_AFTER
|
|
374
|
+
</div>
|
|
375
|
+
`,
|
|
376
|
+
payload: `
|
|
377
|
+
<for-each-table-3x3></for-each-table-3x3>
|
|
378
|
+
`
|
|
379
|
+
},
|
|
380
|
+
play: async ({ canvasElement }) => {
|
|
381
|
+
const canvas = within(canvasElement);
|
|
382
|
+
|
|
383
|
+
const justTextContainer = await canvas.findByTestId('just-text');
|
|
384
|
+
expect(justTextContainer.textContent).toMatch(/JUST_TEXT_BEFORE[\s\S]*JUST_TEXT_AFTER/);
|
|
385
|
+
|
|
386
|
+
const container = await canvas.findByTestId('container');
|
|
387
|
+
const table = await canvas.findByTestId('the-table');
|
|
388
|
+
const tbody = await canvas.findByTestId('table-body');
|
|
389
|
+
|
|
390
|
+
// Initially no rows visible
|
|
391
|
+
expect(tbody.querySelectorAll('tr').length).toBe(0);
|
|
392
|
+
// TEXT_BEFORE ... TEXT_AFTER with table in between (but no row content)
|
|
393
|
+
expect(container.textContent).toMatch(/TEXT_BEFORE[\s\S]*Col A[\s\S]*TEXT_AFTER/);
|
|
394
|
+
|
|
395
|
+
// Toggle checkbox to show rows
|
|
396
|
+
await fireEvent.click(await canvas.findByTestId('toggle-rows'));
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
// Now 3 rows should be visible
|
|
401
|
+
expect(await canvas.findByTestId('row-1')).toBeInTheDocument();
|
|
402
|
+
expect(await canvas.findByTestId('row-2')).toBeInTheDocument();
|
|
403
|
+
expect(await canvas.findByTestId('row-3')).toBeInTheDocument();
|
|
404
|
+
expect(tbody.querySelectorAll('tr').length).toBe(3);
|
|
405
|
+
|
|
406
|
+
expect(justTextContainer.textContent).toMatch(/JUST_TEXT_BEFORE[\s\S]*A1 #/);
|
|
407
|
+
expect(justTextContainer.textContent).toMatch(/C3 #[\s\S]*JUST_TEXT_AFTER/);
|
|
408
|
+
|
|
409
|
+
// Verify rows are inside the table (TR should be children of TBODY)
|
|
410
|
+
const rows = tbody.querySelectorAll('tr');
|
|
411
|
+
rows.forEach(row => {
|
|
412
|
+
expect(row.parentElement).toBe(tbody);
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
// Verify table content is between TEXT_BEFORE and TEXT_AFTER
|
|
416
|
+
expect(container.textContent).toMatch(/TEXT_BEFORE[\s\S]*?Col A[\s\S]*?Col B[\s\S]*?Col C[\s\S]*?A1[\s\S]*?A2[\s\S]*?A3[\s\S]*?B1[\s\S]*?B2[\s\S]*?B3[\s\S]*?C1[\s\S]*?C2[\s\S]*?C3[\s\S]*?TEXT_AFTER/);
|
|
417
|
+
|
|
418
|
+
// Verify no content leaked outside the table
|
|
419
|
+
const tableHtml = table.outerHTML;
|
|
420
|
+
expect(tableHtml).toContain('A1');
|
|
421
|
+
expect(tableHtml).toContain('C3');
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
|
|
327
425
|
//#region unit tests
|
|
328
426
|
/* istanbul ignore else -- @preserve */
|
|
329
427
|
if ('test' === import.meta.env.MODE &&
|