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.csp.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
  */
@@ -10744,7 +10744,7 @@
10744
10744
  // Set initial value (no pipes in v-model)
10745
10745
  const initialValue = evaluateExpression(expr, currentScope, false);
10746
10746
  if (inputElement.type === 'checkbox') {
10747
- inputElement.checked = !!initialValue;
10747
+ inputElement.checked = !!unref(initialValue);
10748
10748
  }
10749
10749
  else if (inputElement.type === 'radio') {
10750
10750
  inputElement.checked = String(unref(initialValue)) === inputElement.value;
@@ -10790,7 +10790,7 @@
10790
10790
  // No pipes in v-model reactive updates
10791
10791
  const newValue = evaluateExpression(expr, currentScope, false);
10792
10792
  if (inputElement.type === 'checkbox') {
10793
- inputElement.checked = !!newValue;
10793
+ inputElement.checked = !!unref(newValue);
10794
10794
  }
10795
10795
  else if (inputElement.type === 'radio') {
10796
10796
  inputElement.checked = String(unref(newValue)) === inputElement.value;
@@ -11021,6 +11021,15 @@
11021
11021
  // It's a getter - just return value, getter will track its own dependencies
11022
11022
  return value;
11023
11023
  }
11024
+ // Callable reactive values are data, not methods. Binding would drop
11025
+ // their identity and metadata used by g-model and the public APIs.
11026
+ if (isSignal(value) || isComputed(value)) {
11027
+ // Track the field as well as reads of its value so replacing the
11028
+ // signal/computed switches effects away from the old source.
11029
+ if (hasCurrentEffect())
11030
+ getFieldSignal(target, key, value).value;
11031
+ return value;
11032
+ }
11024
11033
  // function -> bind this = proxy
11025
11034
  if (typeof value === "function") {
11026
11035
  return value.bind(proxy);
@@ -12668,8 +12677,9 @@
12668
12677
  if (typeof definition === 'object') {
12669
12678
  instance = makeReactive(definition);
12670
12679
  }
12671
- // Create component context (needs instance for $watch)
12672
- const context = createContext(el, instance);
12680
+ // Factories receive context before their reactive instance exists. Resolve it
12681
+ // when an observer is registered so captured context also works in onMount.
12682
+ const context = createContext(el, () => instance);
12673
12683
  // If function component, call it now with context
12674
12684
  if (typeof definition === 'function' && !instance) {
12675
12685
  const factoryResult = definition(context);
@@ -12726,7 +12736,7 @@
12726
12736
  /**
12727
12737
  * Create component context
12728
12738
  */
12729
- function createContext(el, instance) {
12739
+ function createContext(el, getInstance) {
12730
12740
  const refs = {};
12731
12741
  const events = new Map();
12732
12742
  // Find all refs within this scope only
@@ -12774,6 +12784,7 @@
12774
12784
  },
12775
12785
  $watch: (key, handler, options = {}) => {
12776
12786
  // Watch a reactive property for changes (supports nested paths like 'xxx.count')
12787
+ const instance = getInstance();
12777
12788
  if (!instance) {
12778
12789
  DEBUG() && console.warn('[Component] $watch called before instance created');
12779
12790
  return () => { };
@@ -12840,6 +12851,7 @@
12840
12851
  },
12841
12852
  $effect: (fn) => {
12842
12853
  // Shorthand for effect with auto cleanup on unmount
12854
+ const instance = getInstance();
12843
12855
  if (!instance) {
12844
12856
  DEBUG() && console.warn('[Component] $effect called before instance created');
12845
12857
  return () => { };
@@ -15580,7 +15592,7 @@
15580
15592
  portalCreate,
15581
15593
  portalDestroy,
15582
15594
  setCspNonce,
15583
- version: '0.5.1'
15595
+ version: '0.5.3'
15584
15596
  };
15585
15597
 
15586
15598
  setExpressionRuntime(cspExpressionRuntime);