gyosjs 0.5.1 → 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.1
2
+ * GyosJS v0.5.3
3
3
  * (c) 2026
4
4
  * @license MIT
5
5
  */
@@ -4127,7 +4127,7 @@
4127
4127
  // Set initial value (no pipes in v-model)
4128
4128
  const initialValue = evaluateExpression(expr, currentScope, false);
4129
4129
  if (inputElement.type === 'checkbox') {
4130
- inputElement.checked = !!initialValue;
4130
+ inputElement.checked = !!unref(initialValue);
4131
4131
  }
4132
4132
  else if (inputElement.type === 'radio') {
4133
4133
  inputElement.checked = String(unref(initialValue)) === inputElement.value;
@@ -4173,7 +4173,7 @@
4173
4173
  // No pipes in v-model reactive updates
4174
4174
  const newValue = evaluateExpression(expr, currentScope, false);
4175
4175
  if (inputElement.type === 'checkbox') {
4176
- inputElement.checked = !!newValue;
4176
+ inputElement.checked = !!unref(newValue);
4177
4177
  }
4178
4178
  else if (inputElement.type === 'radio') {
4179
4179
  inputElement.checked = String(unref(newValue)) === inputElement.value;
@@ -4404,6 +4404,15 @@
4404
4404
  // It's a getter - just return value, getter will track its own dependencies
4405
4405
  return value;
4406
4406
  }
4407
+ // Callable reactive values are data, not methods. Binding would drop
4408
+ // their identity and metadata used by g-model and the public APIs.
4409
+ if (isSignal(value) || isComputed(value)) {
4410
+ // Track the field as well as reads of its value so replacing the
4411
+ // signal/computed switches effects away from the old source.
4412
+ if (hasCurrentEffect())
4413
+ getFieldSignal(target, key, value).value;
4414
+ return value;
4415
+ }
4407
4416
  // function -> bind this = proxy
4408
4417
  if (typeof value === "function") {
4409
4418
  return value.bind(proxy);
@@ -6051,8 +6060,9 @@
6051
6060
  if (typeof definition === 'object') {
6052
6061
  instance = makeReactive(definition);
6053
6062
  }
6054
- // Create component context (needs instance for $watch)
6055
- 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);
6056
6066
  // If function component, call it now with context
6057
6067
  if (typeof definition === 'function' && !instance) {
6058
6068
  const factoryResult = definition(context);
@@ -6109,7 +6119,7 @@
6109
6119
  /**
6110
6120
  * Create component context
6111
6121
  */
6112
- function createContext(el, instance) {
6122
+ function createContext(el, getInstance) {
6113
6123
  const refs = {};
6114
6124
  const events = new Map();
6115
6125
  // Find all refs within this scope only
@@ -6157,6 +6167,7 @@
6157
6167
  },
6158
6168
  $watch: (key, handler, options = {}) => {
6159
6169
  // Watch a reactive property for changes (supports nested paths like 'xxx.count')
6170
+ const instance = getInstance();
6160
6171
  if (!instance) {
6161
6172
  DEBUG() && console.warn('[Component] $watch called before instance created');
6162
6173
  return () => { };
@@ -6223,6 +6234,7 @@
6223
6234
  },
6224
6235
  $effect: (fn) => {
6225
6236
  // Shorthand for effect with auto cleanup on unmount
6237
+ const instance = getInstance();
6226
6238
  if (!instance) {
6227
6239
  DEBUG() && console.warn('[Component] $effect called before instance created');
6228
6240
  return () => { };
@@ -8963,7 +8975,7 @@
8963
8975
  portalCreate,
8964
8976
  portalDestroy,
8965
8977
  setCspNonce,
8966
- version: '0.5.1'
8978
+ version: '0.5.3'
8967
8979
  };
8968
8980
 
8969
8981
  setExpressionRuntime(standardExpressionRuntime);