gyosjs 0.1.0 → 0.1.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.
package/dist/gyos.auto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * GyosJS v0.1.0
2
+ * GyosJS v0.1.2
3
3
  * (c) 2026
4
4
  * @license MIT
5
5
  */
@@ -5450,6 +5450,19 @@
5450
5450
  if (!definition)
5451
5451
  definition = scopeRegistry.get(scopeAttr) || {};
5452
5452
  const autoDef = parseAutoScope(el);
5453
+ if (typeof definition === 'function') {
5454
+ const factory = definition;
5455
+ return context => {
5456
+ const instance = factory(context);
5457
+ if (!instance || typeof instance !== 'object')
5458
+ return instance;
5459
+ Object.keys(autoDef).forEach(key => {
5460
+ instance[key] = autoDef[key];
5461
+ });
5462
+ autoBindModelProp(el, instance);
5463
+ return instance;
5464
+ };
5465
+ }
5453
5466
  Object.keys(autoDef).forEach(key => {
5454
5467
  definition[key] = autoDef[key];
5455
5468
  });
@@ -5496,7 +5509,10 @@
5496
5509
  const context = createContext(el, instance);
5497
5510
  // If function component, call it now with context
5498
5511
  if (typeof definition === 'function' && !instance) {
5499
- instance = definition(context);
5512
+ const factoryResult = definition(context);
5513
+ instance = factoryResult && typeof factoryResult === 'object'
5514
+ ? makeReactive(factoryResult)
5515
+ : factoryResult;
5500
5516
  }
5501
5517
  if (!instance || typeof instance !== 'object') {
5502
5518
  DEBUG() && console.error('[GyosJS] Invalid scope definition for element:', el);
@@ -7218,6 +7234,11 @@
7218
7234
  });
7219
7235
  });
7220
7236
  }
7237
+ function consumeViewTransitionRejection(promise) {
7238
+ // Chrome rejects these when a newer transition skips the current one. The
7239
+ // update callback remains the navigation source of truth and is awaited below.
7240
+ void promise?.catch(() => undefined);
7241
+ }
7221
7242
  function runNavigationHooks(callbacks, url) {
7222
7243
  callbacks.forEach(callback => {
7223
7244
  try {
@@ -7396,6 +7417,8 @@
7396
7417
  return;
7397
7418
  }
7398
7419
  const swapMode = (opts.swapMode || opts.trigger?.getAttribute('g-swap') || 'inner').toLowerCase();
7420
+ const removeTriggerAfterCommit = opts.trigger instanceof HTMLElement
7421
+ && opts.trigger.hasAttribute('g-router-remove');
7399
7422
  const destructiveSwap = !['append', 'prepend'].includes(swapMode);
7400
7423
  const isFullOutletNavigation = target === findGlobalOutlet();
7401
7424
  const targetOutletIndex = getOutletIndex(document, target);
@@ -7610,6 +7633,8 @@
7610
7633
  // Apply view transition if available
7611
7634
  if (document.startViewTransition) {
7612
7635
  const transition = document.startViewTransition(() => performUpdate());
7636
+ consumeViewTransitionRejection(transition?.ready);
7637
+ consumeViewTransitionRejection(transition?.finished);
7613
7638
  if (transition?.updateCallbackDone) {
7614
7639
  await transition.updateCallbackDone;
7615
7640
  }
@@ -7618,6 +7643,10 @@
7618
7643
  await performUpdate();
7619
7644
  }
7620
7645
  assertActiveNavigation(transaction);
7646
+ if (removeTriggerAfterCommit && opts.trigger instanceof HTMLElement && opts.trigger.isConnected) {
7647
+ disposeEffects(opts.trigger);
7648
+ opts.trigger.remove();
7649
+ }
7621
7650
  if (hasTargetSpinner)
7622
7651
  hideTargetSpinner(transaction.spinner);
7623
7652
  transaction.spinner = null;
@@ -7871,7 +7900,7 @@
7871
7900
  onAfterNavigate,
7872
7901
  portalCreate,
7873
7902
  portalDestroy,
7874
- version: '0.1.0'
7903
+ version: '0.1.2'
7875
7904
  };
7876
7905
 
7877
7906
  var _a, _b, _c;