@mohamedatia/fly-design-system 2.7.3 → 2.7.4

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.
@@ -763,24 +763,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
763
763
  * (c) `stylesUrl` in manifest/remoteEntry.json — cleanest long-term; requires
764
764
  * protocol change to every remote's CI pipeline (out of scope for Wave A1).
765
765
  *
766
- * CSS Cascade Layer — Option A (`@import` inside inline `<style>`)
767
- * ----------------------------------------------------------------
768
- * Remote stylesheets are injected inside `@layer remote { @import url("..."); }`
769
- * rather than as bare `<link rel="stylesheet">`. This keeps remote styles in a
770
- * named cascade layer so the shell can reliably override them via `@layer overrides`.
766
+ * CSS Cascade Layer — `@import url("...") layer(remote)`
767
+ * --------------------------------------------------------
768
+ * Remote stylesheets are injected via `@import url("") layer(remote)` (CSS
769
+ * Cascade Level 5). This keeps remote styles in a named cascade layer so the
770
+ * shell can reliably override them via `@layer overrides`.
771
771
  *
772
- * Option A was chosen over:
773
- * - Option B (fetch+inline): relative `url(...)` paths inside the remote CSS
774
- * would resolve against the shell origin instead of the remote origin,
775
- * breaking fonts and images. Dealbreaker without a full URL-rewrite pass.
776
- * - Option C (`<link layer="remote">`): the `layer` attribute on `<link>` is
777
- * not yet shipped in Firefox (as of 2025-05). Chromium 99+ and Safari 16.4+
778
- * support it, but Firefox is still behind, making it non-portable today.
772
+ * The block-form `@layer remote { @import url("…"); }` is INVALID CSS — the
773
+ * spec forbids `@import` inside any block at-rule. Browsers silently drop such
774
+ * rules, causing remote stylesheets to never load. The correct syntax is the
775
+ * `layer()` modifier on a top-level `@import`.
779
776
  *
780
- * Trade-off of Option A: `@import` inside `@layer` delays style application until
781
- * the remote stylesheet is fetched (same as a plain `<link>`, effectively). Modern
782
- * engines schedule it as a discoverable resource from the inline `<style>` element.
783
- * The performance characteristic is equivalent to the old `<link>` approach.
777
+ * Browser support: Chrome 99+, Firefox 97+, Safari 15.4+ all current engines.
778
+ *
779
+ * Alternative approaches rejected:
780
+ * - Fetch+inline: relative `url(...)` paths inside the remote CSS would
781
+ * resolve against the shell origin instead of the remote origin, breaking
782
+ * fonts and images. Dealbreaker without a full URL-rewrite pass.
783
+ * - `<link layer="remote">`: the `layer` attribute on `<link>` is not yet
784
+ * shipped in Firefox (as of 2025-05). Non-portable.
784
785
  *
785
786
  * Layer order declaration
786
787
  * -----------------------
@@ -896,7 +897,7 @@ async function _discoverStylesheetHref(remoteBaseUrl) {
896
897
  *
897
898
  * Injection shape:
898
899
  * <style data-fly-app="<appId>" data-fly-href="<href>">
899
- * @layer remote { @import url("<href>"); }
900
+ * @import url("<href>") layer(remote);
900
901
  * </style>
901
902
  *
902
903
  * The `data-fly-href` attribute stores the discovered href separately from the
@@ -934,12 +935,14 @@ async function loadRemoteStyles(appId, remoteBaseUrl) {
934
935
  // Hot upgrade: replace the entire element so the @import URL updates atomically.
935
936
  existing.remove();
936
937
  }
937
- // Option A: inline <style> with @layer remote { @import url("..."); }.
938
- // See module JSDoc for the rationale over Options B and C.
938
+ // CSS Cascade Level 5: `@import url("") layer(remote)` is the only valid
939
+ // way to place an @import inside a named cascade layer. Block-form
940
+ // `@layer remote { @import … }` is invalid and silently dropped by browsers.
941
+ // See module JSDoc for full rationale.
939
942
  const style = document.createElement('style');
940
943
  style.setAttribute('data-fly-app', appId);
941
944
  style.setAttribute('data-fly-href', href);
942
- style.textContent = `@layer remote { @import url("${href}"); }`;
945
+ style.textContent = `@import url("${href}") layer(remote);`;
943
946
  document.head.appendChild(style);
944
947
  }
945
948
  /**