@sbb-esta/lyne-elements 1.5.0 → 1.6.0
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/alert/alert/alert.d.ts +22 -16
- package/alert/alert/alert.d.ts.map +1 -1
- package/alert/alert-group/alert-group.d.ts +1 -1
- package/alert/alert-group/alert-group.d.ts.map +1 -1
- package/alert/alert-group.js +31 -26
- package/alert/alert.js +45 -37
- package/clock/clock.d.ts.map +1 -1
- package/clock.js +14 -14
- package/core/testing/wait-for-event.d.ts +2 -0
- package/core/testing/wait-for-event.d.ts.map +1 -0
- package/core/testing.d.ts +1 -0
- package/core/testing.d.ts.map +1 -1
- package/core/testing.js +49 -36
- package/custom-elements.json +211 -51
- package/development/alert/alert/alert.d.ts +22 -16
- package/development/alert/alert/alert.d.ts.map +1 -1
- package/development/alert/alert-group/alert-group.d.ts +1 -1
- package/development/alert/alert-group/alert-group.d.ts.map +1 -1
- package/development/alert/alert-group.js +16 -11
- package/development/alert/alert.js +65 -24
- package/development/clock/clock.d.ts.map +1 -1
- package/development/clock.js +3 -2
- package/development/core/testing/wait-for-event.d.ts +2 -0
- package/development/core/testing/wait-for-event.d.ts.map +1 -0
- package/development/core/testing.d.ts +1 -0
- package/development/core/testing.d.ts.map +1 -1
- package/development/core/testing.js +17 -1
- package/development/icon/icon.d.ts +9 -1
- package/development/icon/icon.d.ts.map +1 -1
- package/development/icon.js +16 -2
- package/development/menu/menu/menu.d.ts.map +1 -1
- package/development/menu/menu.js +2 -1
- package/development/navigation/navigation/navigation.d.ts.map +1 -1
- package/development/navigation/navigation.js +2 -1
- package/development/notification/notification.d.ts +4 -4
- package/development/notification.js +1 -1
- package/development/overlay/overlay-base-element.d.ts.map +1 -1
- package/development/overlay.js +35 -17
- package/development/toggle/toggle.js +1 -1
- package/icon/icon.d.ts +9 -1
- package/icon/icon.d.ts.map +1 -1
- package/icon.js +71 -62
- package/menu/menu/menu.d.ts.map +1 -1
- package/menu/menu.js +3 -3
- package/navigation/navigation/navigation.d.ts.map +1 -1
- package/navigation/navigation.js +4 -4
- package/notification/notification.d.ts +4 -4
- package/overlay/overlay-base-element.d.ts.map +1 -1
- package/overlay.js +33 -33
- package/package.json +1 -1
- package/toggle/toggle.js +1 -1
package/alert/alert/alert.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { CSSResultGroup,
|
|
2
|
-
import { LinkTargetType } from '../../core/base-elements.js';
|
|
1
|
+
import { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import { LinkTargetType, SbbOpenCloseBaseElement } from '../../core/base-elements.js';
|
|
3
3
|
import { SbbTitleLevel } from '../../title.js';
|
|
4
4
|
|
|
5
|
-
declare const SbbAlertElement_base: import('../../core/mixins.js').AbstractConstructor<import('../../icon.js').SbbIconNameMixinType> & typeof
|
|
5
|
+
declare const SbbAlertElement_base: import('../../core/mixins.js').AbstractConstructor<import('../../icon.js').SbbIconNameMixinType> & typeof SbbOpenCloseBaseElement;
|
|
6
6
|
/**
|
|
7
7
|
* It displays messages which require user's attention.
|
|
8
8
|
*
|
|
9
9
|
* @slot - Use the unnamed slot to add content to the `sbb-alert`.
|
|
10
10
|
* @slot icon - Should be a `sbb-icon` which is displayed next to the title. Styling is optimized for icons of type HIM-CUS.
|
|
11
11
|
* @slot title - Title content.
|
|
12
|
-
* @event {CustomEvent<void>} willOpen - Emits when the
|
|
13
|
-
* @event {CustomEvent<void>} didOpen - Emits when the
|
|
12
|
+
* @event {CustomEvent<void>} willOpen - Emits when the opening animation starts.
|
|
13
|
+
* @event {CustomEvent<void>} didOpen - Emits when the opening animation ends.
|
|
14
|
+
* @event {CustomEvent<void>} willClose - Emits when the closing animation starts. Can be canceled.
|
|
15
|
+
* @event {CustomEvent<void>} didClose - Emits when the closing animation ends.
|
|
14
16
|
* @event {CustomEvent<void>} dismissalRequested - Emits when dismissal of an alert was requested.
|
|
15
17
|
*/
|
|
16
18
|
export declare class SbbAlertElement extends SbbAlertElement_base {
|
|
@@ -18,6 +20,8 @@ export declare class SbbAlertElement extends SbbAlertElement_base {
|
|
|
18
20
|
static readonly events: {
|
|
19
21
|
readonly willOpen: "willOpen";
|
|
20
22
|
readonly didOpen: "didOpen";
|
|
23
|
+
readonly willClose: "willClose";
|
|
24
|
+
readonly didClose: "didClose";
|
|
21
25
|
readonly dismissalRequested: "dismissalRequested";
|
|
22
26
|
};
|
|
23
27
|
/**
|
|
@@ -48,23 +52,25 @@ export declare class SbbAlertElement extends SbbAlertElement_base {
|
|
|
48
52
|
/** This will be forwarded as aria-label to the relevant nested element. */
|
|
49
53
|
accessibilityLabel: string | undefined;
|
|
50
54
|
/** The enabled animations. */
|
|
51
|
-
animation: 'open' | 'none';
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
private _willOpen;
|
|
57
|
-
/** Emits when the fade in animation ends and the button is displayed. */
|
|
58
|
-
private _didOpen;
|
|
59
|
-
/** Emits when dismissal of an alert was requested. */
|
|
55
|
+
animation: 'open' | 'close' | 'all' | 'none';
|
|
56
|
+
/**
|
|
57
|
+
* Emits when dismissal of an alert was requested.
|
|
58
|
+
* @deprecated
|
|
59
|
+
*/
|
|
60
60
|
private _dismissalRequested;
|
|
61
61
|
private _language;
|
|
62
62
|
protected firstUpdated(changedProperties: PropertyValues<this>): Promise<void>;
|
|
63
|
-
/** Requests dismissal of the alert.
|
|
63
|
+
/** Requests dismissal of the alert.
|
|
64
|
+
* @deprecated in favour of 'willClose' and 'didClose' events
|
|
65
|
+
*/
|
|
64
66
|
requestDismissal(): void;
|
|
65
67
|
/** Open the alert. */
|
|
66
|
-
|
|
68
|
+
open(): void;
|
|
69
|
+
/** Close the alert. */
|
|
70
|
+
close(): void;
|
|
67
71
|
private _onAnimationEnd;
|
|
72
|
+
private _handleOpening;
|
|
73
|
+
private _handleClosing;
|
|
68
74
|
protected render(): TemplateResult;
|
|
69
75
|
}
|
|
70
76
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../../src/elements/alert/alert/alert.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../../src/elements/alert/alert/alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAiB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGnG,OAAO,EAAE,KAAK,cAAc,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAK3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,gBAAgB,CAAC;;AAExB;;;;;;;;;;;GAWG;AACH,qBACa,eAAgB,SAAQ,oBAAyC;IAC5E,OAAuB,MAAM,EAAE,cAAc,CAAS;IACtD,gBAAgC,MAAM;;;;;;MAM3B;IAEX;;;OAGG;IACgD,QAAQ,UAAS;IAEpE,mDAAmD;IACf,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAO;IAEhE;;;;OAIG;IACmD,QAAQ,EAAE,MAAM,CAAU;IAEhF,wBAAwB;IACyB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEvE,sFAAsF;IACvC,UAAU,EAAE,aAAa,CAAO;IAE/E,2BAA2B;IACqB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErE,0CAA0C;IACvB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5C,uCAAuC;IACpB,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAAC;IAE/D,wEAAwE;IACrD,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3C,2EAA2E;IACpB,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9F,8BAA8B;IACM,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAS;IAEzF;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAGzB;IAEF,OAAO,CAAC,SAAS,CAAmC;cAE3B,YAAY,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7F;;OAEG;IACI,gBAAgB,IAAI,IAAI;IAI/B,sBAAsB;IACf,IAAI,IAAI,IAAI;IAKnB,uBAAuB;IAChB,KAAK,IAAI,IAAI;IAMpB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,cAAc;cAMH,MAAM,IAAI,cAAc;CAqD5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,WAAW,EAAE,eAAe,CAAC;KAC9B;CACF"}
|
|
@@ -34,8 +34,8 @@ export declare class SbbAlertGroupElement extends SbbAlertGroupElement_base {
|
|
|
34
34
|
/** Emits when `sbb-alert-group` becomes empty. */
|
|
35
35
|
private _empty;
|
|
36
36
|
private _abort;
|
|
37
|
-
private _removeAlert;
|
|
38
37
|
connectedCallback(): void;
|
|
38
|
+
private _alertClosed;
|
|
39
39
|
private _slotChanged;
|
|
40
40
|
protected render(): TemplateResult;
|
|
41
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-group.d.ts","sourceRoot":"","sources":["../../../../src/elements/alert/alert-group/alert-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAW,MAAM,KAAK,CAAC;AAO1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;;AAKpD;;;;;;;GAOG;AACH,qBACa,oBAAqB,SAAQ,yBAA6B;IACrE,OAAuB,MAAM,EAAE,cAAc,CAAS;IACtD,gBAAuB,MAAM;;;MAGlB;IAEX;;;;;OAKG;IAEa,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAY;IAE7D,gFAAgF;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAEnF,wGAAwG;IAEjG,uBAAuB,EAAE,aAAa,CAAO;IAEpD,kDAAkD;IACzC,OAAO,CAAC,UAAU,CAAC,CAAU;IAEtC,gDAAgD;IAChD,OAAO,CAAC,gBAAgB,CAGtB;IAEF,kDAAkD;IAClD,OAAO,CAAC,MAAM,CAAiF;IAE/F,OAAO,CAAC,MAAM,CAAyC;
|
|
1
|
+
{"version":3,"file":"alert-group.d.ts","sourceRoot":"","sources":["../../../../src/elements/alert/alert-group/alert-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAW,MAAM,KAAK,CAAC;AAO1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;;AAKpD;;;;;;;GAOG;AACH,qBACa,oBAAqB,SAAQ,yBAA6B;IACrE,OAAuB,MAAM,EAAE,cAAc,CAAS;IACtD,gBAAuB,MAAM;;;MAGlB;IAEX;;;;;OAKG;IAEa,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAY;IAE7D,gFAAgF;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAEnF,wGAAwG;IAEjG,uBAAuB,EAAE,aAAa,CAAO;IAEpD,kDAAkD;IACzC,OAAO,CAAC,UAAU,CAAC,CAAU;IAEtC,gDAAgD;IAChD,OAAO,CAAC,gBAAgB,CAGtB;IAEF,kDAAkD;IAClD,OAAO,CAAC,MAAM,CAAiF;IAE/F,OAAO,CAAC,MAAM,CAAyC;IAEvC,iBAAiB,IAAI,IAAI;IAezC,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,YAAY;cAaD,MAAM,IAAI,cAAc;CAe5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,iBAAiB,EAAE,oBAAoB,CAAC;KACzC;CACF"}
|
package/alert/alert-group.js
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as b, state as
|
|
3
|
-
import { html as c, unsafeStatic as
|
|
4
|
-
import { SbbConnectedAbortController as
|
|
5
|
-
import { EventEmitter as
|
|
6
|
-
import { SbbHydrationMixin as
|
|
7
|
-
import { SbbAlertElement as
|
|
8
|
-
const A =
|
|
9
|
-
var x = Object.defineProperty, E = Object.getOwnPropertyDescriptor, l = (e, t, i,
|
|
10
|
-
for (var
|
|
11
|
-
(n = e[a]) && (
|
|
12
|
-
return
|
|
1
|
+
import { css as u, LitElement as m, nothing as f } from "lit";
|
|
2
|
+
import { property as b, state as g, customElement as v } from "lit/decorators.js";
|
|
3
|
+
import { html as c, unsafeStatic as d } from "lit/static-html.js";
|
|
4
|
+
import { SbbConnectedAbortController as _ } from "../core/controllers.js";
|
|
5
|
+
import { EventEmitter as p } from "../core/eventing.js";
|
|
6
|
+
import { SbbHydrationMixin as y } from "../core/mixins.js";
|
|
7
|
+
import { SbbAlertElement as h } from "./alert.js";
|
|
8
|
+
const A = u`*,:before,:after{box-sizing:border-box}:host{--sbb-alert-group-gap: var(--sbb-spacing-fixed-3x);--sbb-alert-group-border-radius: var(--sbb-border-radius-4x);display:block}.sbb-alert-group{display:flex;flex-direction:column;gap:var(--sbb-alert-group-gap)}:host(:focus-visible:not([data-empty])){outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);border-radius:var(--sbb-alert-group-border-radius)}.sbb-alert-group__title{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}`;
|
|
9
|
+
var x = Object.defineProperty, E = Object.getOwnPropertyDescriptor, l = (e, t, i, o) => {
|
|
10
|
+
for (var r = o > 1 ? void 0 : o ? E(t, i) : t, a = e.length - 1, n; a >= 0; a--)
|
|
11
|
+
(n = e[a]) && (r = (o ? n(t, i, r) : n(r)) || r);
|
|
12
|
+
return o && r && x(t, i, r), r;
|
|
13
13
|
};
|
|
14
|
-
let s = class extends
|
|
14
|
+
let s = class extends y(m) {
|
|
15
15
|
constructor() {
|
|
16
|
-
super(...arguments), this.role = "status", this.accessibilityTitleLevel = "2", this._didDismissAlert = new
|
|
16
|
+
super(...arguments), this.role = "status", this.accessibilityTitleLevel = "2", this._didDismissAlert = new p(
|
|
17
17
|
this,
|
|
18
18
|
s.events.didDismissAlert
|
|
19
|
-
), this._empty = new
|
|
20
|
-
}
|
|
21
|
-
_removeAlert(e) {
|
|
22
|
-
var r;
|
|
23
|
-
const t = e.target, i = document.activeElement === t;
|
|
24
|
-
(r = t.parentNode) == null || r.removeChild(t), this._didDismissAlert.emit(t), i && (this.tabIndex = 0, this.focus(), this.addEventListener("blur", () => this.removeAttribute("tabindex"), {
|
|
25
|
-
once: !0
|
|
26
|
-
}));
|
|
19
|
+
), this._empty = new p(this, s.events.empty), this._abort = new _(this);
|
|
27
20
|
}
|
|
28
21
|
connectedCallback() {
|
|
29
22
|
super.connectedCallback();
|
|
30
23
|
const e = this._abort.signal;
|
|
31
|
-
this.addEventListener(
|
|
24
|
+
this.addEventListener(
|
|
25
|
+
h.events.dismissalRequested,
|
|
26
|
+
(t) => t.target.close(),
|
|
27
|
+
{
|
|
28
|
+
signal: e
|
|
29
|
+
}
|
|
30
|
+
), this.addEventListener(h.events.didClose, (t) => this._alertClosed(t), {
|
|
32
31
|
signal: e
|
|
33
32
|
});
|
|
34
33
|
}
|
|
34
|
+
_alertClosed(e) {
|
|
35
|
+
const t = e.target, i = document.activeElement === t;
|
|
36
|
+
this._didDismissAlert.emit(t), i && (this.tabIndex = 0, this.focus(), this.addEventListener("blur", () => this.removeAttribute("tabindex"), {
|
|
37
|
+
once: !0
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
35
40
|
_slotChanged(e) {
|
|
36
41
|
const t = this._hasAlerts;
|
|
37
42
|
this._hasAlerts = e.target.assignedElements().filter((i) => i instanceof Element && i.localName === "sbb-alert").length > 0, !this._hasAlerts && t && this._empty.emit(), this.toggleAttribute("data-empty", !this._hasAlerts);
|
|
@@ -40,9 +45,9 @@ let s = class extends _(m) {
|
|
|
40
45
|
const e = `h${this.accessibilityTitleLevel}`;
|
|
41
46
|
return c`
|
|
42
47
|
<div class="sbb-alert-group">
|
|
43
|
-
${this._hasAlerts ? c`<${
|
|
48
|
+
${this._hasAlerts ? c`<${d(e)} class="sbb-alert-group__title">
|
|
44
49
|
<slot name="accessibility-title">${this.accessibilityTitle}</slot>
|
|
45
|
-
</${
|
|
50
|
+
</${d(e)}>` : f}
|
|
46
51
|
<slot @slotchange=${(t) => this._slotChanged(t)}></slot>
|
|
47
52
|
</div>
|
|
48
53
|
`;
|
|
@@ -63,7 +68,7 @@ l([
|
|
|
63
68
|
b({ attribute: "accessibility-title-level" })
|
|
64
69
|
], s.prototype, "accessibilityTitleLevel", 2);
|
|
65
70
|
l([
|
|
66
|
-
|
|
71
|
+
g()
|
|
67
72
|
], s.prototype, "_hasAlerts", 2);
|
|
68
73
|
s = l([
|
|
69
74
|
v("sbb-alert-group")
|
package/alert/alert.js
CHANGED
|
@@ -1,49 +1,55 @@
|
|
|
1
|
-
import { css as m,
|
|
2
|
-
import { property as i, customElement as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { css as m, html as p, nothing as n } from "lit";
|
|
2
|
+
import { property as i, customElement as c } from "lit/decorators.js";
|
|
3
|
+
import { SbbOpenCloseBaseElement as g } from "../core/base-elements.js";
|
|
4
|
+
import { SbbLanguageController as h } from "../core/controllers.js";
|
|
5
|
+
import { EventEmitter as u } from "../core/eventing.js";
|
|
6
|
+
import { i18nFindOutMore as v, i18nCloseAlert as f } from "../core/i18n.js";
|
|
7
|
+
import { SbbIconNameMixin as _ } from "../icon.js";
|
|
7
8
|
import "../button/transparent-button.js";
|
|
8
9
|
import "../divider.js";
|
|
9
10
|
import "../link.js";
|
|
10
11
|
import "../title.js";
|
|
11
|
-
const y = m`*,:before,:after{box-sizing:border-box}:host{--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark);--sbb-alert-background-color: var(--sbb-color-midnight);--sbb-alert-border-radius: var(--sbb-border-radius-4x);--sbb-alert-color: var(--sbb-color-aluminium);--sbb-alert-padding: var(--sbb-spacing-responsive-xxs) var(--sbb-spacing-responsive-xs);--sbb-alert-icon-size: 1.25rem;--sbb-alert-close-icon-size: var(--sbb-size-icon-ui-small);--sbb-alert-close-icon-margin: var(--sbb-spacing-responsive-xxs);--sbb-alert-gap: var(--sbb-spacing-fixed-2x) var(--sbb-spacing-responsive-xs);--sbb-alert-animation-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-6x) );display:block}@media (min-width: 52.5rem){:host{--sbb-alert-icon-size: 1.75rem}}@media (forced-colors: active){:host{outline:var(--sbb-border-width-1x) solid CanvasText;border-radius:var(--sbb-alert-border-radius)}}:host([animation=
|
|
12
|
-
var w = Object.defineProperty, x = Object.getOwnPropertyDescriptor, e = (s,
|
|
13
|
-
for (var a = o > 1 ? void 0 : o ? x(
|
|
14
|
-
(
|
|
15
|
-
return o && a && w(
|
|
12
|
+
const y = m`*,:before,:after{box-sizing:border-box}:host{--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark);--sbb-alert-background-color: var(--sbb-color-midnight);--sbb-alert-border-radius: var(--sbb-border-radius-4x);--sbb-alert-color: var(--sbb-color-aluminium);--sbb-alert-padding: var(--sbb-spacing-responsive-xxs) var(--sbb-spacing-responsive-xs);--sbb-alert-icon-size: 1.25rem;--sbb-alert-close-icon-size: var(--sbb-size-icon-ui-small);--sbb-alert-close-icon-margin: var(--sbb-spacing-responsive-xxs);--sbb-alert-gap: var(--sbb-spacing-fixed-2x) var(--sbb-spacing-responsive-xs);--sbb-alert-animation-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-6x) );--sbb-alert-timing-function: ease-in;display:block}@media (min-width: 52.5rem){:host{--sbb-alert-icon-size: 1.75rem}}@media (forced-colors: active){:host{outline:var(--sbb-border-width-1x) solid CanvasText;border-radius:var(--sbb-alert-border-radius)}}:host([data-state=opening]:not([animation=open],[animation=all])){--sbb-disable-animation-time: .1ms;--sbb-disable-animation-zero-time: 0s}:host([data-state=closing]:not([animation=close],[animation=all])){--sbb-disable-animation-time: .1ms;--sbb-disable-animation-zero-time: 0s}:host([size=s]){--sbb-alert-gap: var(--sbb-spacing-fixed-1x) var(--sbb-spacing-responsive-xxs);--sbb-alert-close-icon-margin: var(--sbb-spacing-responsive-xxxs)}:host([size=l]){--sbb-alert-icon-size: var(--sbb-size-icon-ui-small)}@media (min-width: 52.5rem){:host([size=l]){--sbb-alert-icon-size: 2.125rem}}.sbb-alert__transition-wrapper{display:grid;grid-template-rows:0fr;opacity:0}:host(:is([data-state=opened],[data-state=closing])) .sbb-alert__transition-wrapper{grid-template-rows:1fr;opacity:1}:host([data-state=opening]) .sbb-alert__transition-wrapper{animation-name:open,open-opacity;animation-fill-mode:forwards;animation-duration:var(--sbb-alert-animation-duration);animation-timing-function:var(--sbb-alert-timing-function);animation-delay:0s,var(--sbb-alert-animation-duration)}:host([data-state=closing]) .sbb-alert__transition-wrapper{animation-name:close-opacity,close;animation-fill-mode:forwards;animation-duration:var(--sbb-alert-animation-duration);animation-timing-function:var(--sbb-alert-timing-function);animation-delay:0s,var(--sbb-disable-animation-zero-time, var(--sbb-animation-duration-2x))}.sbb-alert__transition-sub-wrapper{overflow:hidden}.sbb-alert{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);display:grid;grid-template-columns:1fr auto;align-items:center;gap:var(--sbb-alert-gap);min-width:fit-content;padding:var(--sbb-alert-padding);overflow:hidden;color:var(--sbb-alert-color);background-color:var(--sbb-alert-background-color);border-radius:var(--sbb-alert-border-radius)}@media (min-width: 37.5rem){.sbb-alert{grid-template-columns:auto 1fr auto;align-items:flex-start}}.sbb-alert__icon{display:flex;align-items:start;padding-block:var(--sbb-spacing-fixed-1x);min-width:var(--sbb-alert-icon-size);--sbb-icon-svg-width: var(--sbb-alert-icon-size);--sbb-icon-svg-height: var(--sbb-alert-icon-size)}.sbb-alert__content{order:3;grid-column:1/3}@media (min-width: 37.5rem){.sbb-alert__content{order:initial;grid-column-start:initial;grid-column-end:initial}}.sbb-alert__content-slot{display:inline;margin:0;padding:0}.sbb-alert__title{margin:0}.sbb-alert__close-button-wrapper{display:flex;justify-content:flex-end;align-items:center;height:100%}@media (min-width: 37.5rem){.sbb-alert__close-button{margin-inline-start:var(--sbb-alert-close-icon-margin)}}.sbb-alert__close-button-divider{display:none}@media (min-width: 37.5rem){.sbb-alert__close-button-divider{display:block;height:calc(100% - var(--sbb-spacing-fixed-1x) * 2)}}@keyframes open{0%{grid-template-rows:0fr}to{grid-template-rows:1fr}}@keyframes open-opacity{0%{opacity:0}to{opacity:1}}@keyframes close{0%{grid-template-rows:1fr}to{grid-template-rows:0fr}}@keyframes close-opacity{0%{opacity:1}to{opacity:0}}`;
|
|
13
|
+
var w = Object.defineProperty, x = Object.getOwnPropertyDescriptor, e = (s, r, l, o) => {
|
|
14
|
+
for (var a = o > 1 ? void 0 : o ? x(r, l) : r, b = s.length - 1, d; b >= 0; b--)
|
|
15
|
+
(d = s[b]) && (a = (o ? d(r, l, a) : d(a)) || a);
|
|
16
|
+
return o && a && w(r, l, a), a;
|
|
16
17
|
};
|
|
17
|
-
let t = class extends
|
|
18
|
+
let t = class extends _(g) {
|
|
18
19
|
constructor() {
|
|
19
|
-
super(...arguments), this.readonly = !1, this.size = "m", this.iconName = "info", this.titleLevel = "3", this.animation = "
|
|
20
|
+
super(...arguments), this.readonly = !1, this.size = "m", this.iconName = "info", this.titleLevel = "3", this.animation = "all", this._dismissalRequested = new u(
|
|
20
21
|
this,
|
|
21
22
|
t.events.dismissalRequested
|
|
22
|
-
), this._language = new
|
|
23
|
-
}
|
|
24
|
-
/** The state of the alert. */
|
|
25
|
-
get _state() {
|
|
26
|
-
return this.getAttribute("data-state") ?? "closed";
|
|
27
|
-
}
|
|
28
|
-
set _state(s) {
|
|
29
|
-
this.setAttribute("data-state", s);
|
|
23
|
+
), this._language = new h(this);
|
|
30
24
|
}
|
|
31
25
|
async firstUpdated(s) {
|
|
32
|
-
super.firstUpdated(s), this.
|
|
26
|
+
super.firstUpdated(s), this.open();
|
|
33
27
|
}
|
|
34
|
-
/** Requests dismissal of the alert.
|
|
28
|
+
/** Requests dismissal of the alert.
|
|
29
|
+
* @deprecated in favour of 'willClose' and 'didClose' events
|
|
30
|
+
*/
|
|
35
31
|
requestDismissal() {
|
|
36
32
|
this._dismissalRequested.emit();
|
|
37
33
|
}
|
|
38
34
|
/** Open the alert. */
|
|
39
|
-
|
|
40
|
-
this.
|
|
35
|
+
open() {
|
|
36
|
+
this.willOpen.emit(), this.state = "opening";
|
|
37
|
+
}
|
|
38
|
+
/** Close the alert. */
|
|
39
|
+
close() {
|
|
40
|
+
this.willClose.emit() && (this.state = "closing");
|
|
41
41
|
}
|
|
42
42
|
_onAnimationEnd(s) {
|
|
43
|
-
this.
|
|
43
|
+
this.state === "opening" && s.animationName === "open-opacity" ? this._handleOpening() : this.state === "closing" && s.animationName === "close" && this._handleClosing();
|
|
44
|
+
}
|
|
45
|
+
_handleOpening() {
|
|
46
|
+
this.state = "opened", this.didOpen.emit();
|
|
47
|
+
}
|
|
48
|
+
_handleClosing() {
|
|
49
|
+
this.state = "closed", this.didClose.emit(), setTimeout(() => this.remove());
|
|
44
50
|
}
|
|
45
51
|
render() {
|
|
46
|
-
return
|
|
52
|
+
return p`
|
|
47
53
|
<div class="sbb-alert__transition-wrapper" @animationend=${this._onAnimationEnd}>
|
|
48
54
|
<!-- sub wrapper needed to properly support fade in animation -->
|
|
49
55
|
<div class="sbb-alert__transition-sub-wrapper">
|
|
@@ -61,17 +67,17 @@ let t = class extends f(v) {
|
|
|
61
67
|
<p class="sbb-alert__content-slot">
|
|
62
68
|
<slot></slot>
|
|
63
69
|
</p>
|
|
64
|
-
${this.href ?
|
|
65
|
-
accessibility-label=${this.accessibilityLabel ??
|
|
66
|
-
href=${this.href ??
|
|
67
|
-
target=${this.target ??
|
|
68
|
-
rel=${this.rel ??
|
|
70
|
+
${this.href ? p` <sbb-link
|
|
71
|
+
accessibility-label=${this.accessibilityLabel ?? n}
|
|
72
|
+
href=${this.href ?? n}
|
|
73
|
+
target=${this.target ?? n}
|
|
74
|
+
rel=${this.rel ?? n}
|
|
69
75
|
negative
|
|
70
76
|
>
|
|
71
|
-
${this.linkContent ? this.linkContent :
|
|
72
|
-
</sbb-link>` :
|
|
77
|
+
${this.linkContent ? this.linkContent : v[this._language.current]}
|
|
78
|
+
</sbb-link>` : n}
|
|
73
79
|
</span>
|
|
74
|
-
${this.readonly ?
|
|
80
|
+
${this.readonly ? n : p`<span class="sbb-alert__close-button-wrapper">
|
|
75
81
|
<sbb-divider
|
|
76
82
|
orientation="vertical"
|
|
77
83
|
negative
|
|
@@ -82,7 +88,7 @@ let t = class extends f(v) {
|
|
|
82
88
|
size=${this.size === "l" ? "m" : this.size}
|
|
83
89
|
icon-name="cross-small"
|
|
84
90
|
@click=${() => this.requestDismissal()}
|
|
85
|
-
aria-label=${
|
|
91
|
+
aria-label=${f[this._language.current]}
|
|
86
92
|
class="sbb-alert__close-button"
|
|
87
93
|
></sbb-transparent-button>
|
|
88
94
|
</span>`}
|
|
@@ -96,6 +102,8 @@ t.styles = y;
|
|
|
96
102
|
t.events = {
|
|
97
103
|
willOpen: "willOpen",
|
|
98
104
|
didOpen: "didOpen",
|
|
105
|
+
willClose: "willClose",
|
|
106
|
+
didClose: "didClose",
|
|
99
107
|
dismissalRequested: "dismissalRequested"
|
|
100
108
|
};
|
|
101
109
|
e([
|
|
@@ -132,7 +140,7 @@ e([
|
|
|
132
140
|
i({ reflect: !0 })
|
|
133
141
|
], t.prototype, "animation", 2);
|
|
134
142
|
t = e([
|
|
135
|
-
|
|
143
|
+
c("sbb-alert")
|
|
136
144
|
], t);
|
|
137
145
|
export {
|
|
138
146
|
t as SbbAlertElement
|
package/clock/clock.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../src/elements/clock/clock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAkB,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA2CrD;;GAEG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD;;;OAGG;IACgB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAQ;IAE9C,kCAAkC;IAClC,OAAO,CAAC,eAAe,CAAe;IAEtC,oCAAoC;IACpC,OAAO,CAAC,iBAAiB,CAAe;IAExC,oCAAoC;IACpC,OAAO,CAAC,iBAAiB,CAAe;IAExC,wCAAwC;IACxC,OAAO,CAAC,MAAM,CAAU;IAExB,0CAA0C;IAC1C,OAAO,CAAC,QAAQ,CAAU;IAE1B,0CAA0C;IAC1C,OAAO,CAAC,QAAQ,CAAU;IAE1B,wCAAwC;IACxC,OAAO,CAAC,gBAAgB,CAAqC;IAE7D,0CAA0C;IAC1C,OAAO,CAAC,kBAAkB,CAAuC;IAEjE,0CAA0C;IAC1C,OAAO,CAAC,aAAa,CAAC,CAAiC;cAE9B,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;cAQlE,YAAY,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7E,oBAAoB,IAAI,IAAI;IAK5C,OAAO,CAAC,2BAA2B,CAMjC;YAEY,sBAAsB;IAUpC,6FAA6F;YAC/E,WAAW;
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../src/elements/clock/clock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAkB,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA2CrD;;GAEG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD;;;OAGG;IACgB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAQ;IAE9C,kCAAkC;IAClC,OAAO,CAAC,eAAe,CAAe;IAEtC,oCAAoC;IACpC,OAAO,CAAC,iBAAiB,CAAe;IAExC,oCAAoC;IACpC,OAAO,CAAC,iBAAiB,CAAe;IAExC,wCAAwC;IACxC,OAAO,CAAC,MAAM,CAAU;IAExB,0CAA0C;IAC1C,OAAO,CAAC,QAAQ,CAAU;IAE1B,0CAA0C;IAC1C,OAAO,CAAC,QAAQ,CAAU;IAE1B,wCAAwC;IACxC,OAAO,CAAC,gBAAgB,CAAqC;IAE7D,0CAA0C;IAC1C,OAAO,CAAC,kBAAkB,CAAuC;IAEjE,0CAA0C;IAC1C,OAAO,CAAC,aAAa,CAAC,CAAiC;cAE9B,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;cAQlE,YAAY,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7E,oBAAoB,IAAI,IAAI;IAK5C,OAAO,CAAC,2BAA2B,CAMjC;YAEY,sBAAsB;IAUpC,6FAA6F;YAC/E,WAAW;IAsBzB,sDAAsD;YACxC,UAAU;IAcxB,uEAAuE;IACvE,OAAO,CAAC,yBAAyB;IA4CjC,yGAAyG;IACzG,OAAO,CAAC,kBAAkB;IAW1B,sDAAsD;IACtD,OAAO,CAAC,eAAe;IAOvB,6CAA6C;IAC7C,OAAO,CAAC,cAAc;IAYtB,+CAA+C;IAC/C,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,sBAAsB;IAK9B;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,2BAA2B;IAMnC,OAAO,CAAC,6BAA6B;cAOlB,MAAM,IAAI,cAAc;CA4B5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,WAAW,EAAE,eAAe,CAAC;KAC9B;CACF"}
|
package/clock.js
CHANGED
|
@@ -6,10 +6,10 @@ const z = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0
|
|
|
6
6
|
`, w = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path d="M55.1,64.5h-5.2l0.8-58h3.6L55.1,64.5z"/></svg>
|
|
7
7
|
`, L = `<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path d="M57.8,21.3c0-2.9-2.4-5.2-5.2-5.2s-5.3,2.3-5.3,5.2c0,2.7,2,4.8,4.5,5.2V69h1.5V26.5C55.8,26.2,57.8,24,57.8,21.3z"/></svg>
|
|
8
8
|
`, C = p`*,:before,:after{box-sizing:border-box}:host{--sbb-clock-hours-animation-start-angle: 0deg;--sbb-clock-seconds-animation-start-angle: 0deg;--sbb-clock-hours-animation-duration: 0s;--sbb-clock-seconds-animation-duration: 0s;--sbb-clock-animation-play-state: paused;--sbb-clock-seconds-hand-color: var(--sbb-color-red);display:block}.sbb-clock{position:relative;width:100%;height:100%;aspect-ratio:1/1;overflow:hidden;contain:content}.sbb-clock__face,.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__hand-seconds{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:center center;transform:rotate(0);transform-style:preserve-3d;backface-visibility:hidden}.sbb-clock__hand-minutes{transition:transform .2s cubic-bezier(.4,2.08,.55,.44)}@supports not (aspect-ratio: 1/1){.sbb-clock__hand-minutes{transform-origin:50% 49.625%}}.sbb-clock__hand-hours{animation-name:rotate;animation-duration:43200s;animation-iteration-count:infinite;animation-timing-function:linear;animation-play-state:var(--sbb-clock-animation-play-state)}.sbb-clock__hand-hours--initial-hour{animation-name:hand-hours-animation-initial-hour;animation-duration:var(--sbb-clock-hours-animation-duration);animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:1}.sbb-clock__hand-minutes--no-transition{transition:none}.sbb-clock__hand-seconds{animation-name:hand-seconds-animation;animation-duration:60s;animation-timing-function:linear;animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:infinite;fill:var(--sbb-clock-seconds-hand-color)}.sbb-clock__hand-seconds--initial-minute{animation-name:hand-seconds-animation-initial-minute;animation-duration:var(--sbb-clock-seconds-animation-duration);animation-play-state:var(--sbb-clock-animation-play-state);animation-iteration-count:1}:host(:not([data-initialized])) :is(.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__hand-seconds){display:none}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes hand-hours-animation-initial-hour{0%{transform:rotate(var(--sbb-clock-hours-animation-start-angle))}to{transform:rotate(360deg)}}@keyframes hand-seconds-animation{0%{transform:rotate(0)}97.5%,to{transform:rotate(360deg)}}@keyframes hand-seconds-animation-initial-minute{0%{transform:rotate(var(--sbb-clock-seconds-animation-start-angle))}97.5%,to{transform:rotate(360deg)}}`;
|
|
9
|
-
var E = Object.defineProperty, A = Object.getOwnPropertyDescriptor, k = (t, n,
|
|
10
|
-
for (var
|
|
11
|
-
(a = t[e]) && (
|
|
12
|
-
return
|
|
9
|
+
var E = Object.defineProperty, A = Object.getOwnPropertyDescriptor, k = (t, n, o, s) => {
|
|
10
|
+
for (var i = s > 1 ? void 0 : s ? A(n, o) : n, e = t.length - 1, a; e >= 0; e--)
|
|
11
|
+
(a = t[e]) && (i = (s ? a(n, o, i) : a(i)) || i);
|
|
12
|
+
return s && i && E(n, o, i), i;
|
|
13
13
|
};
|
|
14
14
|
const O = 12, P = 60, u = 60, T = 50, b = 360, v = 30, N = 6, F = 360 / 58.5, I = 60, x = 3600, M = {
|
|
15
15
|
once: !0,
|
|
@@ -45,35 +45,35 @@ let c = class extends H {
|
|
|
45
45
|
this._moveMinutesHandFn,
|
|
46
46
|
M
|
|
47
47
|
), await new Promise(
|
|
48
|
-
() => setTimeout(() => {
|
|
48
|
+
(o) => setTimeout(() => {
|
|
49
49
|
var s;
|
|
50
|
-
this._setHandsStartingPosition(), (s = this.style) == null || s.setProperty("--sbb-clock-animation-play-state", "running");
|
|
50
|
+
this._setHandsStartingPosition(), (s = this.style) == null || s.setProperty("--sbb-clock-animation-play-state", "running"), o();
|
|
51
51
|
}, T)
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
/** Stops the clock by removing all the animations. */
|
|
55
55
|
async _stopClock() {
|
|
56
|
-
var t, n,
|
|
57
|
-
clearInterval(this._handMovement), this._removeSecondsAnimationStyles(), this._removeHoursAnimationStyles(), (t = this._clockHandHours) == null || t.removeEventListener("animationend", this._moveHoursHandFn), (n = this._clockHandSeconds) == null || n.removeEventListener("animationend", this._moveMinutesHandFn), (
|
|
56
|
+
var t, n, o, s;
|
|
57
|
+
clearInterval(this._handMovement), this._removeSecondsAnimationStyles(), this._removeHoursAnimationStyles(), (t = this._clockHandHours) == null || t.removeEventListener("animationend", this._moveHoursHandFn), (n = this._clockHandSeconds) == null || n.removeEventListener("animationend", this._moveMinutesHandFn), (o = this._clockHandMinutes) == null || o.classList.add("sbb-clock__hand-minutes--no-transition"), (s = this.style) == null || s.setProperty("--sbb-clock-animation-play-state", "paused");
|
|
58
58
|
}
|
|
59
59
|
/** Set the starting position for the three hands on the clock face. */
|
|
60
60
|
_setHandsStartingPosition() {
|
|
61
61
|
var e, a, l, d, h, m;
|
|
62
62
|
this._assignCurrentTime();
|
|
63
|
-
const t = u - this._seconds, n = P - this._minutes,
|
|
64
|
-
let
|
|
65
|
-
t > 0 && (
|
|
63
|
+
const t = u - this._seconds, n = P - this._minutes, o = O - this._hours;
|
|
64
|
+
let s = 0, i = 0;
|
|
65
|
+
t > 0 && (s += t, i = 1), n > 0 && (s += (n - i) * I, i = 1), o > 0 && (s += (o - i) * x), (e = this.style) == null || e.setProperty(
|
|
66
66
|
"--sbb-clock-hours-animation-start-angle",
|
|
67
67
|
`${Math.ceil(this._hours * v + this._minutes / 2)}deg`
|
|
68
|
-
), (a = this.style) == null || a.setProperty("--sbb-clock-hours-animation-duration", `${
|
|
68
|
+
), (a = this.style) == null || a.setProperty("--sbb-clock-hours-animation-duration", `${s}s`), (l = this.style) == null || l.setProperty(
|
|
69
69
|
"--sbb-clock-seconds-animation-start-angle",
|
|
70
70
|
`${Math.ceil(this._seconds * F)}deg`
|
|
71
71
|
), (d = this.style) == null || d.setProperty("--sbb-clock-seconds-animation-duration", `${t}s`), this._setMinutesHand(), (h = this._clockHandSeconds) == null || h.classList.add("sbb-clock__hand-seconds--initial-minute"), (m = this._clockHandHours) == null || m.classList.add("sbb-clock__hand-hours--initial-hour"), this.toggleAttribute("data-initialized", !0);
|
|
72
72
|
}
|
|
73
73
|
/** Given the current date, calculates the hh/mm/ss values and the hh/mm/ss left to the next midnight. */
|
|
74
74
|
_assignCurrentTime() {
|
|
75
|
-
const t = this.now ? null : /* @__PURE__ */ new Date(), [n,
|
|
76
|
-
this._hours = n % 12, this._minutes =
|
|
75
|
+
const t = this.now ? null : /* @__PURE__ */ new Date(), [n, o, s] = t ? [t.getHours(), t.getMinutes(), t.getSeconds()] : this.now.split(":").map((i) => +i);
|
|
76
|
+
this._hours = n % 12, this._minutes = o, this._seconds = s;
|
|
77
77
|
}
|
|
78
78
|
/** Set the starting position for the minutes hand. */
|
|
79
79
|
_setMinutesHand() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for-event.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/testing/wait-for-event.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAC1B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,SAAO,GACb,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
package/core/testing.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './testing/event-spy.js';
|
|
|
2
2
|
export * from './testing/mocha-extensions.js';
|
|
3
3
|
export * from './testing/scroll.js';
|
|
4
4
|
export * from './testing/wait-for-condition.js';
|
|
5
|
+
export * from './testing/wait-for-event.js';
|
|
5
6
|
export * from './testing/wait-for-image-ready.js';
|
|
6
7
|
export * from './testing/wait-for-render.js';
|
|
7
8
|
//# sourceMappingURL=testing.d.ts.map
|
package/core/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/elements/core/testing.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/elements/core/testing.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC"}
|
package/core/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class u {
|
|
2
|
-
constructor(
|
|
3
|
-
this._event =
|
|
2
|
+
constructor(e, n = null) {
|
|
3
|
+
this._event = e, this._target = n, this._count = 0, this._events = [], this._target || (this._target = document), this._listenForEvent();
|
|
4
4
|
}
|
|
5
5
|
get count() {
|
|
6
6
|
return this._count;
|
|
@@ -15,54 +15,66 @@ class u {
|
|
|
15
15
|
return this.events.length ? this.events[this.events.length - 1] : null;
|
|
16
16
|
}
|
|
17
17
|
_listenForEvent() {
|
|
18
|
-
var
|
|
19
|
-
(
|
|
18
|
+
var e;
|
|
19
|
+
(e = this._target) == null || e.addEventListener(this._event, (n) => {
|
|
20
20
|
this._events.push(n), this._count++;
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
const m = (
|
|
25
|
-
if (
|
|
26
|
-
return Mocha.describe(
|
|
27
|
-
}, h = (
|
|
28
|
-
if (
|
|
29
|
-
return Mocha.test(
|
|
24
|
+
const m = (t, e, n) => {
|
|
25
|
+
if (t)
|
|
26
|
+
return Mocha.describe(e, n);
|
|
27
|
+
}, h = (t, e, n) => {
|
|
28
|
+
if (t)
|
|
29
|
+
return Mocha.test(e, n);
|
|
30
30
|
};
|
|
31
|
-
function d(
|
|
32
|
-
window.scrollTo(
|
|
31
|
+
function d(t) {
|
|
32
|
+
window.scrollTo(t), document.dispatchEvent(new Event("scroll"));
|
|
33
33
|
}
|
|
34
|
-
async function v(
|
|
34
|
+
async function v(t, e = 30, n = 2 * 1e3) {
|
|
35
35
|
const r = /* @__PURE__ */ new Date();
|
|
36
|
-
let
|
|
37
|
-
function
|
|
38
|
-
return
|
|
36
|
+
let o = 0;
|
|
37
|
+
function i() {
|
|
38
|
+
return o++, t();
|
|
39
39
|
}
|
|
40
|
-
for (; !await
|
|
41
|
-
await new Promise((s) => setTimeout(s,
|
|
40
|
+
for (; !await i() && r.getTime() + n >= (/* @__PURE__ */ new Date()).getTime(); )
|
|
41
|
+
await new Promise((s) => setTimeout(s, e));
|
|
42
42
|
return r.getTime() + n < (/* @__PURE__ */ new Date()).getTime() ? Promise.reject(
|
|
43
|
-
`waitForCondition timeout: ${
|
|
43
|
+
`waitForCondition timeout: ${t.toString()}, attempts: ${o}, start: ${r.getTime()}, end: ${(/* @__PURE__ */ new Date()).getTime()}`
|
|
44
44
|
) : Promise.resolve(!0);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const i =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
function g(t, e, n = 1e3) {
|
|
47
|
+
return new Promise((r, o) => {
|
|
48
|
+
const i = AbortSignal.timeout(n), s = () => o(`Timeout of ${n} reached`);
|
|
49
|
+
i.addEventListener("abort", s), t.addEventListener(
|
|
50
|
+
e,
|
|
51
|
+
() => {
|
|
52
|
+
i.removeEventListener("abort", s), r();
|
|
53
|
+
},
|
|
54
|
+
{ passive: !0, signal: i }
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async function w(t, e = 2 * 1e3) {
|
|
59
|
+
t.complete || await new Promise((n, r) => {
|
|
60
|
+
const o = setTimeout(() => r("image loading timeout"), e);
|
|
61
|
+
t.addEventListener("load", () => {
|
|
62
|
+
clearTimeout(o), n();
|
|
63
|
+
}), t.addEventListener("error", () => {
|
|
64
|
+
clearTimeout(o), r("image error");
|
|
53
65
|
});
|
|
54
66
|
});
|
|
55
67
|
}
|
|
56
|
-
const a = (
|
|
57
|
-
var r,
|
|
58
|
-
const
|
|
59
|
-
(
|
|
60
|
-
const n = [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
l(
|
|
68
|
+
const a = (t) => !!t.updateComplete, c = Promise.resolve(), l = async (t) => {
|
|
69
|
+
var r, o;
|
|
70
|
+
const e = await t;
|
|
71
|
+
(o = (r = e.parentElement ?? e).querySelectorAll) == null || o.call(r, "[defer-hydration]").forEach((i) => i.removeAttribute("defer-hydration"));
|
|
72
|
+
const n = [e, ...e.querySelectorAll("*")].filter(a).map((i) => [
|
|
73
|
+
i.updateComplete,
|
|
74
|
+
i.hydrationComplete ?? c,
|
|
75
|
+
l(i.renderRoot)
|
|
64
76
|
]).flat(1 / 0);
|
|
65
|
-
return await Promise.all(n),
|
|
77
|
+
return await Promise.all(n), e;
|
|
66
78
|
};
|
|
67
79
|
export {
|
|
68
80
|
u as EventSpy,
|
|
@@ -71,6 +83,7 @@ export {
|
|
|
71
83
|
d as mockScrollTo,
|
|
72
84
|
h as testIf,
|
|
73
85
|
v as waitForCondition,
|
|
74
|
-
g as
|
|
86
|
+
g as waitForEvent,
|
|
87
|
+
w as waitForImageReady,
|
|
75
88
|
l as waitForLitRender
|
|
76
89
|
};
|