@mohamedatia/fly-design-system 2.6.1 → 2.6.3

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.
@@ -437,8 +437,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
437
437
  class FlyRemoteRouter {
438
438
  windowData = inject(WINDOW_DATA, { optional: true });
439
439
  router = inject(Router, { optional: true });
440
- /** True when this remote is rendered inside the FlyOS desktop shell. */
441
- isEmbedded = this.windowData != null;
440
+ /**
441
+ * True when this remote is rendered inside the FlyOS desktop shell.
442
+ *
443
+ * Detection order:
444
+ * 1. `WINDOW_DATA` is provided — the canonical signal, works when the
445
+ * design-system module is genuinely shared via Native Federation's
446
+ * `sharedMappings` and the InjectionToken identity matches.
447
+ * 2. `globalThis.__FLYOS_SHELL__ === true` — set by the shell's `main.ts`
448
+ * before `initFederation`. A plain JS global is shared across all
449
+ * module instances in the same browser context, so this works even
450
+ * when the InjectionToken splits between host and remote bundles
451
+ * (a known Native Federation edge case).
452
+ */
453
+ isEmbedded = (() => {
454
+ const fromWindowData = this.windowData != null;
455
+ const g = (typeof globalThis !== 'undefined' ? globalThis : {});
456
+ const fromGlobal = g.__FLYOS_SHELL__ === true;
457
+ const result = fromWindowData || fromGlobal;
458
+ // DIAGNOSTIC — remove once confirmed working.
459
+ // eslint-disable-next-line no-console
460
+ console.log('[FlyRemoteRouter] init', {
461
+ version: '2.6.3-debug',
462
+ fromWindowData,
463
+ fromGlobal,
464
+ result,
465
+ windowData: this.windowData,
466
+ globalKeys: Object.keys(g).filter(k => k.startsWith('__FLYOS')),
467
+ });
468
+ return result;
469
+ })();
442
470
  _url = signal('/', ...(ngDevMode ? [{ debugName: "_url" }] : /* istanbul ignore next */ []));
443
471
  /**
444
472
  * Current logical URL of the remote — `/signals/abc` etc.