gyosjs 0.1.1 → 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.1
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);
@@ -7401,6 +7417,8 @@
7401
7417
  return;
7402
7418
  }
7403
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');
7404
7422
  const destructiveSwap = !['append', 'prepend'].includes(swapMode);
7405
7423
  const isFullOutletNavigation = target === findGlobalOutlet();
7406
7424
  const targetOutletIndex = getOutletIndex(document, target);
@@ -7625,6 +7643,10 @@
7625
7643
  await performUpdate();
7626
7644
  }
7627
7645
  assertActiveNavigation(transaction);
7646
+ if (removeTriggerAfterCommit && opts.trigger instanceof HTMLElement && opts.trigger.isConnected) {
7647
+ disposeEffects(opts.trigger);
7648
+ opts.trigger.remove();
7649
+ }
7628
7650
  if (hasTargetSpinner)
7629
7651
  hideTargetSpinner(transaction.spinner);
7630
7652
  transaction.spinner = null;
@@ -7878,7 +7900,7 @@
7878
7900
  onAfterNavigate,
7879
7901
  portalCreate,
7880
7902
  portalDestroy,
7881
- version: '0.1.1'
7903
+ version: '0.1.2'
7882
7904
  };
7883
7905
 
7884
7906
  var _a, _b, _c;