mnfst 0.5.292 → 0.5.293

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  (function () {
4
4
 
5
- const MANIFEST_BUILD_VERSION = '0.5.292';
5
+ const MANIFEST_BUILD_VERSION = '0.5.293';
6
6
 
7
7
  /* Manifest Data Sources - Appwrite Integration */
8
8
 
@@ -663,15 +663,40 @@ window.ManifestComponentsRouting = (function () {
663
663
  return settled;
664
664
  }
665
665
 
666
- // Same condition grammar as route visibility: comma list, ! negates
666
+ // The router's own element matcher; memo is per pass (path fixed)
667
+ function pass(path) {
668
+ const vis = window.ManifestRoutingVisibility;
669
+ const memo = new Map();
670
+ let defined;
671
+ const definedFor = () => {
672
+ if (defined === undefined) defined = vis.routesDefined ? !!vis.routesDefined(path) : undefined;
673
+ return defined;
674
+ };
675
+ return function active(el) {
676
+ let hit = memo.get(el);
677
+ if (hit !== undefined) return hit;
678
+ if (vis && vis.routeMatches) {
679
+ const cond = el.getAttribute('x-route') || '';
680
+ hit = vis.routeMatches(el, path, cond.includes('!*') ? definedFor() : undefined) !== false;
681
+ } else {
682
+ // Router predating the export: its condition matcher, comma list and ! only
683
+ const routing = window.ManifestRouting;
684
+ const conds = (el.getAttribute('x-route') || '').split(',').map(c => c.trim()).filter(Boolean);
685
+ const pos = conds.filter(c => !c.startsWith('!'));
686
+ hit = !conds.some(c => c.startsWith('!') && routing.matchesCondition(path, c.slice(1))) &&
687
+ (pos.length === 0 || pos.some(c => routing.matchesCondition(path, c)));
688
+ }
689
+ memo.set(el, hit);
690
+ return hit;
691
+ };
692
+ }
693
+
694
+ // A route string checked as if on an element (reverts know only the string)
667
695
  function matches(xRoute, path) {
668
- const routing = window.ManifestRouting;
669
- if (!xRoute || !routing) return true;
670
- const conditions = xRoute.split(',').map(c => c.trim()).filter(Boolean);
671
- const positive = conditions.filter(c => !c.startsWith('!'));
672
- const negative = conditions.filter(c => c.startsWith('!')).map(c => c.slice(1));
673
- if (negative.some(c => routing.matchesCondition(path, c))) return false;
674
- return positive.length === 0 || positive.some(c => routing.matchesCondition(path, c));
696
+ if (!xRoute || !window.ManifestRouting) return true;
697
+ const probe = document.createElement('div');
698
+ probe.setAttribute('x-route', xRoute);
699
+ return pass(path)(probe);
675
700
  }
676
701
 
677
702
  // One swapping pass once the router settles, for every placeholder deferred meanwhile
@@ -687,22 +712,35 @@ window.ManifestComponentsRouting = (function () {
687
712
  });
688
713
  }
689
714
 
715
+ // Logical route (router base stripped), as route visibility reads it
690
716
  function currentPath() {
691
- const p = window.location.pathname;
717
+ const p = window.ManifestRoutingNavigation?.getCurrentRoute?.() ?? window.location.pathname;
692
718
  return p === '/' ? '/' : p.replace(/^\/+|\/+$/g, '');
693
719
  }
694
720
 
695
- // 'swap' | 'skip' | 'defer' for a placeholder at a path
696
- function decide(el, path) {
697
- const xRoute = el.getAttribute('x-route');
698
- if (!xRoute) return 'swap';
699
- if (window.ManifestRouting) return matches(xRoute, path ?? currentPath()) ? 'swap' : 'skip';
700
- if (!pending()) return 'swap';
701
- rerunWhenSettled();
702
- return 'defer';
721
+ // 'swap' | 'skip' | 'defer': own x-route and every x-route ancestor must be active.
722
+ // Reuse one gate(path) across a pass so ancestors are matched once.
723
+ function gate(path) {
724
+ let active = null;
725
+ return function decide(el) {
726
+ let n = el.closest('[x-route]');
727
+ if (!n) return 'swap';
728
+ if (!window.ManifestRouting) {
729
+ if (!pending()) return 'swap';
730
+ rerunWhenSettled();
731
+ return 'defer';
732
+ }
733
+ if (!active) active = pass(path ?? currentPath());
734
+ for (; n; n = n.parentElement && n.parentElement.closest('[x-route]')) {
735
+ if (!active(n)) return 'skip';
736
+ }
737
+ return 'swap';
738
+ };
703
739
  }
704
740
 
705
- return { pending, whenSettled, matches, decide };
741
+ const decide = (el, path) => gate(path)(el);
742
+
743
+ return { pending, whenSettled, matches, gate, decide, currentPath };
706
744
  })();
707
745
 
708
746
 
@@ -831,14 +869,8 @@ window.ManifestComponentsRouting = (function () {
831
869
  }
832
870
  const gate = window.ManifestComponentsRouting;
833
871
 
834
- // Use normalized path from event if provided, otherwise compute from window.location
835
- let normalizedPath;
836
- if (normalizedPathFromEvent !== null) {
837
- normalizedPath = normalizedPathFromEvent;
838
- } else {
839
- const currentPath = window.location.pathname;
840
- normalizedPath = currentPath === '/' ? '/' : currentPath.replace(/^\/|\/$/g, '');
841
- }
872
+ // Event path, or null: the gate reads the router's route when it decides (the router may land mid-pass)
873
+ const eventPath = normalizedPathFromEvent ?? undefined;
842
874
 
843
875
  const placeholders = Array.from(document.querySelectorAll('*')).filter(el =>
844
876
  el.tagName.toLowerCase().startsWith('x-') &&
@@ -849,9 +881,10 @@ window.ManifestComponentsRouting = (function () {
849
881
  if (window.ManifestRouting) {
850
882
  for (const instanceId of Array.from(swappedInstances)) {
851
883
  const xRoute = instanceRouteMap.get(instanceId);
852
- if (xRoute && !gate.matches(xRoute, normalizedPath)) this.revert(instanceId);
884
+ if (xRoute && !gate.matches(xRoute, eventPath ?? gate.currentPath())) this.revert(instanceId);
853
885
  }
854
886
  }
887
+ const decide = gate.gate(eventPath);
855
888
  // Second pass: swap in matches. Routing is read per placeholder: it may arrive mid-pass.
856
889
  for (const placeholder of placeholders) {
857
890
  const name = placeholder.tagName.toLowerCase().replace('x-', '');
@@ -861,7 +894,7 @@ window.ManifestComponentsRouting = (function () {
861
894
  placeholder.setAttribute('data-component', instanceId);
862
895
  }
863
896
  // 'defer' queues a re-run for when the router settles
864
- if (gate.decide(placeholder, normalizedPath) === 'swap') await this.swapIn(placeholder);
897
+ if (decide(placeholder) === 'swap') await this.swapIn(placeholder);
865
898
  }
866
899
  },
867
900
  // Public entry point. Coalesces overlapping calls: while a run is active,
@@ -927,8 +960,9 @@ window.ManifestComponentsMutation = {
927
960
  !el.hasAttribute('data-pre-rendered') &&
928
961
  !el.hasAttribute('data-processed')
929
962
  );
963
+ const decide = gate.gate();
930
964
  for (const el of placeholders) {
931
- if (gate.decide(el) !== 'swap') continue;
965
+ if (decide(el) !== 'swap') continue;
932
966
  await processor.processComponent(el);
933
967
  }
934
968
  },
@@ -942,16 +976,17 @@ window.ManifestComponentsMutation = {
942
976
  !el.hasAttribute('data-pre-rendered') && !el.hasAttribute('data-processed');
943
977
  // Mutation observer for new placeholders
944
978
  const observer = new MutationObserver(async mutations => {
979
+ const decide = gate.gate();
945
980
  for (const mutation of mutations) {
946
981
  for (const node of mutation.addedNodes) {
947
982
  if (node.nodeType !== 1) continue;
948
- if (isPlaceholder(node) && gate.decide(node) === 'swap') {
983
+ if (isPlaceholder(node) && decide(node) === 'swap') {
949
984
  await processor.processComponent(node);
950
985
  }
951
986
  // Also check for any <x-*> descendants
952
987
  const descendants = Array.from(node.querySelectorAll('*')).filter(isPlaceholder);
953
988
  for (const el of descendants) {
954
- if (gate.decide(el) !== 'swap') continue;
989
+ if (decide(el) !== 'swap') continue;
955
990
  await processor.processComponent(el);
956
991
  }
957
992
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  (function () {
4
4
 
5
- const MANIFEST_BUILD_VERSION = '0.5.292';
5
+ const MANIFEST_BUILD_VERSION = '0.5.293';
6
6
 
7
7
  /* Manifest Data Sources - Configuration */
8
8
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest.appwrite.auth.js": "sha384-gWLSeVPqCLMiUZB8MU7GqMg3x2yULFUsp8nTTZrPp/9Dlkix42rBn9yIimvwrHqZ",
3
- "manifest.appwrite.data.js": "sha384-oNZ+lin9wI5/jzB3v244kwSp6w6xGEo0NgGe8MTzc5PjWkwNESr3nlF3HTl2doWd",
3
+ "manifest.appwrite.data.js": "sha384-0E/Yzi22qXISJBiU9WW1T221NbxCR5FZCNcvG4G71gAe2xWgf+ArI+bvGgS0B/mv",
4
4
  "manifest.appwrite.presences.js": "sha384-LINPhIPTCK+rA8zd+HPUzMSEgH6Sl2vQMEyItT97bnEE2FYGYKqjXX+CWdt6nl9z",
5
5
  "manifest.bindings.js": "sha384-lPtMf8Ykaic9gNVZKq8Scia1881ZeMAyxer3WCIkUNwwrgzGBWto1OXADUwjvORF",
6
6
  "manifest.charts.js": "sha384-AFbP7mQnigy7DU1s+YE30yKTeQAKfgNazhbfSNbfd9ZpLgeulZKaPi/fAq3gJHDO",
@@ -9,9 +9,9 @@
9
9
  "manifest.color.js": "sha384-tLmmr7KwPIjznXr2tJfJtuAOV9pohdr+Ojj4L4BaOZ8WngCNOPUp27Dfz47YqU2R",
10
10
  "manifest.colorpicker.js": "sha384-P+Zx0QzhMGfku8s3yEskTte4/iXCGVX3zdhu42IGNfFcSmhOW+nqVK7w+uczWRGY",
11
11
  "manifest.combobox.js": "sha384-/lJo6vaxKjgnBSRs/dzkhK1dzGk3GBw8FISoNJZB70mwAVwu1k5veZyBXjOb4keS",
12
- "manifest.components.js": "sha384-3kjiDSDrxJtdtqMpWKj7pl9RYKlY/S/yn9NHtrdP8NUDZdP2kvyeaHWdZ0kP/dzB",
12
+ "manifest.components.js": "sha384-7lu4Nw2GqpAUn63c3gYEvgfM58PYsdoPv3wzqPQfZ5bravqOY/lfE8HFKHsKflQj",
13
13
  "manifest.computed.js": "sha384-GYML/e81gQfN+iDbqhPUgny8bINCyL+SrbTofoGk4hlCnLLjv51mCv42JMqq+ku5",
14
- "manifest.data.js": "sha384-j/CI2i6V4EnD28/TKyq1fPB0E/pBpHO/emT9/0RHjiOxttaON7yc57oCclMZFxmb",
14
+ "manifest.data.js": "sha384-C56SScwt4+3951hiFRRlPZyrCYcNs7kDPNVgFQzf5+LZJ7ze3gl1ODNYQwFahHNY",
15
15
  "manifest.datepicker.js": "sha384-EzlMwvIxlla/0BuyhAEqxN0M8TGcWIWgEIg840V0akKQQK1uY648wPWMkobvtq/o",
16
16
  "manifest.defer.js": "sha384-PRp7+dCZHnnl55rX2xrHutLrQnszHo7o5o9Tq28M/yjLZPuXDzcwQNxCdvbtCYSz",
17
17
  "manifest.device.js": "sha384-YeQaS56L8IILqrQNBSeAOLwIh5DuAOrE60cYLK1+46qJtUrXlAvqGe2j5mbV4Vq7",
@@ -24,12 +24,12 @@
24
24
  "manifest.native.js": "sha384-YeQaS56L8IILqrQNBSeAOLwIh5DuAOrE60cYLK1+46qJtUrXlAvqGe2j5mbV4Vq7",
25
25
  "manifest.payments.js": "sha384-p10n6EHBWFKVW9KhI2A+RpkwqrwD068D+wvOJ7D3Gklz1MvmIlqv1lLG1R0cUqbw",
26
26
  "manifest.rich.text.js": "sha384-ZBV9jXmu2nmprEHicddRE/m7nR4RPZtVc969Jte0+EJYBcVph7itkjcgN/61PyeC",
27
- "manifest.router.js": "sha384-C+3jwRS+kxSZ0wQDtZ5NvOqcFaXrC4uevIzamHUuxgGcmtDcCRCZnMK53lFkClM9",
27
+ "manifest.router.js": "sha384-Em8/J9eY7KCqYilu85zgfhtkExWBMn51+P9HnIRYG4/g6FM0e99gRzFEOn4ngwIa",
28
28
  "manifest.slides.js": "sha384-3uRTkyK9XPLmnxI2+igZlpi4EyPlU/7IHj5j3BZJJ2KN455vXyk99fiXV3feO/XY",
29
29
  "manifest.status.js": "sha384-ofu7nBnVIGZ1U1o2R9d2H3V8aEMPUCVbl5FO3gIToXqi0oa36fTviEdh5UU7Kitw",
30
30
  "manifest.submissions.js": "sha384-v9eS47ytAfTGIKAyVnbd0QWegucVS7yduvigqfsxxoqXmbaEoy0M2y+BiI4xeZBd",
31
31
  "manifest.svg.js": "sha384-qr/8H9+2cIhSXNbRWRtIdrDlTOxKlNJqwEefHvCYoiBNW/kKhPTFa109Orv/EBnb",
32
- "manifest.sw.js": "sha384-vZlT026s96VLf4+v38pNX9fnfuANMQbGlgSYnMKWNdzRCXNwaKBgDxbrivu3SVdE",
32
+ "manifest.sw.js": "sha384-p8Rlt/o2cOPzgeSnTbLKyh3iC9VHw+CwkiTn4pcmuIsQV3yyncLd9NmWAju4fEkr",
33
33
  "manifest.tabs.js": "sha384-otU09H7jnawVKQdLAYpMCd3jx00tgyPVr42D2hLIBzN5dG4se505YesavdnMqEi1",
34
34
  "manifest.tailwind.js": "sha384-yuP3LEvWU+QVjxjkZ0YhErtC9RrGmhOmHjjFjhS9obqZbp5/KTIEnSR0CXDvHE0B",
35
35
  "manifest.toasts.js": "sha384-UpOz9fAdGeGUhL0NamBg5iPepEfIy73p9HYdcxfOQC5b7CVsl7Our0skdZzaLNcC",
@@ -898,7 +898,10 @@ window.ManifestRoutingVisibility = {
898
898
  initialize: initializeVisibility,
899
899
  processRouteVisibility,
900
900
  isRouteActive,
901
- isPrerenderedStaticMPA
901
+ isPrerenderedStaticMPA,
902
+ // Raw match for other plugins (components gate): no static-MPA shortcut
903
+ routeMatches,
904
+ routesDefined: (normalizedPath) => isRouteDefined(normalizedPath, collectDefinedRoutes())
902
905
  };
903
906
 
904
907
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  // Build stamps the published version here; unstamped (dev) falls back to the
18
18
  // registration URL's `v`, then 'dev'.
19
- const BUILD_VERSION = '0.5.292';
19
+ const BUILD_VERSION = '0.5.293';
20
20
  const CACHE_PREFIX = 'mnfst-sw:';
21
21
  const META_CACHE = CACHE_PREFIX + 'meta';
22
22
  // Sized to hold a full precache.json warm-up (PRECACHE_MAX_ENTRIES server-side)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.292",
3
+ "version": "0.5.293",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",
@@ -56,6 +56,7 @@
56
56
  "test:e2e:modules": "node tests/e2e/modules.e2e.mjs",
57
57
  "test:e2e:router-xshow": "node tests/e2e/router-xshow.e2e.mjs",
58
58
  "test:e2e:components-router-race": "node tests/e2e/components-router-race.e2e.mjs",
59
+ "test:e2e:components-ancestor-gate": "node tests/e2e/components-ancestor-gate.e2e.mjs",
59
60
  "test:e2e:route-head": "node tests/e2e/route-head.e2e.mjs",
60
61
  "test:e2e:prerender-patch": "node tests/e2e/utilities-prerender-patch.e2e.mjs",
61
62
  "test:e2e:hidden-responsive": "node tests/e2e/utilities-hidden-responsive.e2e.mjs",