@kubex/zinc 1.1.159 → 1.1.161
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/dist/custom-elements.json +148 -77
- package/dist/vscode.html-custom-data.json +21 -12
- package/dist/web-types.json +35 -25
- package/dist/zn.d.ts +122 -110
- package/dist/zn.min.js +186 -183
- package/docs/pages/components/page.md +15 -0
- package/package.json +1 -1
- package/src/components/button/button.component.ts +4 -0
- package/src/components/button/button.test.ts +10 -0
- package/src/components/content-block/content-block.component.ts +2 -3
- package/src/components/flow-builder/modules/flow-node/flow-node.test.ts +2 -3
- package/src/components/flow-builder/modules/flow-step-group/flow-step-group.test.ts +14 -8
- package/src/components/form-actions/form-actions.test.ts +4 -1
- package/src/components/form-group/form-group.component.ts +45 -15
- package/src/components/navbar/navbar.test.ts +3 -2
- package/src/components/page/page.component.ts +25 -4
- package/src/components/page/page.test.ts +68 -16
- package/src/components/sp/sp.test.ts +2 -2
- package/src/components/tabs/tabs.component.ts +1 -1
- package/src/components/theme-editor/theme-editor.component.ts +3 -2
- package/src/components/theme-editor/theme-editor.test.ts +30 -28
- package/src/components/translation-group/translation-group.test.ts +0 -2
|
@@ -19,6 +19,11 @@ function spyOnFrame(el: Element): ThemeCall[] {
|
|
|
19
19
|
return calls;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// zn-button overrides click() without dispatching a DOM event, so fire a real one.
|
|
23
|
+
function press(el: Element) {
|
|
24
|
+
el.dispatchEvent(new MouseEvent('click', {bubbles: true, composed: true, cancelable: true}));
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
describe('<zn-theme-editor>', () => {
|
|
23
28
|
const FIXTURE = html`
|
|
24
29
|
<zn-theme-editor src="about:blank" frame-origin="https://site.example" debounce="10">
|
|
@@ -174,7 +179,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
174
179
|
const el = await fixture(FIXTURE);
|
|
175
180
|
const calls = spyOnFrame(el);
|
|
176
181
|
|
|
177
|
-
el.shadowRoot!.querySelector
|
|
182
|
+
press(el.shadowRoot!.querySelector('[data-device="mobile"]')!);
|
|
178
183
|
await (el as HTMLElement & {updateComplete: Promise<unknown>}).updateComplete;
|
|
179
184
|
|
|
180
185
|
expect((el as HTMLElement & {device: string}).device).to.equal('mobile');
|
|
@@ -192,7 +197,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
192
197
|
detail = (e as CustomEvent<{device: string}>).detail;
|
|
193
198
|
});
|
|
194
199
|
|
|
195
|
-
el.shadowRoot!.querySelector
|
|
200
|
+
press(el.shadowRoot!.querySelector('[data-device="tablet"]')!);
|
|
196
201
|
|
|
197
202
|
await waitUntil(() => detail !== null);
|
|
198
203
|
expect(detail!.device).to.equal('tablet');
|
|
@@ -205,7 +210,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
205
210
|
expect(desktop.getAttribute('aria-pressed')).to.equal('true');
|
|
206
211
|
expect(mobile.getAttribute('aria-pressed')).to.equal('false');
|
|
207
212
|
|
|
208
|
-
mobile
|
|
213
|
+
press(mobile);
|
|
209
214
|
await (el as HTMLElement & {updateComplete: Promise<unknown>}).updateComplete;
|
|
210
215
|
|
|
211
216
|
expect(desktop.getAttribute('aria-pressed')).to.equal('false');
|
|
@@ -216,7 +221,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
216
221
|
const el = await fixture(FIXTURE);
|
|
217
222
|
const calls = spyOnFrame(el);
|
|
218
223
|
|
|
219
|
-
el.shadowRoot!.querySelector
|
|
224
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
220
225
|
|
|
221
226
|
await waitUntil(() => calls.length === 1);
|
|
222
227
|
expect((el as HTMLElement & {mode: string}).mode).to.equal('dark');
|
|
@@ -232,7 +237,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
232
237
|
</zn-theme-editor>`);
|
|
233
238
|
const calls = spyOnFrame(el);
|
|
234
239
|
|
|
235
|
-
el.shadowRoot!.querySelector
|
|
240
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
236
241
|
await waitUntil(() => calls.length === 1);
|
|
237
242
|
|
|
238
243
|
expect(calls[0]['values']).to.deep.equal({background: '#000000'});
|
|
@@ -256,7 +261,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
256
261
|
const el = await fixture(FIXTURE);
|
|
257
262
|
const calls = spyOnFrame(el);
|
|
258
263
|
|
|
259
|
-
el.shadowRoot!.querySelector
|
|
264
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
260
265
|
await waitUntil(() => calls.length === 1);
|
|
261
266
|
|
|
262
267
|
expect(calls[0]['values']).to.deep.equal({radius: '8'});
|
|
@@ -269,7 +274,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
269
274
|
const calls = spyOnFrame(el);
|
|
270
275
|
const input = el.querySelector('zn-input')! as HTMLElement & {value: string};
|
|
271
276
|
|
|
272
|
-
el.shadowRoot!.querySelector
|
|
277
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!); // -> dark, radius '8'
|
|
273
278
|
await waitUntil(() => calls.length === 1);
|
|
274
279
|
|
|
275
280
|
input.value = '99';
|
|
@@ -277,7 +282,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
277
282
|
await waitUntil(() => calls.length === 2);
|
|
278
283
|
expect(calls[1]['values']).to.deep.equal({radius: '99'});
|
|
279
284
|
|
|
280
|
-
el.shadowRoot!.querySelector
|
|
285
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!); // -> light, untouched
|
|
281
286
|
await waitUntil(() => calls.length === 3);
|
|
282
287
|
expect(calls[2]['values']).to.deep.equal({radius: '8'});
|
|
283
288
|
expect(input.value).to.equal('8');
|
|
@@ -290,7 +295,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
290
295
|
</zn-theme-editor>`);
|
|
291
296
|
const calls = spyOnFrame(el);
|
|
292
297
|
|
|
293
|
-
el.shadowRoot!.querySelector
|
|
298
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
294
299
|
await waitUntil(() => calls.length === 1);
|
|
295
300
|
|
|
296
301
|
expect(calls[0]['values']).to.deep.equal({rounded: true});
|
|
@@ -305,7 +310,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
305
310
|
</zn-theme-editor>`);
|
|
306
311
|
const calls = spyOnFrame(el);
|
|
307
312
|
|
|
308
|
-
el.shadowRoot!.querySelector
|
|
313
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
309
314
|
await waitUntil(() => calls.length === 1);
|
|
310
315
|
|
|
311
316
|
expect(calls[0]['values']).to.deep.equal({rounded: true});
|
|
@@ -334,7 +339,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
334
339
|
input.value = '99';
|
|
335
340
|
input.dispatchEvent(new CustomEvent('zn-input', {bubbles: true, composed: true}));
|
|
336
341
|
// toggle before the 50ms push debounce fires - no await in between
|
|
337
|
-
el.shadowRoot!.querySelector
|
|
342
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
338
343
|
|
|
339
344
|
await waitUntil(() => calls.length >= 1);
|
|
340
345
|
// give the (now-cancelled) original debounce timer a chance to prove it's gone
|
|
@@ -572,7 +577,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
572
577
|
expect((el as HTMLElement & {values: {light: Record<string, unknown>; dark: Record<string, unknown>}}).values)
|
|
573
578
|
.to.deep.equal({light: {accent: '#ffffff'}, dark: {accent: '#000000'}});
|
|
574
579
|
|
|
575
|
-
el.shadowRoot!.querySelector
|
|
580
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
576
581
|
await waitUntil(() => calls.length === 1);
|
|
577
582
|
|
|
578
583
|
expect(calls[0]['values']).to.deep.equal({accent: '#000000'});
|
|
@@ -1378,7 +1383,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
1378
1383
|
</zn-theme-editor>`);
|
|
1379
1384
|
spyOnFrame(el);
|
|
1380
1385
|
|
|
1381
|
-
el.shadowRoot!.querySelector
|
|
1386
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
1382
1387
|
|
|
1383
1388
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
1384
1389
|
expect(fetchCalls.length).to.equal(0);
|
|
@@ -1400,7 +1405,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
1400
1405
|
</zn-theme-editor>`);
|
|
1401
1406
|
spyOnFrame(el);
|
|
1402
1407
|
|
|
1403
|
-
el.shadowRoot!.querySelector
|
|
1408
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
1404
1409
|
|
|
1405
1410
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
1406
1411
|
expect(fetchCalls.length).to.equal(0);
|
|
@@ -1423,7 +1428,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
1423
1428
|
</zn-theme-editor>`);
|
|
1424
1429
|
const calls = spyOnFrame(el);
|
|
1425
1430
|
|
|
1426
|
-
el.shadowRoot!.querySelector
|
|
1431
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
1427
1432
|
|
|
1428
1433
|
await waitUntil(() => calls.length === 1);
|
|
1429
1434
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
@@ -1443,8 +1448,8 @@ describe('<zn-theme-editor>', () => {
|
|
|
1443
1448
|
</zn-theme-editor>`);
|
|
1444
1449
|
spyOnFrame(el);
|
|
1445
1450
|
|
|
1446
|
-
el.shadowRoot!.querySelector
|
|
1447
|
-
el.shadowRoot!.querySelector
|
|
1451
|
+
press(el.shadowRoot!.querySelector('[data-mode-toggle]')!);
|
|
1452
|
+
press(el.shadowRoot!.querySelector('[data-device="mobile"]')!);
|
|
1448
1453
|
|
|
1449
1454
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
1450
1455
|
expect(fetchCalls.length).to.equal(0);
|
|
@@ -1522,11 +1527,8 @@ describe('<zn-theme-editor>', () => {
|
|
|
1522
1527
|
let fetchCalls: {uri: string; init?: RequestInit}[];
|
|
1523
1528
|
const realFetch = window.fetch;
|
|
1524
1529
|
|
|
1525
|
-
// zn-button overrides click() to call its handler directly without dispatching -
|
|
1526
|
-
// a real click event is needed for the theme-editor's own @click listener to fire.
|
|
1527
1530
|
function clickButton(el: Element) {
|
|
1528
|
-
|
|
1529
|
-
button.dispatchEvent(new MouseEvent('click', {bubbles: true, composed: true, cancelable: true}));
|
|
1531
|
+
press(el.shadowRoot!.querySelector('zn-button.editor__submit')!);
|
|
1530
1532
|
}
|
|
1531
1533
|
|
|
1532
1534
|
beforeEach(() => {
|
|
@@ -1543,7 +1545,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
1543
1545
|
|
|
1544
1546
|
it('renders no button without submit-label', async () => {
|
|
1545
1547
|
const el = await fixture(FIXTURE);
|
|
1546
|
-
expect(el.shadowRoot!.querySelector('zn-button')).to.not.exist;
|
|
1548
|
+
expect(el.shadowRoot!.querySelector('zn-button.editor__submit')).to.not.exist;
|
|
1547
1549
|
});
|
|
1548
1550
|
|
|
1549
1551
|
it('renders the button in the toolbar, not the footer, and leaves the footer slot working', async () => {
|
|
@@ -1553,11 +1555,11 @@ describe('<zn-theme-editor>', () => {
|
|
|
1553
1555
|
<span slot="footer">extra</span>
|
|
1554
1556
|
</zn-theme-editor>`);
|
|
1555
1557
|
|
|
1556
|
-
const button = el.shadowRoot!.querySelector('zn-button')!;
|
|
1558
|
+
const button = el.shadowRoot!.querySelector('zn-button.editor__submit')!;
|
|
1557
1559
|
expect(button).to.exist;
|
|
1558
1560
|
expect(button.textContent?.trim()).to.equal('Save theme');
|
|
1559
|
-
expect(el.shadowRoot!.querySelector('[part="toolbar"] zn-button')).to.equal(button);
|
|
1560
|
-
expect(el.shadowRoot!.querySelector('[part="footer"] zn-button')).to.not.exist;
|
|
1561
|
+
expect(el.shadowRoot!.querySelector('[part="toolbar"] zn-button.editor__submit')).to.equal(button);
|
|
1562
|
+
expect(el.shadowRoot!.querySelector('[part="footer"] zn-button.editor__submit')).to.not.exist;
|
|
1561
1563
|
expect(el.shadowRoot!.querySelector('[part="footer"] slot[name="footer"]')).to.exist;
|
|
1562
1564
|
});
|
|
1563
1565
|
|
|
@@ -1567,7 +1569,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
1567
1569
|
<zn-input name="radius" label="Radius" value="8"></zn-input>
|
|
1568
1570
|
</zn-theme-editor>`);
|
|
1569
1571
|
|
|
1570
|
-
expect(el.shadowRoot!.querySelector('zn-button')).to.exist;
|
|
1572
|
+
expect(el.shadowRoot!.querySelector('zn-button.editor__submit')).to.exist;
|
|
1571
1573
|
expect(el.shadowRoot!.querySelector('[part="footer"]')).to.not.exist;
|
|
1572
1574
|
});
|
|
1573
1575
|
|
|
@@ -1681,7 +1683,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
1681
1683
|
await waitUntil(() => fetchCalls.length === 1);
|
|
1682
1684
|
await (el as HTMLElement & {updateComplete: Promise<unknown>}).updateComplete;
|
|
1683
1685
|
|
|
1684
|
-
const button = el.shadowRoot!.querySelector('zn-button')! as HTMLElement & {loading: boolean};
|
|
1686
|
+
const button = el.shadowRoot!.querySelector('zn-button.editor__submit')! as HTMLElement & {loading: boolean};
|
|
1685
1687
|
expect(button.loading).to.be.true;
|
|
1686
1688
|
|
|
1687
1689
|
clickButton(el); // second click while in flight - must not stack
|
|
@@ -1729,7 +1731,7 @@ describe('<zn-theme-editor>', () => {
|
|
|
1729
1731
|
|
|
1730
1732
|
clickButton(el); // flushes '99' and bypasses the save debounce, but a save is already in flight
|
|
1731
1733
|
await (el as HTMLElement & {updateComplete: Promise<unknown>}).updateComplete;
|
|
1732
|
-
const button = el.shadowRoot!.querySelector('zn-button')! as HTMLElement & {loading: boolean};
|
|
1734
|
+
const button = el.shadowRoot!.querySelector('zn-button.editor__submit')! as HTMLElement & {loading: boolean};
|
|
1733
1735
|
expect(button.loading).to.be.true;
|
|
1734
1736
|
|
|
1735
1737
|
await new Promise(resolve => setTimeout(resolve, 20));
|
|
@@ -198,7 +198,6 @@ describe('<zn-translation-group>', () => {
|
|
|
198
198
|
</zn-translation-group>`);
|
|
199
199
|
// The input tokens live in the theme stylesheet, which the bundle under test does not carry.
|
|
200
200
|
group.style.setProperty('--zn-input-background-color', 'rgb(1, 2, 3)');
|
|
201
|
-
group.style.setProperty('--zn-shadow-x-small', '0 1px 2px rgb(7, 8, 9)');
|
|
202
201
|
group.style.setProperty('--zn-input-border-width', '1px');
|
|
203
202
|
group.style.setProperty('--zn-input-border-color', 'rgb(9, 9, 9)');
|
|
204
203
|
await group.updateComplete;
|
|
@@ -208,7 +207,6 @@ describe('<zn-translation-group>', () => {
|
|
|
208
207
|
const styles = getComputedStyle(select.shadowRoot!.querySelector<HTMLElement>('[part~="combobox"]')!);
|
|
209
208
|
|
|
210
209
|
expect(styles.backgroundColor, 'the fill').to.equal('rgb(1, 2, 3)');
|
|
211
|
-
expect(styles.boxShadow, 'the shadow').to.include('rgb(7, 8, 9)');
|
|
212
210
|
expect(styles.borderTopWidth, 'the border').to.equal('1px');
|
|
213
211
|
expect(styles.borderTopColor, 'the border').to.equal('rgb(9, 9, 9)');
|
|
214
212
|
});
|