gyosjs 0.5.2 → 0.5.3

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.5.2
2
+ * GyosJS v0.5.3
3
3
  * (c) 2026
4
4
  * @license MIT
5
5
  */
@@ -12677,8 +12677,9 @@
12677
12677
  if (typeof definition === 'object') {
12678
12678
  instance = makeReactive(definition);
12679
12679
  }
12680
- // Create component context (needs instance for $watch)
12681
- const context = createContext(el, instance);
12680
+ // Factories receive context before their reactive instance exists. Resolve it
12681
+ // when an observer is registered so captured context also works in onMount.
12682
+ const context = createContext(el, () => instance);
12682
12683
  // If function component, call it now with context
12683
12684
  if (typeof definition === 'function' && !instance) {
12684
12685
  const factoryResult = definition(context);
@@ -12735,7 +12736,7 @@
12735
12736
  /**
12736
12737
  * Create component context
12737
12738
  */
12738
- function createContext(el, instance) {
12739
+ function createContext(el, getInstance) {
12739
12740
  const refs = {};
12740
12741
  const events = new Map();
12741
12742
  // Find all refs within this scope only
@@ -12783,6 +12784,7 @@
12783
12784
  },
12784
12785
  $watch: (key, handler, options = {}) => {
12785
12786
  // Watch a reactive property for changes (supports nested paths like 'xxx.count')
12787
+ const instance = getInstance();
12786
12788
  if (!instance) {
12787
12789
  DEBUG() && console.warn('[Component] $watch called before instance created');
12788
12790
  return () => { };
@@ -12849,6 +12851,7 @@
12849
12851
  },
12850
12852
  $effect: (fn) => {
12851
12853
  // Shorthand for effect with auto cleanup on unmount
12854
+ const instance = getInstance();
12852
12855
  if (!instance) {
12853
12856
  DEBUG() && console.warn('[Component] $effect called before instance created');
12854
12857
  return () => { };
@@ -15589,7 +15592,7 @@
15589
15592
  portalCreate,
15590
15593
  portalDestroy,
15591
15594
  setCspNonce,
15592
- version: '0.5.2'
15595
+ version: '0.5.3'
15593
15596
  };
15594
15597
 
15595
15598
  setExpressionRuntime(cspExpressionRuntime);