mnfst 0.5.303 → 0.5.305

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.303';
5
+ const MANIFEST_BUILD_VERSION = '0.5.305';
6
6
 
7
7
  /* Manifest Data Sources - Appwrite Integration */
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  (function () {
4
4
 
5
- const MANIFEST_BUILD_VERSION = '0.5.303';
5
+ const MANIFEST_BUILD_VERSION = '0.5.305';
6
6
 
7
7
  /* Manifest Data Sources - Configuration */
8
8
 
@@ -6905,6 +6905,9 @@ function createReactiveFileArrayFromGetter(tableName, entryIdGetter, bucketName,
6905
6905
  entryId = null;
6906
6906
  }
6907
6907
 
6908
+ // Identity ended: the manager was dropped, build one for the new identity
6909
+ if (currentManager?.stale()) currentEntryId = undefined;
6910
+
6908
6911
  // If entryId changed or manager doesn't exist, update manager
6909
6912
  if (entryId !== currentEntryId) {
6910
6913
  currentEntryId = entryId;
@@ -7085,14 +7088,23 @@ function getDefaultBucketForTable(tableName) {
7085
7088
  return null;
7086
7089
  }
7087
7090
 
7091
+ // Identity end: drop every manager read under the previous identity
7092
+ ['manifest:auth:logout', 'manifest:auth:session-cleared', 'manifest:auth:login', 'manifest:auth:anonymous', 'manifest:auth:initialized']
7093
+ .forEach(type => window.addEventListener(type, () => queueMicrotask(() => {
7094
+ for (const manager of [...reactiveFileManagers.values()]) if (manager.stale()) manager.destroy();
7095
+ })));
7096
+
7088
7097
  // Create reactive file array manager for a table/entry/bucket combination
7089
7098
  function createReactiveFileManager(tableName, entryId, bucketName, columnName) {
7090
7099
  const key = `${tableName}:${entryId}:${bucketName}`;
7091
7100
 
7092
- if (reactiveFileManagers.has(key)) {
7093
- const existing = reactiveFileManagers.get(key);
7094
- return existing;
7095
- }
7101
+ const existing = reactiveFileManagers.get(key);
7102
+ if (existing && !existing.stale()) return existing;
7103
+ existing?.destroy();
7104
+
7105
+ // Bound to the identity (epoch + table generation) it was created under
7106
+ const isCurrent = identityGuard(tableName);
7107
+ let destroyed = false;
7096
7108
 
7097
7109
  const files = typeof Alpine !== 'undefined' && Alpine.reactive
7098
7110
  ? Alpine.reactive([])
@@ -7164,8 +7176,10 @@ function createReactiveFileManager(tableName, entryId, bucketName, columnName) {
7164
7176
  tableName,
7165
7177
  entryId,
7166
7178
  storageConfig.bucketId,
7167
- columnName || storageConfig.column
7179
+ columnName || storageConfig.column,
7180
+ { isCurrent }
7168
7181
  );
7182
+ if (destroyed || !isCurrent()) return;
7169
7183
 
7170
7184
  // Update array in place (maintains reactivity)
7171
7185
  files.length = 0;
@@ -7185,7 +7199,7 @@ function createReactiveFileManager(tableName, entryId, bucketName, columnName) {
7185
7199
  error = err.message || String(err);
7186
7200
  } finally {
7187
7201
  loading = false;
7188
- if (reloadQueued) {
7202
+ if (reloadQueued && !destroyed) {
7189
7203
  reloadQueued = false;
7190
7204
  loadFiles();
7191
7205
  }
@@ -7262,6 +7276,10 @@ function createReactiveFileManager(tableName, entryId, bucketName, columnName) {
7262
7276
 
7263
7277
  const unwatch = Alpine.effect(() => {
7264
7278
  const rows = tableRows();
7279
+ if (!isCurrent()) {
7280
+ queueMicrotask(() => manager.destroy());
7281
+ return;
7282
+ }
7265
7283
  if (Array.isArray(rows)) {
7266
7284
  const entry = rows.find(item => item.$id === entryId);
7267
7285
  if (entry) {
@@ -7323,10 +7341,16 @@ function createReactiveFileManager(tableName, entryId, bucketName, columnName) {
7323
7341
  loading: () => loading,
7324
7342
  error: () => error,
7325
7343
  reload: loadFiles,
7344
+ stale: () => destroyed || !isCurrent(),
7326
7345
  destroy: () => {
7346
+ if (destroyed) return;
7347
+ destroyed = true;
7327
7348
  reloadQueued = false;
7349
+ error = null;
7328
7350
  unsubscribeCallbacks.forEach(cb => cb());
7329
- reactiveFileManagers.delete(key);
7351
+ unsubscribeCallbacks = [];
7352
+ if (reactiveFileManagers.get(key) === manager) reactiveFileManagers.delete(key);
7353
+ files.length = 0;
7330
7354
  }
7331
7355
  };
7332
7356
 
@@ -398,7 +398,7 @@
398
398
  // Write the value out to: x-model, hidden input, and the field display.
399
399
  // Model shape: single → ISO string ('yyyy-mm-dd' or '…THH:mm');
400
400
  // range → { start, end }; multiple → ISO[]; time-only → 'HH:mm'.
401
- syncOut() {
401
+ syncOut(writeModel = true) {
402
402
  let modelVal, hiddenVal;
403
403
  if (this.selectionMode === 'range') {
404
404
  const s = this.rangeStart ? D.toISO(this.rangeStart) : '', e = this.rangeEnd ? D.toISO(this.rangeEnd) : '';
@@ -411,7 +411,7 @@
411
411
  const iso = this._primaryValue();
412
412
  modelVal = iso; hiddenVal = iso;
413
413
  }
414
- if (this.modelSet) { try { this.modelSet(modelVal); } catch (_) { } }
414
+ if (writeModel && this.modelSet) { try { this.modelSet(modelVal); } catch (_) { } }
415
415
  if (this.hiddenInput) {
416
416
  this.hiddenInput.value = hiddenVal;
417
417
  this.hiddenInput.dispatchEvent(new Event('input', { bubbles: true }));
@@ -431,6 +431,36 @@
431
431
  }
432
432
  },
433
433
 
434
+ // Mirror an external model value; anything unparseable is empty. Returns true if the selection changed.
435
+ applyModel(v) {
436
+ const prev = this._primaryValue();
437
+ if (v instanceof Date) v = D.toISO(v);
438
+ if (this.timeOnly) {
439
+ const m = typeof v === 'string' && v.match(/^(\d{2}):(\d{2})/);
440
+ if (m) { this.time = m[1] + ':' + m[2]; this.timeSet = true; } else this.timeSet = false;
441
+ } else if (this.selectionMode === 'range') {
442
+ let s = '', e = '';
443
+ if (v && typeof v === 'object' && !Array.isArray(v)) { s = v.start; e = v.end; }
444
+ else if (typeof v === 'string') [s, e] = v.split('/');
445
+ this.rangeStart = D.fromISO(s); this.rangeEnd = this.rangeStart ? D.fromISO(e) : null;
446
+ } else if (this.selectionMode === 'multiple') {
447
+ const arr = Array.isArray(v) ? v : (typeof v === 'string' && v ? v.split(',') : []);
448
+ this.selectedDates = arr.map(x => D.fromISO(x)).filter(Boolean).sort((a, b) => D.compare(a, b));
449
+ } else {
450
+ const iso = typeof v === 'string' ? v : '';
451
+ const tm = iso.match(/T(\d{2}:\d{2})/);
452
+ if (tm) { this.time = tm[1]; this.timeSet = true; }
453
+ this.selected = D.fromISO(iso);
454
+ }
455
+ if (this._primaryValue() === prev) return false;
456
+ this.rangeHover = null;
457
+ const first = this.selectionMode === 'range' ? this.rangeStart : this.selectionMode === 'multiple' ? this.selectedDates[0] : this.selected;
458
+ const d = first || D.today();
459
+ this.view = { y: d.getFullYear(), m: d.getMonth() + 1 };
460
+ if (!this._primaryValue()) this.close();
461
+ return true;
462
+ },
463
+
434
464
  // Pull an initial value from x-model, then hidden input, then value attr.
435
465
  seed() {
436
466
  let raw;
@@ -1026,7 +1056,8 @@
1026
1056
  const first = state._uiKey === undefined;
1027
1057
  state._uiKey = key;
1028
1058
  if (state._destroyed || first) return; // initial render happens at mount
1029
- if (state._mounted) { state.render(); state.syncOut(); }
1059
+ // Display only: the model holds ISO, which a locale change never alters.
1060
+ if (state._mounted) { state.render(); state.syncOut(false); }
1030
1061
  }));
1031
1062
  }
1032
1063
 
@@ -1034,8 +1065,8 @@
1034
1065
  const read = Alpine.evaluateLater(el, modelExpr);
1035
1066
  state.modelGet = (cb) => { let out; read(v => { out = v; if (cb) cb(v); }); return out; };
1036
1067
  state.modelSet = (v) => { try { Alpine.evaluate(el, `${modelExpr} = ${JSON.stringify(v)}`); } catch (_) { } };
1037
- // React to external model changes; syncOut writes the same value back (no loop).
1038
- state._effects.push(Alpine.effect(() => { read(v => { const iso = (v instanceof Date) ? D.toISO(v) : v; const cur = state._primaryValue(); if (typeof iso === 'string' && iso !== cur) { const tm = iso.match(/T(\d{2}:\d{2})/); if (tm) state.time = tm[1]; const d = D.fromISO(iso); state.selected = d; if (d) state.view = { y: d.getFullYear(), m: d.getMonth() + 1 }; state.bump(); if (state._mounted) { state.render(); state.syncOut(); } } }); }));
1068
+ // Mirror external model changes; never write back (the model already holds the value).
1069
+ state._effects.push(Alpine.effect(() => { read(v => { if (!state.applyModel(v)) return; state.bump(); if (state._mounted) { state.render(); state.syncOut(false); } }); }));
1039
1070
  }
1040
1071
 
1041
1072
  // Global effects stay subscribed to the stores (and pin the calendar) until released.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "manifest.appwrite.auth.js": "sha384-gWLSeVPqCLMiUZB8MU7GqMg3x2yULFUsp8nTTZrPp/9Dlkix42rBn9yIimvwrHqZ",
3
- "manifest.appwrite.data.js": "sha384-hAe/fSjTXXmwo8lHNtWkWCqlOe6ArPFEBDAfXcdrsgGapMp7/HAK7sEkcb/TUxDm",
3
+ "manifest.appwrite.data.js": "sha384-PBkv+zl3E9NrLkkXiKpG4qKPldGYP8rzywaMPcfbbtSwYBUzVzs8lCIbxLVzYBKV",
4
4
  "manifest.appwrite.presences.js": "sha384-LINPhIPTCK+rA8zd+HPUzMSEgH6Sl2vQMEyItT97bnEE2FYGYKqjXX+CWdt6nl9z",
5
5
  "manifest.bindings.js": "sha384-lPtMf8Ykaic9gNVZKq8Scia1881ZeMAyxer3WCIkUNwwrgzGBWto1OXADUwjvORF",
6
6
  "manifest.charts.js": "sha384-BnTxO3ncLxg82aV+64tQMS3ssN+RKZ69Dic6Oruz0pw+/UIK2MAZicg8+ooHF2ZA",
@@ -11,8 +11,8 @@
11
11
  "manifest.combobox.js": "sha384-/lJo6vaxKjgnBSRs/dzkhK1dzGk3GBw8FISoNJZB70mwAVwu1k5veZyBXjOb4keS",
12
12
  "manifest.components.js": "sha384-t2qgBbcGPMoTYpMffOHW2dM07UWIq3pU3PYqLGrS6QP2hzCer4ofgaIKA+7hW558",
13
13
  "manifest.computed.js": "sha384-GYML/e81gQfN+iDbqhPUgny8bINCyL+SrbTofoGk4hlCnLLjv51mCv42JMqq+ku5",
14
- "manifest.data.js": "sha384-9+SGmF9k+igY2kMZBX5LbNZgqbnSbs6xxyvFZO7oF9gMM+PAgJL5dMP8P87pkPdM",
15
- "manifest.datepicker.js": "sha384-EzlMwvIxlla/0BuyhAEqxN0M8TGcWIWgEIg840V0akKQQK1uY648wPWMkobvtq/o",
14
+ "manifest.data.js": "sha384-YKgK/EG2RQGLeh6o0sQR/yn2rPZA4Obsm+L4SSIR0gca3q4AEnjV8ZAf/XSMZ42H",
15
+ "manifest.datepicker.js": "sha384-pZUQhUK6u5cl6g0myBXND/Wtrs1RTovYmy/ETQLUV0JujvTvUdRNc/XjPpVhtK16",
16
16
  "manifest.defer.js": "sha384-PRp7+dCZHnnl55rX2xrHutLrQnszHo7o5o9Tq28M/yjLZPuXDzcwQNxCdvbtCYSz",
17
17
  "manifest.device.js": "sha384-YeQaS56L8IILqrQNBSeAOLwIh5DuAOrE60cYLK1+46qJtUrXlAvqGe2j5mbV4Vq7",
18
18
  "manifest.dropdowns.js": "sha384-TlFrYVWTXvpUmGnYaAk2til4lu0p6w5YcmWWEzZAokzd2qlmoyRLLXXVuYAK/AlR",
@@ -29,7 +29,7 @@
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-WwO67T+4OdbAXUV6DkZ8JXOicDKYpN4axrVmrubvcPxk75vOfJJgPxd1iDctdJu7",
32
+ "manifest.sw.js": "sha384-zg5+CL1zzB9cgRpdoifSAEUIIVX2UTOjG/9Znoe34BYzHUQNo1Hv5wk3ZPVPDuaA",
33
33
  "manifest.tabs.js": "sha384-otU09H7jnawVKQdLAYpMCd3jx00tgyPVr42D2hLIBzN5dG4se505YesavdnMqEi1",
34
34
  "manifest.tailwind.js": "sha384-yuP3LEvWU+QVjxjkZ0YhErtC9RrGmhOmHjjFjhS9obqZbp5/KTIEnSR0CXDvHE0B",
35
35
  "manifest.toasts.js": "sha384-UpOz9fAdGeGUhL0NamBg5iPepEfIy73p9HYdcxfOQC5b7CVsl7Our0skdZzaLNcC",
@@ -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.303';
19
+ const BUILD_VERSION = '0.5.305';
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.303",
3
+ "version": "0.5.305",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",