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.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
  */
@@ -6060,8 +6060,9 @@
6060
6060
  if (typeof definition === 'object') {
6061
6061
  instance = makeReactive(definition);
6062
6062
  }
6063
- // Create component context (needs instance for $watch)
6064
- const context = createContext(el, instance);
6063
+ // Factories receive context before their reactive instance exists. Resolve it
6064
+ // when an observer is registered so captured context also works in onMount.
6065
+ const context = createContext(el, () => instance);
6065
6066
  // If function component, call it now with context
6066
6067
  if (typeof definition === 'function' && !instance) {
6067
6068
  const factoryResult = definition(context);
@@ -6118,7 +6119,7 @@
6118
6119
  /**
6119
6120
  * Create component context
6120
6121
  */
6121
- function createContext(el, instance) {
6122
+ function createContext(el, getInstance) {
6122
6123
  const refs = {};
6123
6124
  const events = new Map();
6124
6125
  // Find all refs within this scope only
@@ -6166,6 +6167,7 @@
6166
6167
  },
6167
6168
  $watch: (key, handler, options = {}) => {
6168
6169
  // Watch a reactive property for changes (supports nested paths like 'xxx.count')
6170
+ const instance = getInstance();
6169
6171
  if (!instance) {
6170
6172
  DEBUG() && console.warn('[Component] $watch called before instance created');
6171
6173
  return () => { };
@@ -6232,6 +6234,7 @@
6232
6234
  },
6233
6235
  $effect: (fn) => {
6234
6236
  // Shorthand for effect with auto cleanup on unmount
6237
+ const instance = getInstance();
6235
6238
  if (!instance) {
6236
6239
  DEBUG() && console.warn('[Component] $effect called before instance created');
6237
6240
  return () => { };
@@ -8972,7 +8975,7 @@
8972
8975
  portalCreate,
8973
8976
  portalDestroy,
8974
8977
  setCspNonce,
8975
- version: '0.5.2'
8978
+ version: '0.5.3'
8976
8979
  };
8977
8980
 
8978
8981
  setExpressionRuntime(standardExpressionRuntime);