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.
@@ -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
  */
@@ -6028,8 +6028,9 @@
6028
6028
  if (typeof definition === 'object') {
6029
6029
  instance = makeReactive(definition);
6030
6030
  }
6031
- // Create component context (needs instance for $watch)
6032
- const context = createContext(el, instance);
6031
+ // Factories receive context before their reactive instance exists. Resolve it
6032
+ // when an observer is registered so captured context also works in onMount.
6033
+ const context = createContext(el, () => instance);
6033
6034
  // If function component, call it now with context
6034
6035
  if (typeof definition === 'function' && !instance) {
6035
6036
  const factoryResult = definition(context);
@@ -6086,7 +6087,7 @@
6086
6087
  /**
6087
6088
  * Create component context
6088
6089
  */
6089
- function createContext(el, instance) {
6090
+ function createContext(el, getInstance) {
6090
6091
  const refs = {};
6091
6092
  const events = new Map();
6092
6093
  // Find all refs within this scope only
@@ -6134,6 +6135,7 @@
6134
6135
  },
6135
6136
  $watch: (key, handler, options = {}) => {
6136
6137
  // Watch a reactive property for changes (supports nested paths like 'xxx.count')
6138
+ const instance = getInstance();
6137
6139
  if (!instance) {
6138
6140
  DEBUG() && console.warn('[Component] $watch called before instance created');
6139
6141
  return () => { };
@@ -6200,6 +6202,7 @@
6200
6202
  },
6201
6203
  $effect: (fn) => {
6202
6204
  // Shorthand for effect with auto cleanup on unmount
6205
+ const instance = getInstance();
6203
6206
  if (!instance) {
6204
6207
  DEBUG() && console.warn('[Component] $effect called before instance created');
6205
6208
  return () => { };
@@ -8954,7 +8957,7 @@
8954
8957
  portalCreate,
8955
8958
  portalDestroy,
8956
8959
  setCspNonce,
8957
- version: '0.5.2'
8960
+ version: '0.5.3'
8958
8961
  };
8959
8962
 
8960
8963
  // This file was generated. Do not modify manually!