mnfst 0.5.207 → 0.5.209

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.207';
5
+ const MANIFEST_BUILD_VERSION = '0.5.209';
6
6
 
7
7
  /* Manifest Data Sources - Appwrite Integration */
8
8
 
@@ -84,6 +84,9 @@ function initializeComboboxPlugin() {
84
84
  // Read options from a source element (datalist/select → option, menu → li)
85
85
  function readOptions(src) {
86
86
  if (!src) return [];
87
+ // Deferred source (x-for not hydrated yet) — render before reading its rows.
88
+ // Deeper fix: resolve labels from the $x data collection instead of DOM rows.
89
+ if (window.ManifestDefer?.isPending(src)) window.ManifestDefer.render(src);
87
90
  if (src.tagName === 'MENU') {
88
91
  return Array.from(src.querySelectorAll('li')).map(li => {
89
92
  const copy = stripClone(li.cloneNode(true));
@@ -165,8 +168,41 @@ function initializeComboboxPlugin() {
165
168
  setTimeout(() => build(el, modifiers, expression || '', cleanup), 0);
166
169
  });
167
170
 
171
+ // Resolve the menu's owning top-layer context fresh, every time — never cache it.
172
+ // A [popover]/dialog ancestor can be mid-restash (manifest.defer's idle prewarm/evict
173
+ // cycle moving a still-closed container's subtree back into its <template> stash)
174
+ // at any point after build(), so the target must be re-read at each attach, not
175
+ // assumed stable from build time.
176
+ // The menu belongs in its field's top-layer context, but that ancestor can be
177
+ // mid-restash (defer moving a closed container's subtree back into its <template>),
178
+ // so re-resolve at every attach — and never attach into a detached tree, or
179
+ // showPopover() throws InvalidStateError and leaves the field dead.
180
+ let warnedDetached = false;
181
+ const attachTarget = (el) => {
182
+ const owner = el.closest('[popover]');
183
+ if (owner && owner.isConnected) return owner;
184
+ if (owner && !warnedDetached) {
185
+ warnedDetached = true;
186
+ console.warn('[Manifest Combobox] the field\'s popover ancestor was detached when its menu was attached; ' +
187
+ 'using document.body so the field keeps working. Please report this with the field id:', el.id || el);
188
+ }
189
+ return document.body;
190
+ };
191
+ const reattach = (el, menu) => {
192
+ const target = attachTarget(el);
193
+ if (menu.parentNode !== target) target.appendChild(menu);
194
+ };
195
+
168
196
  function build(el, modifiers, expression, cleanup) {
169
- if (el.__mnfstCombobox) return;
197
+ if (el.__mnfstCombobox) {
198
+ // Already built. If manifest.defer's idle prewarm/evict cycle raced this very
199
+ // build (stashing the owning [popover] between directive init and the setTimeout
200
+ // below), the generated menu was appended into a since-detached tree — reattach
201
+ // it into wherever the owner lives now. Harmless no-op otherwise.
202
+ const m = el.__mnfstComboboxMenu;
203
+ if (m) reattach(el, m);
204
+ return;
205
+ }
170
206
  el.__mnfstCombobox = true;
171
207
 
172
208
  // If a mount path bypassed the strip (x-if/x-for via Alpine's internal initTree)
@@ -406,8 +442,10 @@ function initializeComboboxPlugin() {
406
442
  }
407
443
  // Nearest popover host, so an outer auto popover isn't light-dismissed
408
444
  // by listbox clicks; body otherwise (out of overflow contexts either way).
409
- (el.closest('[popover]') || document.body).appendChild(menu);
445
+ // Re-resolved (not just attached once) at every open — see reattach().
446
+ reattach(el, menu);
410
447
  generatedMenu = menu; // tracked so cleanup() can remove it on re-render
448
+ el.__mnfstComboboxMenu = menu; // tracked so a re-entrant build() can reattach it
411
449
  if (src) src.style.setProperty('display', 'none', 'important');
412
450
  menu.setAttribute('popover', 'manual');
413
451
  menu.setAttribute('x-defer.off', ''); // options are built here, not by directives
@@ -454,8 +492,24 @@ function initializeComboboxPlugin() {
454
492
 
455
493
  function openMenu() {
456
494
  if (!menu || menu.matches(':popover-open') || atCap()) return;
495
+ // Re-stashed since build (x-defer.discard) — re-hydrate before showing.
496
+ if (src && window.ManifestDefer?.isPending(src)) { options = readOptions(src); setOptions(options); }
497
+ // Lazy re-resolve: the owning [popover]/dialog may have been (re-)stashed and
498
+ // rendered since build(), or build() itself raced a defer restash and attached
499
+ // into a tree that's since gone disconnected. A real open only ever happens
500
+ // once the field itself is genuinely connected/visible, so this always has a
501
+ // valid target.
502
+ reattach(el, menu);
457
503
  menu.style.minWidth = wrap.offsetWidth + 'px';
458
- menu.showPopover();
504
+ try {
505
+ menu.showPopover();
506
+ } catch (_) {
507
+ // Belt-and-suspenders: resolve once more and retry, then give up quietly —
508
+ // an uncaught error here would abort whatever handler called openMenu() and
509
+ // can strand the containing dialog's own dismiss handling mid-flight.
510
+ reattach(el, menu);
511
+ try { menu.showPopover(); } catch (_) { return; }
512
+ }
459
513
  el.setAttribute('aria-expanded', 'true');
460
514
  }
461
515
  function closeMenu() {
@@ -2,7 +2,7 @@
2
2
 
3
3
  (function () {
4
4
 
5
- const MANIFEST_BUILD_VERSION = '0.5.207';
5
+ const MANIFEST_BUILD_VERSION = '0.5.209';
6
6
 
7
7
  /* Manifest Data Sources - Configuration */
8
8
 
@@ -5834,6 +5834,32 @@ if (typeof window !== 'undefined') {
5834
5834
  /* Manifest Data Sources - Route Proxy Creation */
5835
5835
  // Creates proxies for route-specific data lookups ($route() method)
5836
5836
 
5837
+ // Shared revision, read (transparently) by every $route() proxy's get/has trap.
5838
+ // Alpine 3.x scheduler bug: queueJob dedupes by reference against the current
5839
+ // flush's queue array (cleared only at flush end), so if a sibling effect
5840
+ // (e.g. an x-if that also reads a plain store flag) already ran earlier in
5841
+ // the SAME flush, this proxy's own updateReactiveTarget() write later in that
5842
+ // flush can't re-queue it — the re-trigger is silently dropped and the
5843
+ // directive is stranded on stale (often empty) data forever, even though
5844
+ // later reads (e.g. a header's x-text) see the correct value. Bumping this
5845
+ // counter on a fresh macrotask after the proxy settles re-arms anything
5846
+ // dropped, mirroring the data store's bumpAllVersions() post-settle hammer —
5847
+ // but scoped to the $route() reactive graph, which bumpAllVersions() never
5848
+ // touches (it only bumps store._v[source]).
5849
+ let routeProxyVersion = null;
5850
+ function getRouteProxyVersion() {
5851
+ if (!routeProxyVersion) routeProxyVersion = Alpine.reactive ? Alpine.reactive({ n: 0 }) : { n: 0 };
5852
+ return routeProxyVersion;
5853
+ }
5854
+ let routeProxyVersionBumpTimer = null;
5855
+ function scheduleRouteProxyVersionBump() {
5856
+ if (routeProxyVersionBumpTimer) return;
5857
+ routeProxyVersionBumpTimer = setTimeout(() => {
5858
+ routeProxyVersionBumpTimer = null;
5859
+ getRouteProxyVersion().n++;
5860
+ }, 0);
5861
+ }
5862
+
5837
5863
  // Global debounce mechanism shared across all route proxies
5838
5864
  if (!window.ManifestDataRouteProxyUpdateQueue) {
5839
5865
  window.ManifestDataRouteProxyUpdateQueue = {
@@ -5994,6 +6020,11 @@ function createRouteProxy(dataSourceData, pathKey, dataSourceName) {
5994
6020
 
5995
6021
  // Remove timestamp immediately after (it's just to trigger reactivity)
5996
6022
  delete reactiveTarget._timestamp;
6023
+
6024
+ // Post-settle hammer (see getRouteProxyVersion above): a sibling
6025
+ // effect sharing this same flush may have already run before this
6026
+ // write and had its re-trigger dropped by Alpine's scheduler.
6027
+ scheduleRouteProxyVersionBump();
5997
6028
  }
5998
6029
 
5999
6030
  // Initial update to populate reactiveTarget immediately
@@ -6043,6 +6074,11 @@ function createRouteProxy(dataSourceData, pathKey, dataSourceName) {
6043
6074
  const proxy = new Proxy(reactiveTarget, {
6044
6075
  get(target, prop) {
6045
6076
  try {
6077
+ // Transparent dependency on the shared post-settle revision (see
6078
+ // getRouteProxyVersion above) — every reader of this proxy
6079
+ // implicitly re-arms on a bump, no `void` pin required in markup.
6080
+ void getRouteProxyVersion().n;
6081
+
6046
6082
  // CRITICAL: Return value from reactiveTarget, not computed synchronously
6047
6083
  // Alpine tracks property access on reactiveTarget, so when reactiveTarget[prop]
6048
6084
  // changes (via Alpine.effect() updating it), Alpine re-evaluates expressions.
@@ -6066,6 +6102,9 @@ function createRouteProxy(dataSourceData, pathKey, dataSourceName) {
6066
6102
  },
6067
6103
  // Add has trap to help Alpine track property existence
6068
6104
  has(target, prop) {
6105
+ // Same transparent dependency as get() — see getRouteProxyVersion above.
6106
+ void getRouteProxyVersion().n;
6107
+
6069
6108
  // Check reactiveTarget first (which Alpine tracks)
6070
6109
  // This ensures consistency with the get trap
6071
6110
  if (prop in target) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest.appwrite.auth.js": "sha384-HMJmRXnvdDBWyuteXL+DTxWM2llSCdjl4EDamEI7iHNAVlqeOCE4GDTm8ZHipPRj",
3
- "manifest.appwrite.data.js": "sha384-/1T3gJYo2B7Ct4s24VFKgle5LpTdnZ2kWrMReqamsSzUg1nCqwOjS7T8Z/qgJSoV",
3
+ "manifest.appwrite.data.js": "sha384-QPhleLv3IIOHioJFz+aIieAStcvqMApPC68lipDajRqxyym9am6rKFXEkHZTJdGo",
4
4
  "manifest.appwrite.presences.js": "sha384-JyVDWFT69b7Svq8J8p9tNWe2v9PZNQBY5UyhtOl1vnuHFAX0CRQ3MA9SiKq5wzNh",
5
5
  "manifest.bindings.js": "sha384-lPtMf8Ykaic9gNVZKq8Scia1881ZeMAyxer3WCIkUNwwrgzGBWto1OXADUwjvORF",
6
6
  "manifest.charts.js": "sha384-qQrjhWkIDi4oU5uQrpy8DdlMjY+gfiivBuX6mssNiFdkawgkVBvKneGgp+nd3PYJ",
@@ -8,10 +8,10 @@
8
8
  "manifest.code.js": "sha384-aoQ4E26vrhNe/+tL7K0h90c8/0ies7e8oIR6Ay92he2X3dnWZ+OPcn2Dna8fmc+c",
9
9
  "manifest.color.js": "sha384-6Rv3LxyTcZNjrhtayQfqRdCx0uSZ4BiEbgEI98I62eTvp8Aw7LBIoNJ0Je1oktwL",
10
10
  "manifest.colorpicker.js": "sha384-1+ZV5Hhjf7WnGP7b71Cqa5h3BKW8UgGT5V14i8Q+aF5zH8Xxwowt/ibSUVsiIHSm",
11
- "manifest.combobox.js": "sha384-SN3XHumoebxcduFQqx5zt65/Cd10y8nuf9Gkco6UnsZ42sadRd+gvVLfWPdkkuPH",
11
+ "manifest.combobox.js": "sha384-5DaKDWkWF7zxS80h7G1AcZG9hr+uGqJ1+B09aaVIVF+z0Qn4j8+9KEg7gys/ABQG",
12
12
  "manifest.components.js": "sha384-DLGSqCbnGkS87AWJ8GpKoAFP4nCosgC5SFSg6C10hH/nWu/MxI+0ntHlnFEfs++u",
13
13
  "manifest.computed.js": "sha384-GYML/e81gQfN+iDbqhPUgny8bINCyL+SrbTofoGk4hlCnLLjv51mCv42JMqq+ku5",
14
- "manifest.data.js": "sha384-dq1Hp751qrHoMVX1rDGjj09KkiKb3jzrbW6rCMdwzPWKjzoIQT22InmU6QVP0JhO",
14
+ "manifest.data.js": "sha384-YCCrZNKVJGLpTqE8BpI4Co6/vjyOXATVioLdaLSkKQ5oNKTv3ZFN+CqM7lQmObjI",
15
15
  "manifest.datepicker.js": "sha384-8vTJYkLqqvgXgm1w1becuaRR/jUEpiLBjBJ6RsRbUr+ZkypvspD6EsssuDrX4SQq",
16
16
  "manifest.defer.js": "sha384-wXa60M2OHigi5rBurXQ7Oa8eyr5WTKs7EUn2GOru62KMdfs/LDyNegxCc9MNJFSe",
17
17
  "manifest.device.js": "sha384-g+txmrEszYtuOvRelTp/c1wSNR2AtllVI9rx5NPPD7DzhVUnMNughonZykv2xlBW",
@@ -28,7 +28,7 @@
28
28
  "manifest.slides.js": "sha384-3uRTkyK9XPLmnxI2+igZlpi4EyPlU/7IHj5j3BZJJ2KN455vXyk99fiXV3feO/XY",
29
29
  "manifest.status.js": "sha384-nwvUSbT+gpRMqhYx6MeBYswUMH72rY92mjgxv0vrSG7Ht7l83XYpEB6fCTbXjjfK",
30
30
  "manifest.svg.js": "sha384-qr/8H9+2cIhSXNbRWRtIdrDlTOxKlNJqwEefHvCYoiBNW/kKhPTFa109Orv/EBnb",
31
- "manifest.sw.js": "sha384-a4rb/5qNtjrIQEP6oMusHWeJVtWZ9LIXR/uIpBholtH1808et2NibzgtM1GTEpgq",
31
+ "manifest.sw.js": "sha384-rHHARfDDIo3jE+zWkse6dVR1EwdUASiDFvlskzn/KjmhC6mJgtlSfLbL+FhWRLz1",
32
32
  "manifest.tabs.js": "sha384-OIIcyaQnGS0eNYk4zgAFEDboNYect7THvUd9D0V6nqCeDOxQcoiqLrBEmmWVTTet",
33
33
  "manifest.tailwind.js": "sha384-r/Jvqb+Piz21jUts10BbVAJoKkShOdJRVFpywyi4HPIi/OfOJq5CtPyWAPbdkMgt",
34
34
  "manifest.text.edit.js": "sha384-pfhc4IPKNJokj6ldlgD+KwGLN4UoM21CNeVf2sVq/34X1Un2PUhEuyTg5itmtsXS",
@@ -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.207';
19
+ const BUILD_VERSION = '0.5.209';
20
20
  const CACHE_PREFIX = 'mnfst-sw:';
21
21
  const META_CACHE = CACHE_PREFIX + 'meta';
22
22
  const SWR_CAP = 200;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.207",
3
+ "version": "0.5.209",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",