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.
@@ -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
  */
@@ -10738,7 +10738,7 @@ function processModel(element, scope, root) {
10738
10738
  // Set initial value (no pipes in v-model)
10739
10739
  const initialValue = evaluateExpression(expr, currentScope, false);
10740
10740
  if (inputElement.type === 'checkbox') {
10741
- inputElement.checked = !!initialValue;
10741
+ inputElement.checked = !!unref(initialValue);
10742
10742
  }
10743
10743
  else if (inputElement.type === 'radio') {
10744
10744
  inputElement.checked = String(unref(initialValue)) === inputElement.value;
@@ -10784,7 +10784,7 @@ function processModel(element, scope, root) {
10784
10784
  // No pipes in v-model reactive updates
10785
10785
  const newValue = evaluateExpression(expr, currentScope, false);
10786
10786
  if (inputElement.type === 'checkbox') {
10787
- inputElement.checked = !!newValue;
10787
+ inputElement.checked = !!unref(newValue);
10788
10788
  }
10789
10789
  else if (inputElement.type === 'radio') {
10790
10790
  inputElement.checked = String(unref(newValue)) === inputElement.value;
@@ -11015,6 +11015,15 @@ function reactive(raw) {
11015
11015
  // It's a getter - just return value, getter will track its own dependencies
11016
11016
  return value;
11017
11017
  }
11018
+ // Callable reactive values are data, not methods. Binding would drop
11019
+ // their identity and metadata used by g-model and the public APIs.
11020
+ if (isSignal(value) || isComputed(value)) {
11021
+ // Track the field as well as reads of its value so replacing the
11022
+ // signal/computed switches effects away from the old source.
11023
+ if (hasCurrentEffect())
11024
+ getFieldSignal(target, key, value).value;
11025
+ return value;
11026
+ }
11018
11027
  // function -> bind this = proxy
11019
11028
  if (typeof value === "function") {
11020
11029
  return value.bind(proxy);
@@ -12662,8 +12671,9 @@ function mountScopeInternal(el, definition) {
12662
12671
  if (typeof definition === 'object') {
12663
12672
  instance = makeReactive(definition);
12664
12673
  }
12665
- // Create component context (needs instance for $watch)
12666
- const context = createContext(el, instance);
12674
+ // Factories receive context before their reactive instance exists. Resolve it
12675
+ // when an observer is registered so captured context also works in onMount.
12676
+ const context = createContext(el, () => instance);
12667
12677
  // If function component, call it now with context
12668
12678
  if (typeof definition === 'function' && !instance) {
12669
12679
  const factoryResult = definition(context);
@@ -12720,7 +12730,7 @@ function mountScopeInternal(el, definition) {
12720
12730
  /**
12721
12731
  * Create component context
12722
12732
  */
12723
- function createContext(el, instance) {
12733
+ function createContext(el, getInstance) {
12724
12734
  const refs = {};
12725
12735
  const events = new Map();
12726
12736
  // Find all refs within this scope only
@@ -12768,6 +12778,7 @@ function createContext(el, instance) {
12768
12778
  },
12769
12779
  $watch: (key, handler, options = {}) => {
12770
12780
  // Watch a reactive property for changes (supports nested paths like 'xxx.count')
12781
+ const instance = getInstance();
12771
12782
  if (!instance) {
12772
12783
  DEBUG() && console.warn('[Component] $watch called before instance created');
12773
12784
  return () => { };
@@ -12834,6 +12845,7 @@ function createContext(el, instance) {
12834
12845
  },
12835
12846
  $effect: (fn) => {
12836
12847
  // Shorthand for effect with auto cleanup on unmount
12848
+ const instance = getInstance();
12837
12849
  if (!instance) {
12838
12850
  DEBUG() && console.warn('[Component] $effect called before instance created');
12839
12851
  return () => { };
@@ -15574,7 +15586,7 @@ const Gyos = {
15574
15586
  portalCreate,
15575
15587
  portalDestroy,
15576
15588
  setCspNonce,
15577
- version: '0.5.1'
15589
+ version: '0.5.3'
15578
15590
  };
15579
15591
 
15580
15592
  setExpressionRuntime(cspExpressionRuntime);