@mmstack/primitives 19.5.0 → 19.5.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { isDevMode, inject, Injector, untracked, effect, DestroyRef, linkedSignal, InjectionToken, TemplateRef, ViewContainerRef, input, computed, Directive, signal,
|
|
2
|
+
import { isDevMode, inject, Injector, untracked, effect, DestroyRef, linkedSignal, InjectionToken, TemplateRef, ViewContainerRef, PLATFORM_ID, input, computed, Directive, signal, runInInjectionContext, ResourceStatus, afterNextRender, Component, isSignal, ElementRef, Injectable } from '@angular/core';
|
|
3
3
|
import { isPlatformServer } from '@angular/common';
|
|
4
4
|
import { SIGNAL } from '@angular/core/primitives/signals';
|
|
5
5
|
|
|
@@ -248,6 +248,7 @@ class MmActivity {
|
|
|
248
248
|
tpl = inject(TemplateRef);
|
|
249
249
|
vcr = inject(ViewContainerRef);
|
|
250
250
|
parent = inject(Injector);
|
|
251
|
+
onServer = isPlatformServer(inject(PLATFORM_ID, { optional: true }) ?? 'browser');
|
|
251
252
|
/** When false, keep the content mounted but hidden + CD-detached. */
|
|
252
253
|
visible = input.required({ alias: 'mmActivity' });
|
|
253
254
|
/** Paused == not visible — handed to the kept subtree as PAUSED_CONTEXT. */
|
|
@@ -270,6 +271,8 @@ class MmActivity {
|
|
|
270
271
|
}),
|
|
271
272
|
});
|
|
272
273
|
}
|
|
274
|
+
if (this.onServer)
|
|
275
|
+
return;
|
|
273
276
|
for (const node of this.view.rootNodes) {
|
|
274
277
|
// covers HTML and SVG roots; text/comment roots can't be styled — their CD is still
|
|
275
278
|
// detached, but prefer an element root for true visual hiding
|
|
@@ -645,6 +648,7 @@ function registerResource(res, opt) {
|
|
|
645
648
|
function injectStartTransition() {
|
|
646
649
|
const scope = injectTransitionScope();
|
|
647
650
|
const injector = inject(Injector);
|
|
651
|
+
const onServer = isPlatformServer(inject(PLATFORM_ID, { optional: true }) ?? 'browser');
|
|
648
652
|
return (fn) => {
|
|
649
653
|
untracked(fn);
|
|
650
654
|
let sawPending = false;
|
|
@@ -659,6 +663,13 @@ function injectStartTransition() {
|
|
|
659
663
|
resolve();
|
|
660
664
|
}
|
|
661
665
|
}, { injector });
|
|
666
|
+
if (onServer) {
|
|
667
|
+
if (!untracked(scope.pending)) {
|
|
668
|
+
watcher.destroy();
|
|
669
|
+
resolve();
|
|
670
|
+
}
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
662
673
|
// no-async fallback: once the reactive system has processed the writes (afterNextRender),
|
|
663
674
|
// if nothing ever went in flight, the transition is already complete.
|
|
664
675
|
afterNextRender(() => {
|
|
@@ -799,6 +810,7 @@ function runInTransaction(txn, fn) {
|
|
|
799
810
|
function injectStartTransaction() {
|
|
800
811
|
const scope = injectTransitionScope();
|
|
801
812
|
const injector = inject(Injector);
|
|
813
|
+
const onServer = isPlatformServer(inject(PLATFORM_ID, { optional: true }) ?? 'browser');
|
|
802
814
|
return (fn) => {
|
|
803
815
|
const txn = createTransaction();
|
|
804
816
|
// Hold BEFORE the writes, so the display freezes at pre-transaction values.
|
|
@@ -840,11 +852,17 @@ function injectStartTransaction() {
|
|
|
840
852
|
if (sawPending && !p)
|
|
841
853
|
finish(false);
|
|
842
854
|
}, { injector });
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
if (!sawPending && !untracked(scope.pending))
|
|
855
|
+
if (onServer) {
|
|
856
|
+
if (!untracked(scope.pending))
|
|
846
857
|
finish(false);
|
|
847
|
-
}
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
// no-async fallback: if nothing ever went in flight, settle once the writes are processed.
|
|
861
|
+
afterNextRender(() => {
|
|
862
|
+
if (!sawPending && !untracked(scope.pending))
|
|
863
|
+
finish(false);
|
|
864
|
+
}, { injector });
|
|
865
|
+
}
|
|
848
866
|
return {
|
|
849
867
|
pending: scope.pending,
|
|
850
868
|
done,
|