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.esm.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
  */
@@ -4121,7 +4121,7 @@ function processModel(element, scope, root) {
4121
4121
  // Set initial value (no pipes in v-model)
4122
4122
  const initialValue = evaluateExpression(expr, currentScope, false);
4123
4123
  if (inputElement.type === 'checkbox') {
4124
- inputElement.checked = !!initialValue;
4124
+ inputElement.checked = !!unref(initialValue);
4125
4125
  }
4126
4126
  else if (inputElement.type === 'radio') {
4127
4127
  inputElement.checked = String(unref(initialValue)) === inputElement.value;
@@ -4167,7 +4167,7 @@ function processModel(element, scope, root) {
4167
4167
  // No pipes in v-model reactive updates
4168
4168
  const newValue = evaluateExpression(expr, currentScope, false);
4169
4169
  if (inputElement.type === 'checkbox') {
4170
- inputElement.checked = !!newValue;
4170
+ inputElement.checked = !!unref(newValue);
4171
4171
  }
4172
4172
  else if (inputElement.type === 'radio') {
4173
4173
  inputElement.checked = String(unref(newValue)) === inputElement.value;
@@ -4398,6 +4398,15 @@ function reactive(raw) {
4398
4398
  // It's a getter - just return value, getter will track its own dependencies
4399
4399
  return value;
4400
4400
  }
4401
+ // Callable reactive values are data, not methods. Binding would drop
4402
+ // their identity and metadata used by g-model and the public APIs.
4403
+ if (isSignal(value) || isComputed(value)) {
4404
+ // Track the field as well as reads of its value so replacing the
4405
+ // signal/computed switches effects away from the old source.
4406
+ if (hasCurrentEffect())
4407
+ getFieldSignal(target, key, value).value;
4408
+ return value;
4409
+ }
4401
4410
  // function -> bind this = proxy
4402
4411
  if (typeof value === "function") {
4403
4412
  return value.bind(proxy);
@@ -6045,8 +6054,9 @@ function mountScopeInternal(el, definition) {
6045
6054
  if (typeof definition === 'object') {
6046
6055
  instance = makeReactive(definition);
6047
6056
  }
6048
- // Create component context (needs instance for $watch)
6049
- const context = createContext(el, instance);
6057
+ // Factories receive context before their reactive instance exists. Resolve it
6058
+ // when an observer is registered so captured context also works in onMount.
6059
+ const context = createContext(el, () => instance);
6050
6060
  // If function component, call it now with context
6051
6061
  if (typeof definition === 'function' && !instance) {
6052
6062
  const factoryResult = definition(context);
@@ -6103,7 +6113,7 @@ function mountScopeInternal(el, definition) {
6103
6113
  /**
6104
6114
  * Create component context
6105
6115
  */
6106
- function createContext(el, instance) {
6116
+ function createContext(el, getInstance) {
6107
6117
  const refs = {};
6108
6118
  const events = new Map();
6109
6119
  // Find all refs within this scope only
@@ -6151,6 +6161,7 @@ function createContext(el, instance) {
6151
6161
  },
6152
6162
  $watch: (key, handler, options = {}) => {
6153
6163
  // Watch a reactive property for changes (supports nested paths like 'xxx.count')
6164
+ const instance = getInstance();
6154
6165
  if (!instance) {
6155
6166
  DEBUG() && console.warn('[Component] $watch called before instance created');
6156
6167
  return () => { };
@@ -6217,6 +6228,7 @@ function createContext(el, instance) {
6217
6228
  },
6218
6229
  $effect: (fn) => {
6219
6230
  // Shorthand for effect with auto cleanup on unmount
6231
+ const instance = getInstance();
6220
6232
  if (!instance) {
6221
6233
  DEBUG() && console.warn('[Component] $effect called before instance created');
6222
6234
  return () => { };
@@ -8957,7 +8969,7 @@ const Gyos = {
8957
8969
  portalCreate,
8958
8970
  portalDestroy,
8959
8971
  setCspNonce,
8960
- version: '0.5.1'
8972
+ version: '0.5.3'
8961
8973
  };
8962
8974
 
8963
8975
  setExpressionRuntime(standardExpressionRuntime);