gyosjs 0.4.0 → 0.5.0

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.
package/dist/gyos.csp.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * GyosJS v0.4.0
2
+ * GyosJS v0.5.0
3
3
  * (c) 2026
4
4
  * @license MIT
5
5
  */
@@ -6852,10 +6852,35 @@
6852
6852
  * count.value++; // Triggers effect
6853
6853
  * ```
6854
6854
  */
6855
- /**
6856
- * Current effect being tracked
6857
- */
6858
6855
  let currentEffect = null;
6856
+ function track(source) {
6857
+ if (!currentEffect)
6858
+ return;
6859
+ source.subscribers.add(currentEffect);
6860
+ currentEffect.__dependencies?.add(source.subscribers);
6861
+ currentEffect.__versions?.set(source, source.version);
6862
+ }
6863
+ function dependenciesChanged(versions) {
6864
+ return untrack(() => {
6865
+ for (const [source, version] of versions) {
6866
+ source.refresh?.();
6867
+ if (source.version !== version)
6868
+ return true;
6869
+ }
6870
+ return false;
6871
+ });
6872
+ }
6873
+ // Invalidate derived caches synchronously; only user effects are deferred.
6874
+ function notifySubscribers(subscribers) {
6875
+ for (const sub of Array.from(subscribers)) {
6876
+ if (sub.__invalidate)
6877
+ sub();
6878
+ else if (isBatching)
6879
+ batchedEffects.add(sub);
6880
+ else
6881
+ queueEffect(sub);
6882
+ }
6883
+ }
6859
6884
  // Simple counter for debug-friendly IDs
6860
6885
  let signalIdCounter = 0;
6861
6886
  const WARN_SUBSCRIBERS = () => typeof window !== 'undefined' && window.GYOS_DEBUG_WARN_SUBSCRIBERS;
@@ -6893,6 +6918,9 @@
6893
6918
  }
6894
6919
  });
6895
6920
  isFlushingQueue = false;
6921
+ // A plain subscribe callback can enqueue more work without entering effect().
6922
+ if (effectQueue.size > 0)
6923
+ queueMicrotask(flushEffectQueue);
6896
6924
  }
6897
6925
  /**
6898
6926
  * Queue an effect for execution in next microtask
@@ -6951,17 +6979,14 @@
6951
6979
  const debugId = ++signalIdCounter;
6952
6980
  let value = initialValue;
6953
6981
  const subscribers = new Set();
6982
+ const source = { subscribers, version: 0 };
6954
6983
  let warnedSubscribers = false;
6955
6984
  const read = () => {
6956
6985
  // Track dependency
6957
6986
  if (currentEffect) {
6958
- // IMPORTANT: Only add if not already subscribed (prevent duplicates)
6959
- if (!subscribers.has(currentEffect)) {
6960
- subscribers.add(currentEffect);
6961
- // Store the subscribers Set in the effect's dependencies for cleanup
6962
- if (currentEffect.__dependencies) {
6963
- currentEffect.__dependencies.add(subscribers);
6964
- }
6987
+ const wasSubscribed = subscribers.has(currentEffect);
6988
+ track(source);
6989
+ if (!wasSubscribed) {
6965
6990
  if (DEBUG_VERBOSE()) {
6966
6991
  console.log('[Signal]', formatDebugLabel(debugId, debugLabel), 'Added subscriber, total:', subscribers.size);
6967
6992
  }
@@ -6980,18 +7005,13 @@
6980
7005
  // For objects/arrays, check if it's actually the same reference
6981
7006
  // Deep equality is expensive, let user handle it
6982
7007
  value = newValue;
7008
+ source.version++;
6983
7009
  DEBUG_VERBOSE() && console.log('[Signal]', formatDebugLabel(debugId, debugLabel), 'Value changed to:', newValue);
6984
7010
  notify();
6985
7011
  };
6986
7012
  const notify = () => {
6987
7013
  DEBUG_VERBOSE() && console.log('[Signal]', formatDebugLabel(debugId, debugLabel), 'Notifying', subscribers.size, 'subscribers');
6988
- if (isBatching) {
6989
- subscribers.forEach(sub => batchedEffects.add(sub));
6990
- }
6991
- else {
6992
- // Always queue effects to prevent cascading updates
6993
- subscribers.forEach(sub => queueEffect(sub));
6994
- }
7014
+ notifySubscribers(subscribers);
6995
7015
  };
6996
7016
  // Create callable signal (like Angular/SolidJS)
6997
7017
  // Call without args = read, call with arg = write
@@ -7026,8 +7046,16 @@
7026
7046
  },
7027
7047
  subscribe: {
7028
7048
  value: function (fn) {
7029
- subscribers.add(fn);
7030
- return () => subscribers.delete(fn);
7049
+ let active = true;
7050
+ const callback = () => { if (active)
7051
+ untrack(fn); };
7052
+ subscribers.add(callback);
7053
+ return () => {
7054
+ active = false;
7055
+ subscribers.delete(callback);
7056
+ effectQueue.delete(callback);
7057
+ batchedEffects.delete(callback);
7058
+ };
7031
7059
  },
7032
7060
  enumerable: true,
7033
7061
  configurable: true
@@ -7087,49 +7115,60 @@
7087
7115
  let value;
7088
7116
  let isDirty = true;
7089
7117
  let isFirstRun = true;
7118
+ let computing = false;
7090
7119
  const subscribers = new Set();
7091
- let cleanup;
7120
+ const dependencies = new Set();
7121
+ const versions = new Map();
7122
+ const source = { subscribers, version: 0, refresh: () => compute() };
7123
+ const invalidate = () => {
7124
+ // A later batched write must also move already queued consumers into
7125
+ // the batch, even when an earlier ordinary write dirtied this cache.
7126
+ if (isDirty && !isBatching)
7127
+ return;
7128
+ isDirty = true;
7129
+ notifySubscribers(subscribers);
7130
+ };
7131
+ invalidate.__invalidate = true;
7132
+ invalidate.__dependencies = dependencies;
7133
+ invalidate.__versions = versions;
7092
7134
  const compute = () => {
7093
7135
  if (!isDirty && !isFirstRun)
7094
7136
  return;
7095
- // Cleanup previous dependencies
7096
- if (cleanup)
7097
- cleanup();
7098
- // Track dependencies in an effect
7099
- cleanup = effect(() => {
7100
- try {
7101
- const newValue = fn();
7102
- // Only update if changed
7103
- if (isFirstRun || value !== newValue) {
7104
- value = newValue;
7105
- isFirstRun = false;
7106
- isDirty = false;
7107
- // Notify subscribers
7108
- if (!isBatching) {
7109
- subscribers.forEach(sub => queueEffect(sub));
7110
- }
7111
- else {
7112
- subscribers.forEach(sub => batchedEffects.add(sub));
7113
- }
7114
- }
7137
+ if (computing)
7138
+ throw new Error('[Computed] Circular dependency');
7139
+ computing = true;
7140
+ const previousEffect = currentEffect;
7141
+ try {
7142
+ // A dirty upstream computed may still resolve to its previous value.
7143
+ if (!isFirstRun && !dependenciesChanged(versions)) {
7144
+ isDirty = false;
7145
+ return;
7115
7146
  }
7116
- catch (error) {
7117
- console.error('[Computed] Error in computation:', error);
7118
- throw error;
7147
+ dependencies.forEach(dependency => dependency.delete(invalidate));
7148
+ dependencies.clear();
7149
+ versions.clear();
7150
+ currentEffect = invalidate;
7151
+ const nextValue = fn();
7152
+ if (isFirstRun || !Object.is(value, nextValue)) {
7153
+ value = nextValue;
7154
+ source.version++;
7119
7155
  }
7120
- });
7121
- isDirty = false;
7156
+ isFirstRun = false;
7157
+ isDirty = false;
7158
+ }
7159
+ catch (error) {
7160
+ // Preserve error isolation and the last successful value.
7161
+ console.error('[Computed] Error in computation:', error);
7162
+ isDirty = false;
7163
+ }
7164
+ finally {
7165
+ currentEffect = previousEffect;
7166
+ computing = false;
7167
+ }
7122
7168
  };
7123
7169
  const read = () => {
7124
- if (isDirty || isFirstRun)
7125
- compute();
7126
- // Track dependency
7127
- if (currentEffect && !subscribers.has(currentEffect)) {
7128
- subscribers.add(currentEffect);
7129
- if (currentEffect.__dependencies) {
7130
- currentEffect.__dependencies.add(subscribers);
7131
- }
7132
- }
7170
+ compute();
7171
+ track(source);
7133
7172
  return value;
7134
7173
  };
7135
7174
  // Create callable computed (read-only)
@@ -7154,8 +7193,14 @@
7154
7193
  },
7155
7194
  subscribe: {
7156
7195
  value: function (fn) {
7157
- subscribers.add(fn);
7158
- return () => subscribers.delete(fn);
7196
+ // Establish dependencies even if subscribe() is the first access.
7197
+ let first = true;
7198
+ return effect(() => {
7199
+ read();
7200
+ if (!first)
7201
+ untrack(fn);
7202
+ first = false;
7203
+ });
7159
7204
  },
7160
7205
  enumerable: true,
7161
7206
  configurable: true
@@ -7206,11 +7251,15 @@
7206
7251
  */
7207
7252
  function effect(fn) {
7208
7253
  let cleanup;
7209
- let dependencies = new Set();
7254
+ const dependencies = new Set();
7255
+ const versions = new Map();
7210
7256
  let active = true;
7257
+ let initialized = false;
7211
7258
  const execute = () => {
7212
7259
  if (!active)
7213
7260
  return;
7261
+ if (initialized && !dependenciesChanged(versions))
7262
+ return;
7214
7263
  // Prevent recursive execution - if already running, skip
7215
7264
  if (runningEffects.has(execute)) {
7216
7265
  DEBUG() && console.warn('[Effect] Skipped recursive execution');
@@ -7225,10 +7274,13 @@
7225
7274
  });
7226
7275
  DEBUG() && console.log('[Effect] Cleaned up dependencies, count:', dependencies.size);
7227
7276
  dependencies.clear();
7277
+ versions.clear();
7228
7278
  // Clean up previous run
7229
7279
  if (cleanup) {
7280
+ const previousCleanup = cleanup;
7281
+ cleanup = undefined;
7230
7282
  try {
7231
- cleanup();
7283
+ untrack(previousCleanup);
7232
7284
  }
7233
7285
  catch (error) {
7234
7286
  console.error('[Effect] Error in cleanup:', error);
@@ -7239,6 +7291,7 @@
7239
7291
  currentEffect = execute;
7240
7292
  // Store dependencies for cleanup
7241
7293
  execute.__dependencies = dependencies;
7294
+ execute.__versions = versions;
7242
7295
  try {
7243
7296
  const nextCleanup = fn();
7244
7297
  cleanup = typeof nextCleanup === 'function' ? nextCleanup : undefined;
@@ -7248,6 +7301,7 @@
7248
7301
  // Don't throw - allow other effects to continue
7249
7302
  }
7250
7303
  finally {
7304
+ initialized = true;
7251
7305
  currentEffect = prevEffect;
7252
7306
  effectDepth--;
7253
7307
  runningEffects.delete(execute);
@@ -7264,14 +7318,17 @@
7264
7318
  if (!active)
7265
7319
  return;
7266
7320
  active = false;
7321
+ effectQueue.delete(execute);
7322
+ batchedEffects.delete(execute);
7267
7323
  // Remove from all dependencies
7268
7324
  dependencies.forEach(depSet => {
7269
7325
  depSet.delete(execute);
7270
7326
  });
7271
7327
  dependencies.clear();
7328
+ versions.clear();
7272
7329
  if (cleanup) {
7273
7330
  try {
7274
- cleanup();
7331
+ untrack(cleanup);
7275
7332
  }
7276
7333
  catch (error) {
7277
7334
  console.error('[Effect] Error in final cleanup:', error);
@@ -7331,6 +7388,8 @@
7331
7388
  const effects = Array.from(batchedEffects);
7332
7389
  batchedEffects.clear();
7333
7390
  effects.forEach(effect => {
7391
+ // This batch also settles any earlier queued write to this observer.
7392
+ effectQueue.delete(effect);
7334
7393
  try {
7335
7394
  effect();
7336
7395
  }
@@ -12226,6 +12285,21 @@
12226
12285
  * Registry of all scopes
12227
12286
  */
12228
12287
  const scopeRegistry = new Map();
12288
+ const warnedReveals = new WeakSet();
12289
+ function diagnoseUnscopedReveals(root) {
12290
+ if (!DEBUG())
12291
+ return;
12292
+ const elements = [...root.querySelectorAll('[g-reveal]')];
12293
+ if (root instanceof Element && root.hasAttribute('g-reveal'))
12294
+ elements.unshift(root);
12295
+ for (const element of elements) {
12296
+ if (warnedReveals.has(element) || isInIgnoredTree(element)
12297
+ || element.closest('[g-scope]') || getScopeFromElement(element))
12298
+ continue;
12299
+ warnedReveals.add(element);
12300
+ console.warn('[Gyos] g-reveal has no owning scope. Add g-scope to its container; global reveal CSS may otherwise hide this content.', element);
12301
+ }
12302
+ }
12229
12303
  /**
12230
12304
  * Register a scope
12231
12305
  */
@@ -12273,6 +12347,7 @@
12273
12347
  allElements.sort((a, b) => getDepth(b) - getDepth(a));
12274
12348
  // Filter out elements inside structural directives - they will be mounted by structural processor
12275
12349
  allElements.forEach(el => !hasStructuralParent(el) && mount(el));
12350
+ diagnoseUnscopedReveals(document.body);
12276
12351
  }
12277
12352
  function mountTree(el) {
12278
12353
  if (isInIgnoredTree(el) || !document.body.contains(el))
@@ -12283,6 +12358,7 @@
12283
12358
  // Child scopes own their subtree before an existing parent scope parses the insertion.
12284
12359
  candidates.sort((a, b) => getDepth(b) - getDepth(a));
12285
12360
  candidates.forEach(element => !hasStructuralParent(element) && mount(element));
12361
+ diagnoseUnscopedReveals(el);
12286
12362
  if (getMountedScope(el))
12287
12363
  return;
12288
12364
  const ownerScope = getScopeFromElement(el);
@@ -12301,7 +12377,7 @@
12301
12377
  return;
12302
12378
  // Check if element removed but still has g-scope (possible in some edge cases)
12303
12379
  getAllMountedScopes().forEach((_, mountedEl) => {
12304
- if (!document.body.contains(mountedEl)) {
12380
+ if (!mountedEl.isConnected) {
12305
12381
  disposeEffects(mountedEl);
12306
12382
  }
12307
12383
  });
@@ -13613,7 +13689,8 @@
13613
13689
  el.dataset.gyosPersistId = key;
13614
13690
  return key;
13615
13691
  }
13616
- // Hidden parking lot keeps persisted nodes alive (e.g. audio keeps playing)
13692
+ // Keep the parking host outside body: body itself may be the swap target.
13693
+ // A disconnected parking host makes browsers pause otherwise persisted media.
13617
13694
  const persistParking = typeof document !== 'undefined'
13618
13695
  ? (() => {
13619
13696
  const park = document.createElement('div');
@@ -13622,12 +13699,7 @@
13622
13699
  park.style.top = '-99999px';
13623
13700
  park.style.width = '0';
13624
13701
  park.style.height = '0';
13625
- if (document.readyState === 'loading') {
13626
- document.addEventListener('DOMContentLoaded', () => document.body.appendChild(park));
13627
- }
13628
- else {
13629
- document.body.appendChild(park);
13630
- }
13702
+ document.documentElement.appendChild(park);
13631
13703
  return park;
13632
13704
  })()
13633
13705
  : null;
@@ -13638,8 +13710,8 @@
13638
13710
  return elements;
13639
13711
  }
13640
13712
  function ensureParkingIsConnected() {
13641
- if (persistParking && document.body && !persistParking.isConnected) {
13642
- document.body.appendChild(persistParking);
13713
+ if (persistParking && persistParking.parentElement !== document.documentElement) {
13714
+ document.documentElement.appendChild(persistParking);
13643
13715
  }
13644
13716
  }
13645
13717
  function detachPersist(root = document) {
@@ -13657,12 +13729,18 @@
13657
13729
  });
13658
13730
  }
13659
13731
  function mergePersistIntoLive(root) {
13732
+ // Return the host to the current body before scope mounting/cleanup inspects it.
13733
+ if (persistParking && persistParking.parentElement !== document.body) {
13734
+ document.body.appendChild(persistParking);
13735
+ }
13660
13736
  if (!persistEntries.size)
13661
13737
  return;
13662
13738
  // If placeholders lack ids but we only have one persist entry, assign its key for convenience
13663
13739
  if (persistEntries.size === 1) {
13664
13740
  const loneKey = Array.from(persistEntries.keys())[0];
13665
13741
  elementsIn(root).forEach(el => {
13742
+ if (persistParking?.contains(el))
13743
+ return;
13666
13744
  if (!getPersistKey(el, false)) {
13667
13745
  el.dataset.gyosPersistId = loneKey;
13668
13746
  }
@@ -13670,6 +13748,8 @@
13670
13748
  }
13671
13749
  // Element placeholders
13672
13750
  elementsIn(root).forEach(placeholder => {
13751
+ if (persistParking?.contains(placeholder))
13752
+ return;
13673
13753
  const key = getPersistKey(placeholder, false);
13674
13754
  if (!key)
13675
13755
  return;
@@ -13687,6 +13767,8 @@
13687
13767
  const toReplace = [];
13688
13768
  while (walker.nextNode()) {
13689
13769
  const comment = walker.currentNode;
13770
+ if (persistParking?.contains(comment))
13771
+ continue;
13690
13772
  const match = comment.data.match(/g-persist[:=]\s*([A-Za-z0-9_\-:.]+)/);
13691
13773
  if (match) {
13692
13774
  toReplace.push({ node: comment, key: match[1] });
@@ -14344,6 +14426,36 @@
14344
14426
  * Implements attribute-driven routing, snapshot caching, and persistent islands.
14345
14427
  */
14346
14428
  const submittingForms = new WeakSet();
14429
+ async function visit(url, options, fresh) {
14430
+ const destination = new URL(url, document.baseURI);
14431
+ if (!['http:', 'https:'].includes(destination.protocol) || destination.origin !== location.origin || destination.username || destination.password) {
14432
+ throw new TypeError('Gyos.navigate requires a same-origin HTTP(S) URL without credentials.');
14433
+ }
14434
+ if (options.target !== undefined && !(document.querySelector(options.target) instanceof HTMLElement)) {
14435
+ throw new TypeError('Gyos.navigate target does not exist.');
14436
+ }
14437
+ if (!document.querySelector('[g-boost]')) {
14438
+ throw new TypeError('Gyos.navigate requires a g-boost layout.');
14439
+ }
14440
+ startRouter();
14441
+ let result;
14442
+ await navigateRequest({
14443
+ url: destination.href, method: 'GET',
14444
+ changeState: options.history !== 'none', replace: options.history === 'replace',
14445
+ targetSelector: options.target, strictTarget: options.target !== undefined, swapMode: options.swap,
14446
+ currentHead: options.currentHead, scroll: options.scroll, signal: options.signal, fresh,
14447
+ onEnd: context => { result = context; }
14448
+ });
14449
+ return result;
14450
+ }
14451
+ /** Navigate through the boost pipeline. Resolves after navigation-end hooks. */
14452
+ function navigate(url, options = {}) {
14453
+ return visit(url, options, false);
14454
+ }
14455
+ /** Fetch the current URL again, preserving history and scroll by default. */
14456
+ function refresh(options = {}) {
14457
+ return visit(location.href, { history: 'none', scroll: false, ...options }, true);
14458
+ }
14347
14459
  const snapshots = new Map();
14348
14460
  const preloadCache = new Map();
14349
14461
  const preloadControllers = new Map();
@@ -14730,12 +14842,27 @@
14730
14842
  }
14731
14843
  console.error(`[GyosRouter] ${method} navigation could not be boosted; the request will not be replayed.`);
14732
14844
  }
14733
- async function navigate(opts) {
14845
+ async function navigateRequest(opts) {
14846
+ const finishUnstarted = () => {
14847
+ opts.onEnd?.({ from: currentUrl, url: opts.url, method: opts.method,
14848
+ trigger: opts.trigger || null, target: null, form: null, popstate: false,
14849
+ signal: opts.signal, status: null, committed: false, fallback: false, outcome: 'aborted' });
14850
+ };
14851
+ if (opts.signal?.aborted) {
14852
+ finishUnstarted();
14853
+ return;
14854
+ }
14734
14855
  while (activeNavigation) {
14735
14856
  const previous = activeNavigation;
14736
14857
  if (previous.committing) {
14737
14858
  log('[GyosRouter] Waiting for previous DOM commit');
14738
- await previous.done;
14859
+ try {
14860
+ await (opts.signal ? waitForNavigation(previous.done, opts.signal) : previous.done);
14861
+ }
14862
+ catch {
14863
+ finishUnstarted();
14864
+ return;
14865
+ }
14739
14866
  continue;
14740
14867
  }
14741
14868
  log('[GyosRouter] Cancelling previous navigation');
@@ -14754,6 +14881,10 @@
14754
14881
  resolveDone
14755
14882
  };
14756
14883
  activeNavigation = transaction;
14884
+ const abort = () => cancelNavigation(transaction);
14885
+ opts.signal?.addEventListener('abort', abort, { once: true });
14886
+ if (opts.signal?.aborted)
14887
+ abort();
14757
14888
  const currentBaseUrl = document.baseURI;
14758
14889
  rememberResourceUrls(document, currentBaseUrl);
14759
14890
  const context = {
@@ -14777,6 +14908,7 @@
14777
14908
  }
14778
14909
  };
14779
14910
  try {
14911
+ assertActiveNavigation(transaction);
14780
14912
  if (formEvent)
14781
14913
  document.dispatchEvent(new CustomEvent('gyos:form-start', { detail: { ...formEvent } }));
14782
14914
  runNavigationHooks(beforeNavigate, opts.url, context);
@@ -14789,6 +14921,10 @@
14789
14921
  saveScrollPosition();
14790
14922
  // Pick target element to swap
14791
14923
  let target = resolveTarget(opts.trigger, opts.targetSelector, opts.targetOutletIndex);
14924
+ if (opts.strictTarget && (!opts.targetSelector || !target?.matches(opts.targetSelector))) {
14925
+ context.outcome = 'invalid-response';
14926
+ return; // A queued explicit target disappeared; never broaden the swap.
14927
+ }
14792
14928
  context.target = target;
14793
14929
  if (!target) {
14794
14930
  if (isActiveNavigation(transaction))
@@ -14833,7 +14969,12 @@
14833
14969
  else {
14834
14970
  // Check preload cache if GET
14835
14971
  const preloadKey = canonicalUrl(finalUrl, true);
14836
- if (opts.method.toUpperCase() === 'GET' && preloadCache.has(preloadKey)) {
14972
+ if (opts.fresh) {
14973
+ preloadControllers.get(preloadKey)?.abort();
14974
+ preloadControllers.delete(preloadKey);
14975
+ preloadCache.delete(preloadKey);
14976
+ }
14977
+ if (!opts.fresh && opts.method.toUpperCase() === 'GET' && preloadCache.has(preloadKey)) {
14837
14978
  log('[GyosRouter] using preload cache for', finalUrl);
14838
14979
  try {
14839
14980
  response = await waitForNavigation(preloadCache.get(preloadKey), transaction.controller.signal);
@@ -15041,7 +15182,10 @@
15041
15182
  finalizeCommit();
15042
15183
  }
15043
15184
  // Handle scroll after mount scopes
15044
- if (changesState) {
15185
+ if (opts.scroll === false) {
15186
+ // Explicit refresh/navigation policy keeps the current viewport.
15187
+ }
15188
+ else if (changesState) {
15045
15189
  handleScroll(targetUrl, opts.trigger);
15046
15190
  }
15047
15191
  else if (opts.popstate) {
@@ -15106,6 +15250,7 @@
15106
15250
  activeNavigation = null;
15107
15251
  progressBar?.complete();
15108
15252
  }
15253
+ opts.signal?.removeEventListener('abort', abort);
15109
15254
  transaction.resolveDone();
15110
15255
  if (formEvent)
15111
15256
  submittingForms.delete(formEvent.form);
@@ -15116,6 +15261,7 @@
15116
15261
  detail: { ...formEvent, url, status, outcome, committed, fallback }
15117
15262
  }));
15118
15263
  }
15264
+ opts.onEnd?.({ ...context });
15119
15265
  }
15120
15266
  }
15121
15267
  function shouldBoost(el) {
@@ -15146,7 +15292,7 @@
15146
15292
  const scope = getScopeFromElement(element);
15147
15293
  const jsonData = evaluateExpression(decodeURIComponent(element.getAttribute(paramsAttr) || ''), scope, false);
15148
15294
  // The default changeState is false, as this is commonly used for: load more, infinite scroll, etc.
15149
- navigate({
15295
+ navigateRequest({
15150
15296
  url: parsedUrl.toString(), method, trigger: element, jsonData, changeState: false
15151
15297
  });
15152
15298
  }
@@ -15195,7 +15341,7 @@
15195
15341
  return;
15196
15342
  event.preventDefault();
15197
15343
  // The default changeState is true, as this is commonly used for: navigation, etc.
15198
- navigate({ url: url.toString(), method: 'GET', trigger: link, changeState: true });
15344
+ navigateRequest({ url: url.toString(), method: 'GET', trigger: link, changeState: true });
15199
15345
  }
15200
15346
  function onMouseOverCapture(event) {
15201
15347
  const target = event.target;
@@ -15251,7 +15397,7 @@
15251
15397
  return;
15252
15398
  const formData = new FormData(form, submitter);
15253
15399
  submittingForms.add(form);
15254
- void navigate({ url: url.toString(), method, trigger: form, form, formData, formEncoding, changeState: method === 'GET' });
15400
+ void navigateRequest({ url: url.toString(), method, trigger: form, form, formData, formEncoding, changeState: method === 'GET' });
15255
15401
  }
15256
15402
  function onPopState(event) {
15257
15403
  const url = window.location.href;
@@ -15269,14 +15415,14 @@
15269
15415
  }
15270
15416
  event.preventDefault();
15271
15417
  // The browser changes location before popstate fires. Stop any pending page
15272
- // script immediately, then let navigate() wait for its DOM finalizer.
15418
+ // script immediately, then let navigateRequest() wait for its DOM finalizer.
15273
15419
  if (activeNavigation?.committing)
15274
15420
  cancelNavigation(activeNavigation);
15275
15421
  // The browser has already moved to the destination history entry. Keep the
15276
15422
  // router's entry pointer aligned before any restored page script can navigate.
15277
15423
  currentHistoryEntryId = destinationEntryId;
15278
15424
  // No snapshot, do a normal navigation without changing history (changeState: false)
15279
- navigate({
15425
+ navigateRequest({
15280
15426
  url,
15281
15427
  method: 'GET',
15282
15428
  replace: true,
@@ -15358,10 +15504,12 @@
15358
15504
  onAfterNavigate,
15359
15505
  onBeforeSwap,
15360
15506
  onNavigationEnd,
15507
+ navigate,
15508
+ refresh,
15361
15509
  portalCreate,
15362
15510
  portalDestroy,
15363
15511
  setCspNonce,
15364
- version: '0.4.0'
15512
+ version: '0.5.0'
15365
15513
  };
15366
15514
 
15367
15515
  setExpressionRuntime(cspExpressionRuntime);
@@ -15392,6 +15540,7 @@
15392
15540
  exports.mountAll = mountAll;
15393
15541
  exports.mountTree = mountTree;
15394
15542
  exports.mountedScopes = getAllMountedScopes;
15543
+ exports.navigate = navigate;
15395
15544
  exports.nextTick = nextTick;
15396
15545
  exports.off = off;
15397
15546
  exports.on = on;
@@ -15405,6 +15554,7 @@
15405
15554
  exports.portalDestroy = portalDestroy;
15406
15555
  exports.provide = provide;
15407
15556
  exports.ready = ready;
15557
+ exports.refresh = refresh;
15408
15558
  exports.registerTransition = registerTransition;
15409
15559
  exports.removeStore = removeStore;
15410
15560
  exports.scope = scope;