mnfst 0.5.198-next.1 → 0.5.198-next.2

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.
@@ -14,8 +14,23 @@ const killed = !!document.querySelector('script[data-defer="off"]') || window.__
14
14
 
15
15
  const pending = new Set();
16
16
  let ready = false;
17
+ let bootDrained = false;
17
18
  let idleHandle = null;
18
19
 
20
+ // Urgent = mounted after boot, within a gesture window (a pane the user just opened), capped per gesture
21
+ const URGENT_WINDOW_MS = 1500;
22
+ const URGENT_CAP = 8;
23
+ let lastGestureAt = -Infinity;
24
+ let urgentWindowAt = -Infinity;
25
+ let urgentInWindow = 0;
26
+ const now = () => (typeof performance !== 'undefined' && performance.now) ? performance.now() : Date.now();
27
+
28
+ function isUrgent() {
29
+ if (!ready || !bootDrained || now() - lastGestureAt > URGENT_WINDOW_MS) return false;
30
+ if (urgentWindowAt !== lastGestureAt) { urgentWindowAt = lastGestureAt; urgentInWindow = 0; }
31
+ return urgentInWindow++ < URGENT_CAP;
32
+ }
33
+
19
34
  // ---- Detection ----
20
35
 
21
36
  const isPopoverOpen = (el) => { try { return el.matches(':popover-open'); } catch (_) { return false; } };
@@ -87,7 +102,7 @@ function register(el, rule, opts) {
87
102
  lazy: !!(opts && opts.lazy),
88
103
  discard: !!(opts && opts.discard),
89
104
  priority: opts ? opts.priority : 0,
90
- urgent: ready, // mounted after ready → the user just made it appear
105
+ urgent: isUrgent(),
91
106
  rendered: false,
92
107
  cleanup: []
93
108
  };
@@ -181,7 +196,8 @@ function next() {
181
196
  }
182
197
 
183
198
  function schedule() {
184
- if (idleHandle !== null || !ready || pending.size === 0) return;
199
+ if (pending.size === 0) { if (ready) bootDrained = true; return; }
200
+ if (idleHandle !== null || !ready) return;
185
201
  const head = next();
186
202
  idleHandle = idle(() => {
187
203
  idleHandle = null;
@@ -195,6 +211,7 @@ function markReady() {
195
211
  if (ready) return;
196
212
  ready = true;
197
213
  schedule();
214
+ setTimeout(() => { bootDrained = true; }, 5000); // lazy components may keep the boot queue busy
198
215
  }
199
216
 
200
217
  function armReady() {
@@ -227,6 +244,7 @@ function intercept(el, skip) {
227
244
  function initializeDeferPlugin() {
228
245
  Alpine.directive('defer', () => { });
229
246
  if (!killed) Alpine.interceptInit(Alpine.skipDuringClone(intercept));
247
+ ['pointerdown', 'keydown'].forEach((type) => document.addEventListener(type, () => { lastGestureAt = now(); }, { capture: true, passive: true }));
230
248
  armReady();
231
249
  }
232
250
 
@@ -12,7 +12,7 @@
12
12
  "manifest.computed.js": "sha384-LDxER8pyYyYwUxIYIyiJA02s+49g8CzpSlOj28On0DFIUgetT3UmvE/9xOsTwT66",
13
13
  "manifest.data.js": "sha384-urUiANuQfrc+AfwTB7+nMneF2C1+EfV+S5+eg4PQnZCJ0Aid50KwSARufiVrGAXd",
14
14
  "manifest.datepicker.js": "sha384-8vTJYkLqqvgXgm1w1becuaRR/jUEpiLBjBJ6RsRbUr+ZkypvspD6EsssuDrX4SQq",
15
- "manifest.defer.js": "sha384-wjQ3a8ClODUJi4xlBRI03G7qWOF+DN+fJQXyxcp1jekNwrMqbgshR0LSCgkJJUiH",
15
+ "manifest.defer.js": "sha384-IxVROtFvzgYYP/zfSTULfKW9HfUBBu02pjXPfJ/myyKoAU/lj59qFVNq0WAHNLZI",
16
16
  "manifest.dropdowns.js": "sha384-4HuHkBt4i8sTPUDLB9rNLli2/lWLY1tjtCLzey37gRwueG+FRLCnVH1q7ljiVvJR",
17
17
  "manifest.edit.js": "sha384-ZvgV3ax7yHtSC23zdvRYJPzBsBpGFBLuBJMgfQ1IDumv97Cn2bpHOePxyQikfl5L",
18
18
  "manifest.export.js": "sha384-HCy3n6ifrcAGIyzTRgZ5JIRvSX9q9/8ykMKRSbt1QTnhXz6PgYlV0AE2N2Yi2re+",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.198-next.1",
3
+ "version": "0.5.198-next.2",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",