@sbb-esta/lyne-elements 1.14.1 → 1.15.1
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/autocomplete/autocomplete.d.ts +1 -1
- package/autocomplete/autocomplete.d.ts.map +1 -1
- package/autocomplete-grid/autocomplete-grid/autocomplete-grid.d.ts +1 -1
- package/autocomplete-grid/autocomplete-grid/autocomplete-grid.d.ts.map +1 -1
- package/autocomplete-grid/autocomplete-grid.js +6 -6
- package/autocomplete.js +20 -19
- package/calendar/calendar.d.ts +1 -1
- package/calendar/calendar.d.ts.map +1 -1
- package/calendar.js +25 -27
- package/checkbox/checkbox-panel/checkbox-panel.d.ts +1 -1
- package/checkbox/checkbox-panel/checkbox-panel.d.ts.map +1 -1
- package/checkbox/checkbox-panel.js +5 -5
- package/checkbox/common.js +1 -1
- package/clock/clock.d.ts +1 -1
- package/clock/clock.d.ts.map +1 -1
- package/clock.js +2 -2
- package/container/sticky-bar/sticky-bar.d.ts +29 -2
- package/container/sticky-bar/sticky-bar.d.ts.map +1 -1
- package/container/sticky-bar.js +69 -31
- package/core/base-elements/link-base-element.d.ts +1 -0
- package/core/base-elements/link-base-element.d.ts.map +1 -1
- package/core/base-elements.js +46 -43
- package/core/config/config.d.ts +3 -0
- package/core/config/config.d.ts.map +1 -1
- package/core/controllers/media-matchers-controller.d.ts +32 -0
- package/core/controllers/media-matchers-controller.d.ts.map +1 -0
- package/core/controllers.d.ts +1 -0
- package/core/controllers.d.ts.map +1 -1
- package/core/controllers.js +75 -33
- package/core/dom/breakpoint.d.ts +2 -1
- package/core/dom/breakpoint.d.ts.map +1 -1
- package/core/dom.js +7 -7
- package/core/mixins/form-associated-checkbox-mixin.d.ts.map +1 -1
- package/core/mixins.js +8 -1
- package/core/styles/core/mediaqueries.scss +1 -2
- package/core/styles/mixins/buttons.scss +5 -5
- package/core/testing/event-spy.d.ts +6 -4
- package/core/testing/event-spy.d.ts.map +1 -1
- package/core/testing.js +82 -55
- package/custom-elements.json +953 -97
- package/datepicker/datepicker/datepicker.d.ts.map +1 -1
- package/development/autocomplete/autocomplete.d.ts +1 -1
- package/development/autocomplete/autocomplete.d.ts.map +1 -1
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.d.ts +1 -1
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.d.ts.map +1 -1
- package/development/autocomplete-grid/autocomplete-grid.js +4 -3
- package/development/autocomplete.js +4 -3
- package/development/calendar/calendar.d.ts +1 -1
- package/development/calendar/calendar.d.ts.map +1 -1
- package/development/calendar.js +8 -11
- package/development/checkbox/checkbox-panel/checkbox-panel.d.ts +1 -1
- package/development/checkbox/checkbox-panel/checkbox-panel.d.ts.map +1 -1
- package/development/checkbox/checkbox-panel.js +2 -2
- package/development/checkbox/common.js +2 -2
- package/development/clock/clock.d.ts +1 -1
- package/development/clock/clock.d.ts.map +1 -1
- package/development/clock.js +3 -3
- package/development/container/sticky-bar/sticky-bar.d.ts +29 -2
- package/development/container/sticky-bar/sticky-bar.d.ts.map +1 -1
- package/development/container/sticky-bar.js +149 -36
- package/development/core/base-elements/link-base-element.d.ts +1 -0
- package/development/core/base-elements/link-base-element.d.ts.map +1 -1
- package/development/core/base-elements.js +5 -2
- package/development/core/config/config.d.ts +3 -0
- package/development/core/config/config.d.ts.map +1 -1
- package/development/core/config.js +1 -1
- package/development/core/controllers/media-matchers-controller.d.ts +32 -0
- package/development/core/controllers/media-matchers-controller.d.ts.map +1 -0
- package/development/core/controllers.d.ts +1 -0
- package/development/core/controllers.d.ts.map +1 -1
- package/development/core/controllers.js +65 -1
- package/development/core/dom/breakpoint.d.ts +2 -1
- package/development/core/dom/breakpoint.d.ts.map +1 -1
- package/development/core/dom.js +2 -2
- package/development/core/mixins/form-associated-checkbox-mixin.d.ts.map +1 -1
- package/development/core/mixins.js +9 -2
- package/development/core/testing/event-spy.d.ts +6 -4
- package/development/core/testing/event-spy.d.ts.map +1 -1
- package/development/core/testing.js +35 -1
- package/development/datepicker/datepicker/datepicker.d.ts.map +1 -1
- package/development/datepicker/datepicker.js +1 -1
- package/development/dialog/dialog.js +2 -2
- package/development/expansion-panel/expansion-panel-header/expansion-panel-header.d.ts +2 -0
- package/development/expansion-panel/expansion-panel-header/expansion-panel-header.d.ts.map +1 -1
- package/development/expansion-panel/expansion-panel-header.js +7 -3
- package/development/file-selector/file-selector.d.ts +5 -0
- package/development/file-selector/file-selector.d.ts.map +1 -1
- package/development/file-selector.js +8 -1
- package/development/flip-card/flip-card/flip-card.d.ts +4 -0
- package/development/flip-card/flip-card/flip-card.d.ts.map +1 -1
- package/development/flip-card/flip-card-details.js +4 -6
- package/development/flip-card/flip-card-summary/flip-card-summary.d.ts +1 -1
- package/development/flip-card/flip-card-summary/flip-card-summary.d.ts.map +1 -1
- package/development/flip-card/flip-card-summary.js +9 -10
- package/development/flip-card/flip-card.js +26 -2
- package/development/form-field/form-field.js +5 -3
- package/development/icon/icon.d.ts +1 -1
- package/development/icon.js +1 -1
- package/development/image/image.d.ts.map +1 -1
- package/development/image.js +3 -19
- package/development/map-container.js +3 -2
- package/development/menu/menu/menu.d.ts +1 -0
- package/development/menu/menu/menu.d.ts.map +1 -1
- package/development/menu/menu.js +15 -11
- package/development/navigation/navigation-section.js +4 -14
- package/development/navigation/navigation.js +3 -13
- package/development/notification.js +3 -2
- package/development/paginator/paginator/paginator.d.ts +1 -5
- package/development/paginator/paginator/paginator.d.ts.map +1 -1
- package/development/paginator/paginator.js +19 -27
- package/development/popover/popover/popover.d.ts.map +1 -1
- package/development/popover/popover.js +9 -16
- package/development/radio-button/radio-button-panel/radio-button-panel.d.ts +1 -1
- package/development/radio-button/radio-button-panel/radio-button-panel.d.ts.map +1 -1
- package/development/radio-button/radio-button-panel.js +2 -2
- package/development/sbb-tokens-BdGhUJjM.js +33 -0
- package/development/select/select.d.ts +6 -5
- package/development/select/select.d.ts.map +1 -1
- package/development/select.js +23 -14
- package/development/slider/slider.d.ts +5 -0
- package/development/slider/slider.d.ts.map +1 -1
- package/development/slider.js +8 -1
- package/development/table/table-wrapper/table-wrapper.d.ts +1 -1
- package/development/table/table-wrapper/table-wrapper.d.ts.map +1 -1
- package/development/table/table-wrapper.js +1 -1
- package/development/teaser/teaser.d.ts +2 -1
- package/development/teaser/teaser.d.ts.map +1 -1
- package/development/teaser-product/common/teaser-product-common.d.ts +1 -1
- package/development/teaser-product/common/teaser-product-common.d.ts.map +1 -1
- package/development/teaser-product/common.js +19 -19
- package/development/teaser-product/teaser-product/teaser-product.d.ts +2 -1
- package/development/teaser-product/teaser-product/teaser-product.d.ts.map +1 -1
- package/development/teaser-product/teaser-product.js +44 -12
- package/development/teaser.js +33 -7
- package/development/timetable-occupancy-icon/timetable-occupancy-icon.d.ts +2 -1
- package/development/timetable-occupancy-icon/timetable-occupancy-icon.d.ts.map +1 -1
- package/development/timetable-occupancy-icon.js +11 -9
- package/development/toggle-check/toggle-check.d.ts +1 -1
- package/development/toggle-check/toggle-check.d.ts.map +1 -1
- package/development/toggle-check.js +2 -2
- package/dialog/dialog.js +1 -1
- package/expansion-panel/expansion-panel-header/expansion-panel-header.d.ts +2 -0
- package/expansion-panel/expansion-panel-header/expansion-panel-header.d.ts.map +1 -1
- package/expansion-panel/expansion-panel-header.js +25 -23
- package/file-selector/file-selector.d.ts +5 -0
- package/file-selector/file-selector.d.ts.map +1 -1
- package/file-selector.js +7 -0
- package/flip-card/flip-card/flip-card.d.ts +4 -0
- package/flip-card/flip-card/flip-card.d.ts.map +1 -1
- package/flip-card/flip-card-details.js +6 -6
- package/flip-card/flip-card-summary/flip-card-summary.d.ts +1 -1
- package/flip-card/flip-card-summary/flip-card-summary.d.ts.map +1 -1
- package/flip-card/flip-card-summary.js +8 -8
- package/flip-card/flip-card.js +56 -42
- package/icon/icon.d.ts +1 -1
- package/image/image.d.ts.map +1 -1
- package/image.js +46 -45
- package/map-container.js +7 -7
- package/menu/menu/menu.d.ts +1 -0
- package/menu/menu/menu.d.ts.map +1 -1
- package/menu/menu.js +45 -41
- package/navigation/navigation-section.js +7 -7
- package/navigation/navigation.js +8 -8
- package/package.json +1 -1
- package/paginator/paginator/paginator.d.ts +1 -5
- package/paginator/paginator/paginator.d.ts.map +1 -1
- package/paginator/paginator.js +50 -52
- package/popover/popover/popover.d.ts.map +1 -1
- package/popover/popover.js +42 -46
- package/radio-button/radio-button-panel/radio-button-panel.d.ts +1 -1
- package/radio-button/radio-button-panel/radio-button-panel.d.ts.map +1 -1
- package/radio-button/radio-button-panel.js +7 -7
- package/sbb-tokens-Dx20OtVg.js +18 -0
- package/select/select.d.ts +6 -5
- package/select/select.d.ts.map +1 -1
- package/select.js +55 -53
- package/slider/slider.d.ts +5 -0
- package/slider/slider.d.ts.map +1 -1
- package/slider.js +12 -5
- package/table/table-wrapper/table-wrapper.d.ts +1 -1
- package/table/table-wrapper/table-wrapper.d.ts.map +1 -1
- package/teaser/teaser.d.ts +2 -1
- package/teaser/teaser.d.ts.map +1 -1
- package/teaser-product/common/teaser-product-common.d.ts +1 -1
- package/teaser-product/common/teaser-product-common.d.ts.map +1 -1
- package/teaser-product/common.js +22 -20
- package/teaser-product/teaser-product/teaser-product.d.ts +2 -1
- package/teaser-product/teaser-product/teaser-product.d.ts.map +1 -1
- package/teaser-product/teaser-product.js +26 -13
- package/teaser.js +38 -26
- package/timetable-occupancy-icon/timetable-occupancy-icon.d.ts +2 -1
- package/timetable-occupancy-icon/timetable-occupancy-icon.d.ts.map +1 -1
- package/timetable-occupancy-icon.js +45 -44
- package/toggle-check/toggle-check.d.ts +1 -1
- package/toggle-check/toggle-check.d.ts.map +1 -1
- package/toggle-check.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoint.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/dom/breakpoint.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,yEAA0E,CAAC;AACnG,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"breakpoint.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/dom/breakpoint.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,yEAA0E,CAAC;AACnG,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,CAAC,EAAE,UAAU,EACjB,EAAE,CAAC,EAAE,UAAU,EACf,UAAU,CAAC,EAAE;IAAE,oBAAoB,EAAE,OAAO,CAAA;CAAE,GAC7C,OAAO,GAAG,IAAI,CAsBhB"}
|
package/core/dom.js
CHANGED
|
@@ -2,8 +2,8 @@ import { isServer as e } from "lit";
|
|
|
2
2
|
const v = ["zero", "micro", "small", "medium", "wide", "large", "ultra"];
|
|
3
3
|
function E(t, n, o) {
|
|
4
4
|
if (e)
|
|
5
|
-
return
|
|
6
|
-
const i = getComputedStyle(document.documentElement),
|
|
5
|
+
return null;
|
|
6
|
+
const i = getComputedStyle(document.documentElement), r = t ? i.getPropertyValue(`--sbb-breakpoint-${t}-min`) : "", s = n ? `${parseFloat(i.getPropertyValue(`--sbb-breakpoint-${n}-${o != null && o.includeMaxBreakpoint ? "max" : "min"}`)) - (o != null && o.includeMaxBreakpoint ? 0 : 0.0625)}rem` : "", m = r && `(min-width: ${r})`, f = s && `(max-width: ${s})`, y = r && s && " and ";
|
|
7
7
|
return window.matchMedia(`${m}${y}${f}`).matches;
|
|
8
8
|
}
|
|
9
9
|
function g(t) {
|
|
@@ -33,13 +33,13 @@ function x(t, n) {
|
|
|
33
33
|
function k(t, n, o) {
|
|
34
34
|
o ? t.setAttribute(n, o) : t.removeAttribute(n);
|
|
35
35
|
}
|
|
36
|
-
let
|
|
36
|
+
let c;
|
|
37
37
|
try {
|
|
38
|
-
|
|
38
|
+
c = typeof Intl < "u" && Intl.v8BreakIterator;
|
|
39
39
|
} catch {
|
|
40
|
-
|
|
40
|
+
c = !1;
|
|
41
41
|
}
|
|
42
|
-
const u = !e && /(edge)/i.test(navigator.userAgent),
|
|
42
|
+
const u = !e && /(edge)/i.test(navigator.userAgent), a = !e && /(msie|trident)/i.test(navigator.userAgent), b = !e && !!(window.chrome || c) && typeof CSS < "u" && !u && !a, h = !e && /AppleWebKit/i.test(navigator.userAgent) && !b && !u && !a, I = !e && /iPad|iPhone|iPod/.test(navigator.userAgent) && !("MSStream" in window), $ = !e && /(firefox|minefield)/i.test(navigator.userAgent), M = !e && /android/i.test(navigator.userAgent) && !a, _ = !e && /safari/i.test(navigator.userAgent) && h, W = b, B = () => !!globalThis.next;
|
|
43
43
|
function l() {
|
|
44
44
|
return document.body.hasAttribute("data-sbb-scroll-disabled");
|
|
45
45
|
}
|
|
@@ -86,7 +86,7 @@ export {
|
|
|
86
86
|
I as isIOS,
|
|
87
87
|
B as isNextjs,
|
|
88
88
|
_ as isSafari,
|
|
89
|
-
|
|
89
|
+
a as isTrident,
|
|
90
90
|
h as isWebkit,
|
|
91
91
|
l as pageScrollDisabled,
|
|
92
92
|
k as setOrRemoveAttribute
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-associated-checkbox-mixin.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/mixins/form-associated-checkbox-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAMxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAErB,KAAK,0BAA0B,EAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIlF,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,kCAC5B,SAAQ,0BACR,YAAW,OAAO,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC;IAEvE,IAAW,OAAO,IAAI,OAAO,CAAC;IAC9B,IAAW,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE;IAEnC,IAAW,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE;IACpC,IAAW,QAAQ,IAAI,OAAO,CAAC;IAE/B,IAAW,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE;IACpC,IAAW,QAAQ,IAAI,OAAO,CAAC;IAExB,iBAAiB,IAAI,IAAI;IACzB,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAEhG,SAAS,CAAC,oBAAoB,IAAI,OAAO;IACzC,SAAS,CAAC,oBAAoB,IAAI,OAAO;IACzC,SAAS,CAAC,mBAAmB,CAAC,IAAI,IAAI;IACtC,SAAS,CAAC,eAAe,IAAI,IAAI;CAClC;AAED;;;;GAIG;AAEH,eAAO,MAAM,8BAA8B,GAAI,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,cAClE,CAAC,KACZ,WAAW,CAAC,kCAAkC,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"form-associated-checkbox-mixin.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/mixins/form-associated-checkbox-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAMxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAErB,KAAK,0BAA0B,EAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIlF,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,kCAC5B,SAAQ,0BACR,YAAW,OAAO,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC;IAEvE,IAAW,OAAO,IAAI,OAAO,CAAC;IAC9B,IAAW,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE;IAEnC,IAAW,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE;IACpC,IAAW,QAAQ,IAAI,OAAO,CAAC;IAE/B,IAAW,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE;IACpC,IAAW,QAAQ,IAAI,OAAO,CAAC;IAExB,iBAAiB,IAAI,IAAI;IACzB,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAEhG,SAAS,CAAC,oBAAoB,IAAI,OAAO;IACzC,SAAS,CAAC,oBAAoB,IAAI,OAAO;IACzC,SAAS,CAAC,mBAAmB,CAAC,IAAI,IAAI;IACtC,SAAS,CAAC,eAAe,IAAI,IAAI;CAClC;AAED;;;;GAIG;AAEH,eAAO,MAAM,8BAA8B,GAAI,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,cAClE,CAAC,KACZ,WAAW,CAAC,kCAAkC,CAAC,GAAG,CAqJpD,CAAC"}
|
package/core/mixins.js
CHANGED
|
@@ -202,7 +202,7 @@ const D = (r) => (() => {
|
|
|
202
202
|
get required() {
|
|
203
203
|
return this._required || this.isRequiredExternally();
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
willUpdate(s) {
|
|
206
206
|
super.willUpdate(s), s.has("required") && (this.internals.ariaRequired = `${this.required}`);
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -232,6 +232,13 @@ const D = (r) => (() => {
|
|
|
232
232
|
get checked() {
|
|
233
233
|
return this._checked;
|
|
234
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Form type of element.
|
|
237
|
+
* @default 'checkbox'
|
|
238
|
+
*/
|
|
239
|
+
get type() {
|
|
240
|
+
return "checkbox";
|
|
241
|
+
}
|
|
235
242
|
constructor() {
|
|
236
243
|
super(), this._attributeMutationBlocked = (v(this, s), !1), this._checked = !1, this._handleKeyboardInteraction = (e) => {
|
|
237
244
|
e.key === " " && this._handleUserInteraction();
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
:host(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
:is(
|
|
38
|
+
[data-focus-visible],
|
|
39
|
+
:focus-visible:not([data-focus-origin='mouse'], [data-focus-origin='touch'])
|
|
40
|
+
)
|
|
41
|
+
) {
|
|
42
42
|
@include icon-button-focus-visible(#{$button-selector});
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This class exists to facilitate the test migration from stencil to lit.
|
|
3
3
|
* It mimics the API that stencil provided to test events.
|
|
4
|
-
*
|
|
5
|
-
* TODO: Document me
|
|
6
4
|
*/
|
|
7
5
|
export declare class EventSpy<T extends Event> {
|
|
8
6
|
private _event;
|
|
9
7
|
private readonly _target;
|
|
10
|
-
private _count;
|
|
11
8
|
get count(): number;
|
|
12
|
-
private
|
|
9
|
+
private _count;
|
|
13
10
|
get events(): T[];
|
|
11
|
+
private _events;
|
|
14
12
|
get firstEvent(): T | null;
|
|
15
13
|
get lastEvent(): T | null;
|
|
14
|
+
private _promiseEventMap;
|
|
16
15
|
constructor(_event: string, _target?: Node | null);
|
|
16
|
+
calledOnce(timeout?: number): Promise<T>;
|
|
17
|
+
calledTimes(count: number, timeout?: number): Promise<T>;
|
|
18
|
+
private _wrapPromiseWithTimeout;
|
|
17
19
|
private _listenForEvent;
|
|
18
20
|
}
|
|
19
21
|
//# sourceMappingURL=event-spy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-spy.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/testing/event-spy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-spy.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/testing/event-spy.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,KAAK;IAsBjC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ,CAAC,OAAO;IAtB1B,IAAW,KAAK,IAAI,MAAM,CAEzB;IACD,OAAO,CAAC,MAAM,CAAa;IAE3B,IAAW,MAAM,IAAI,CAAC,EAAE,CAEvB;IACD,OAAO,CAAC,OAAO,CAAW;IAE1B,IAAW,UAAU,IAAI,CAAC,GAAG,IAAI,CAEhC;IAED,IAAW,SAAS,IAAI,CAAC,GAAG,IAAI,CAE/B;IAED,OAAO,CAAC,gBAAgB,CAA6C;gBAG3D,MAAM,EAAE,MAAM,EACL,OAAO,GAAE,IAAI,GAAG,IAAW;IASvC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IA6B7D,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,eAAe;CAOxB"}
|
package/core/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isSafari as
|
|
2
|
-
class
|
|
1
|
+
import { isSafari as l } from "./dom.js";
|
|
2
|
+
class v {
|
|
3
3
|
get count() {
|
|
4
4
|
return this._count;
|
|
5
5
|
}
|
|
@@ -12,79 +12,106 @@ class d {
|
|
|
12
12
|
get lastEvent() {
|
|
13
13
|
return this.events.length ? this.events[this.events.length - 1] : null;
|
|
14
14
|
}
|
|
15
|
-
constructor(
|
|
16
|
-
this._event =
|
|
15
|
+
constructor(e, t = null) {
|
|
16
|
+
this._event = e, this._target = t, this._count = 0, this._events = [], this._promiseEventMap = /* @__PURE__ */ new Map(), this._target || (this._target = document), this._listenForEvent();
|
|
17
|
+
}
|
|
18
|
+
calledOnce(e) {
|
|
19
|
+
return this.calledTimes(1, e);
|
|
20
|
+
}
|
|
21
|
+
calledTimes(e, t = 2e3) {
|
|
22
|
+
if (this.count > e)
|
|
23
|
+
return Promise.reject(`Event has been emitted more than expected (expected ${e}, actual ${this.count}`);
|
|
24
|
+
if (this.count === e)
|
|
25
|
+
return Promise.resolve(this.events[e - 1]);
|
|
26
|
+
if (this._promiseEventMap.has(e))
|
|
27
|
+
return this._promiseEventMap.get(e).promise;
|
|
28
|
+
{
|
|
29
|
+
let r, s;
|
|
30
|
+
const o = {
|
|
31
|
+
promise: new Promise((a, m) => {
|
|
32
|
+
r = a, s = m;
|
|
33
|
+
}),
|
|
34
|
+
resolve: r,
|
|
35
|
+
reject: s
|
|
36
|
+
};
|
|
37
|
+
return this._promiseEventMap.set(e, o), this._wrapPromiseWithTimeout(o, e, t);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
_wrapPromiseWithTimeout(e, t, r) {
|
|
41
|
+
const s = setTimeout(() => e.reject(`awaiting calledTimes(${t}) results in timeout`), r);
|
|
42
|
+
return e.promise.then(() => clearTimeout(s)), e.promise;
|
|
17
43
|
}
|
|
18
44
|
_listenForEvent() {
|
|
19
|
-
var
|
|
20
|
-
(
|
|
21
|
-
|
|
45
|
+
var e;
|
|
46
|
+
(e = this._target) == null || e.addEventListener(this._event, (t) => {
|
|
47
|
+
var r;
|
|
48
|
+
this._events.push(t), this._count++, (r = this._promiseEventMap.get(this.count)) == null || r.resolve(t);
|
|
22
49
|
});
|
|
23
50
|
}
|
|
24
51
|
}
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
return Mocha.describe(
|
|
28
|
-
}, g = (e, t
|
|
29
|
-
if (
|
|
30
|
-
return Mocha.test(
|
|
52
|
+
const p = (i, e, t) => {
|
|
53
|
+
if (i)
|
|
54
|
+
return Mocha.describe(e, t);
|
|
55
|
+
}, g = (i, e, t) => {
|
|
56
|
+
if (i)
|
|
57
|
+
return Mocha.test(e, t);
|
|
31
58
|
};
|
|
32
|
-
function
|
|
33
|
-
window.scrollTo(
|
|
59
|
+
function w(i) {
|
|
60
|
+
window.scrollTo(i), document.dispatchEvent(new Event("scroll"));
|
|
34
61
|
}
|
|
35
|
-
async function f(
|
|
36
|
-
const
|
|
37
|
-
let
|
|
38
|
-
function
|
|
39
|
-
return
|
|
62
|
+
async function f(i, e = 30, t = 2 * 1e3) {
|
|
63
|
+
const r = /* @__PURE__ */ new Date();
|
|
64
|
+
let s = 0;
|
|
65
|
+
function n() {
|
|
66
|
+
return s++, i();
|
|
40
67
|
}
|
|
41
|
-
for (; !await
|
|
42
|
-
await new Promise((
|
|
43
|
-
return
|
|
68
|
+
for (; !await n() && r.getTime() + t >= (/* @__PURE__ */ new Date()).getTime(); )
|
|
69
|
+
await new Promise((o) => setTimeout(o, e));
|
|
70
|
+
return r.getTime() + t < (/* @__PURE__ */ new Date()).getTime() ? Promise.reject(`waitForCondition timeout: ${i.toString()}, attempts: ${s}, start: ${r.getTime()}, end: ${(/* @__PURE__ */ new Date()).getTime()}`) : Promise.resolve(!0);
|
|
44
71
|
}
|
|
45
|
-
function
|
|
46
|
-
return new Promise((
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, { passive: !0, signal:
|
|
72
|
+
function E(i, e, t = 1e3) {
|
|
73
|
+
return new Promise((r, s) => {
|
|
74
|
+
const n = AbortSignal.timeout(t), o = () => s(`Timeout of ${t} reached`);
|
|
75
|
+
n.addEventListener("abort", o), i.addEventListener(e, () => {
|
|
76
|
+
n.removeEventListener("abort", o), r();
|
|
77
|
+
}, { passive: !0, signal: n });
|
|
51
78
|
});
|
|
52
79
|
}
|
|
53
|
-
async function
|
|
54
|
-
var
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
80
|
+
async function _(i, e = 2 * 1e3) {
|
|
81
|
+
var r;
|
|
82
|
+
const t = i.localName === "sbb-image" ? ((r = i.shadowRoot) == null ? void 0 : r.querySelector(".sbb-image__img")) ?? null : i;
|
|
83
|
+
if (!t)
|
|
57
84
|
throw new Error("img tag not found");
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
clearTimeout(
|
|
62
|
-
|
|
85
|
+
i.complete ? await t.decode() : await new Promise((s, n) => {
|
|
86
|
+
const o = setTimeout(() => n("image loading timeout"), e);
|
|
87
|
+
i.addEventListener("load", () => {
|
|
88
|
+
clearTimeout(o), t.decode().then(() => {
|
|
89
|
+
l && i.localName === "sbb-image" ? setTimeout(s, 100) : s();
|
|
63
90
|
});
|
|
64
|
-
}),
|
|
65
|
-
clearTimeout(
|
|
91
|
+
}), i.addEventListener("error", () => {
|
|
92
|
+
clearTimeout(o), n("image error");
|
|
66
93
|
});
|
|
67
94
|
});
|
|
68
95
|
}
|
|
69
|
-
const c = (
|
|
70
|
-
var
|
|
71
|
-
const
|
|
72
|
-
(
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
96
|
+
const c = (i) => !!i.updateComplete, u = Promise.resolve(), h = async (i) => {
|
|
97
|
+
var r, s;
|
|
98
|
+
const e = await i;
|
|
99
|
+
(s = (r = e.parentElement ?? e).querySelectorAll) == null || s.call(r, "[defer-hydration]").forEach((n) => n.removeAttribute("defer-hydration"));
|
|
100
|
+
const t = [e, ...e.querySelectorAll("*")].filter(c).map((n) => [
|
|
101
|
+
n.updateComplete,
|
|
102
|
+
n.hydrationComplete ?? u,
|
|
103
|
+
h(n.renderRoot)
|
|
77
104
|
]).flat(1 / 0);
|
|
78
|
-
return await Promise.all(
|
|
105
|
+
return await Promise.all(t), e;
|
|
79
106
|
};
|
|
80
107
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
108
|
+
v as EventSpy,
|
|
109
|
+
p as describeIf,
|
|
83
110
|
c as isReactiveElement,
|
|
84
|
-
|
|
111
|
+
w as mockScrollTo,
|
|
85
112
|
g as testIf,
|
|
86
113
|
f as waitForCondition,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
114
|
+
E as waitForEvent,
|
|
115
|
+
_ as waitForImageReady,
|
|
116
|
+
h as waitForLitRender
|
|
90
117
|
};
|