@ethlete/core 5.0.0-next.52 → 5.0.0-next.53
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/CHANGELOG.md +12 -0
- package/fesm2022/ethlete-core.mjs +66 -14
- package/fesm2022/ethlete-core.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ethlete-core.d.ts +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ethlete/core
|
|
2
2
|
|
|
3
|
+
## 5.0.0-next.53
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`2352137`](https://github.com/ethlete-io/ethdk/commit/235213735ede4c3542b7796d378e008bcab50bdc) Thanks [@TomTomB](https://github.com/TomTomB)! - An overlay strategy switch between a backdropped and a backdrop-less shape now adds or
|
|
8
|
+
removes the backdrop instead of keeping the one it mounted with. `elements.backdropElement`
|
|
9
|
+
is a signal.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`0b4b4eb`](https://github.com/ethlete-io/ethdk/commit/0b4b4eb779218d6c70b27c212b03703ca8b64564) Thanks [@TomTomB](https://github.com/TomTomB)! - Overlay: an overlay's own providers are destroyed when it closes, so an overlay router with `syncUrl` removes its query param from the url again.
|
|
14
|
+
|
|
3
15
|
## 5.0.0-next.52
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
|
@@ -7711,6 +7711,7 @@ const createOverlayRuntimeRef = (id, config, elements, requestClose) => {
|
|
|
7711
7711
|
const _componentInstance = signal(null, /* @ts-ignore */
|
|
7712
7712
|
...(ngDevMode ? [{ debugName: "_componentInstance" }] : /* istanbul ignore next */ []));
|
|
7713
7713
|
let positionUpdater = null;
|
|
7714
|
+
let backdropUpdater = null;
|
|
7714
7715
|
const beforeOpenedSubject = new Subject();
|
|
7715
7716
|
const afterOpenedSubject = new Subject();
|
|
7716
7717
|
const beforeClosedSubject = new Subject();
|
|
@@ -7776,6 +7777,20 @@ const createOverlayRuntimeRef = (id, config, elements, requestClose) => {
|
|
|
7776
7777
|
}
|
|
7777
7778
|
positionUpdater?.(strategy);
|
|
7778
7779
|
},
|
|
7780
|
+
/** @internal */
|
|
7781
|
+
attachBackdropUpdater(updater) {
|
|
7782
|
+
backdropUpdater = updater;
|
|
7783
|
+
},
|
|
7784
|
+
/**
|
|
7785
|
+
* Adds or removes the backdrop of an open overlay. `elements.backdropElement` follows.
|
|
7786
|
+
* A closing overlay keeps the backdrop it has, so its leave transition stays intact.
|
|
7787
|
+
*/
|
|
7788
|
+
updateBackdrop(hasBackdrop) {
|
|
7789
|
+
if (_state() === 'closing' || _state() === 'closed') {
|
|
7790
|
+
return;
|
|
7791
|
+
}
|
|
7792
|
+
backdropUpdater?.(hasBackdrop);
|
|
7793
|
+
},
|
|
7779
7794
|
markOpened() {
|
|
7780
7795
|
if (_state() !== 'mounting') {
|
|
7781
7796
|
return;
|
|
@@ -7892,11 +7907,27 @@ const OVERLAY_RUNTIME_DEF = /* @__PURE__ */ defineRootProvider(() => {
|
|
|
7892
7907
|
const root = getRootElement(targetDocument, layer);
|
|
7893
7908
|
const hostElement = renderer.createElement('div');
|
|
7894
7909
|
const paneElement = renderer.createElement('div');
|
|
7895
|
-
const backdropElement =
|
|
7910
|
+
const backdropElement = signal(null, /* @ts-ignore */
|
|
7911
|
+
...(ngDevMode ? [{ debugName: "backdropElement" }] : /* istanbul ignore next */ []));
|
|
7896
7912
|
const previousFocusedElement = isHTMLElement(targetDocument.activeElement) ? targetDocument.activeElement : null;
|
|
7897
7913
|
const autoFocus = config.autoFocus ?? 'first-tabbable';
|
|
7914
|
+
let currentHasBackdrop = config.hasBackdrop !== false;
|
|
7915
|
+
let currentPositionStrategy = config.positionStrategy;
|
|
7916
|
+
const activeConfig = () => ({
|
|
7917
|
+
...config,
|
|
7918
|
+
positionStrategy: currentPositionStrategy,
|
|
7919
|
+
hasBackdrop: currentHasBackdrop,
|
|
7920
|
+
});
|
|
7921
|
+
const createBackdropElement = () => {
|
|
7922
|
+
const element = renderer.createElement('div');
|
|
7923
|
+
renderer.addClass(element, 'et-overlay-runtime-backdrop');
|
|
7924
|
+
setBackdropStyles(element, renderer);
|
|
7925
|
+
renderer.setAttribute(element, 'data-overlay-id', config.id);
|
|
7926
|
+
(config.backdropClass ?? []).forEach((className) => renderer.addClass(element, className));
|
|
7927
|
+
return element;
|
|
7928
|
+
};
|
|
7898
7929
|
renderer.addClass(hostElement, 'et-overlay-runtime-entry');
|
|
7899
|
-
setBaseElementStyles(
|
|
7930
|
+
setBaseElementStyles(activeConfig(), hostElement, paneElement, renderer);
|
|
7900
7931
|
renderer.setAttributes(hostElement, {
|
|
7901
7932
|
'data-overlay-id': config.id,
|
|
7902
7933
|
role: config.role ?? null,
|
|
@@ -7907,19 +7938,17 @@ const OVERLAY_RUNTIME_DEF = /* @__PURE__ */ defineRootProvider(() => {
|
|
|
7907
7938
|
'aria-label': config.ariaLabel ?? null,
|
|
7908
7939
|
});
|
|
7909
7940
|
renderer.addClass(hostElement, ...(config.hostClass ?? []));
|
|
7910
|
-
if (
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
(config.backdropClass ?? []).forEach((className) => renderer.addClass(backdropElement, className));
|
|
7915
|
-
renderer.appendChild(hostElement, backdropElement);
|
|
7941
|
+
if (currentHasBackdrop) {
|
|
7942
|
+
const element = createBackdropElement();
|
|
7943
|
+
renderer.appendChild(hostElement, element);
|
|
7944
|
+
backdropElement.set(element);
|
|
7916
7945
|
}
|
|
7917
7946
|
renderer.appendChild(hostElement, paneElement);
|
|
7918
7947
|
renderer.appendChild(root, hostElement);
|
|
7919
7948
|
const overlayRef = createOverlayRuntimeRef(config.id, { ...config }, {
|
|
7920
7949
|
rootElement: root,
|
|
7921
7950
|
hostElement,
|
|
7922
|
-
backdropElement,
|
|
7951
|
+
backdropElement: backdropElement.asReadonly(),
|
|
7923
7952
|
paneElement,
|
|
7924
7953
|
}, (result, source) => beginClose({ result, source }));
|
|
7925
7954
|
animationDebugLog(`runtime ${config.id}`, 'mount');
|
|
@@ -7946,23 +7975,46 @@ const OVERLAY_RUNTIME_DEF = /* @__PURE__ */ defineRootProvider(() => {
|
|
|
7946
7975
|
overlayRef.beforeOpenedSubject.next();
|
|
7947
7976
|
overlayRef.beforeOpenedSubject.complete();
|
|
7948
7977
|
openEntriesState.update((entries) => [...entries, overlayRef]);
|
|
7949
|
-
let positionCleanup = setupPositioning(
|
|
7978
|
+
let positionCleanup = setupPositioning(activeConfig(), hostElement, paneElement, overlayRef, renderer);
|
|
7950
7979
|
cleanupFns.push(() => positionCleanup());
|
|
7951
|
-
let currentPositionStrategy = config.positionStrategy;
|
|
7952
7980
|
const getOriginElement = () => currentPositionStrategy?.kind === 'anchored' && isHTMLElement(currentPositionStrategy.referenceElement)
|
|
7953
7981
|
? currentPositionStrategy.referenceElement
|
|
7954
7982
|
: null;
|
|
7955
7983
|
overlayRef.attachPositionUpdater((strategy) => {
|
|
7956
7984
|
currentPositionStrategy = strategy;
|
|
7957
7985
|
positionCleanup();
|
|
7958
|
-
resetPositioningStyles(
|
|
7959
|
-
positionCleanup = setupPositioning(
|
|
7986
|
+
resetPositioningStyles(activeConfig(), hostElement, paneElement, renderer);
|
|
7987
|
+
positionCleanup = setupPositioning(activeConfig(), hostElement, paneElement, overlayRef, renderer);
|
|
7988
|
+
});
|
|
7989
|
+
overlayRef.attachBackdropUpdater((hasBackdrop) => {
|
|
7990
|
+
if (hasBackdrop === currentHasBackdrop) {
|
|
7991
|
+
return;
|
|
7992
|
+
}
|
|
7993
|
+
currentHasBackdrop = hasBackdrop;
|
|
7994
|
+
if (hasBackdrop) {
|
|
7995
|
+
const element = createBackdropElement();
|
|
7996
|
+
renderer.insertBefore(hostElement, element, paneElement);
|
|
7997
|
+
backdropElement.set(element);
|
|
7998
|
+
}
|
|
7999
|
+
else {
|
|
8000
|
+
const element = backdropElement();
|
|
8001
|
+
if (element) {
|
|
8002
|
+
renderer.removeChild(hostElement, element);
|
|
8003
|
+
backdropElement.set(null);
|
|
8004
|
+
}
|
|
8005
|
+
}
|
|
8006
|
+
renderer.setStyle(hostElement, { pointerEvents: hasBackdrop ? 'auto' : 'none' });
|
|
7960
8007
|
});
|
|
7961
8008
|
const destroyMountedOverlay = (closeEvent) => {
|
|
7962
8009
|
animationDebugLog(`runtime ${config.id}`, `destroy (source "${closeEvent.source}")`);
|
|
7963
8010
|
cleanupFns.forEach((cleanup) => cleanup());
|
|
7964
8011
|
appRef.detachView(componentRef.hostView);
|
|
7965
8012
|
componentRef.destroy();
|
|
8013
|
+
// Angular does not own this injector, so nothing else tears down what the overlay's own
|
|
8014
|
+
// providers registered on it - their `DestroyRef` hooks and effects would outlive the overlay.
|
|
8015
|
+
if (!elementInjector.destroyed) {
|
|
8016
|
+
elementInjector.destroy();
|
|
8017
|
+
}
|
|
7966
8018
|
const parentNode = renderer.parentNode(hostElement);
|
|
7967
8019
|
if (parentNode) {
|
|
7968
8020
|
renderer.removeChild(parentNode, hostElement);
|
|
@@ -10008,7 +10060,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
10008
10060
|
|
|
10009
10061
|
// Generated from package.json by tools/scripts/generate-version.js - do not edit.
|
|
10010
10062
|
/** The version of `@ethlete/core` this build was cut from. */
|
|
10011
|
-
const CORE_VERSION = '5.0.0-next.
|
|
10063
|
+
const CORE_VERSION = '5.0.0-next.53';
|
|
10012
10064
|
|
|
10013
10065
|
/**
|
|
10014
10066
|
* Generated bundle index. Do not edit.
|