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/README.md CHANGED
@@ -34,7 +34,7 @@ GyosJS is not trying to replace a full SPA framework. If your app is primarily c
34
34
  Use the browser auto-init build when you want HTML-first usage with minimal setup.
35
35
 
36
36
  ```html
37
- <script src="https://cdn.jsdelivr.net/npm/gyosjs@0.5.1/dist/gyos.auto.min.js"></script>
37
+ <script src="https://cdn.jsdelivr.net/npm/gyosjs@0.5.3/dist/gyos.auto.min.js"></script>
38
38
  ```
39
39
 
40
40
  That build attaches `window.Gyos`, starts the router when `g-boost` exists, injects transition styles, and mounts scopes when the page is ready.
@@ -1 +1 @@
1
- {"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../../src/core/reactive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAUlC,eAAO,MAAM,aAAa,eAAmC,CAAC;AA0D9D,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOrD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/C;AAKD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOnD;AASD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOnD;AAiCD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAsMpD;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAgB3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAEvE"}
1
+ {"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../../src/core/reactive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAUlC,eAAO,MAAM,aAAa,eAAmC,CAAC;AA0D9D,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOrD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/C;AAKD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOnD;AASD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOnD;AAiCD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA+MpD;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAgB3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAEvE"}
@@ -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
  */
@@ -4089,7 +4089,7 @@ function processModel(element, scope, root) {
4089
4089
  // Set initial value (no pipes in v-model)
4090
4090
  const initialValue = evaluateExpression(expr, currentScope, false);
4091
4091
  if (inputElement.type === 'checkbox') {
4092
- inputElement.checked = !!initialValue;
4092
+ inputElement.checked = !!unref(initialValue);
4093
4093
  }
4094
4094
  else if (inputElement.type === 'radio') {
4095
4095
  inputElement.checked = String(unref(initialValue)) === inputElement.value;
@@ -4135,7 +4135,7 @@ function processModel(element, scope, root) {
4135
4135
  // No pipes in v-model reactive updates
4136
4136
  const newValue = evaluateExpression(expr, currentScope, false);
4137
4137
  if (inputElement.type === 'checkbox') {
4138
- inputElement.checked = !!newValue;
4138
+ inputElement.checked = !!unref(newValue);
4139
4139
  }
4140
4140
  else if (inputElement.type === 'radio') {
4141
4141
  inputElement.checked = String(unref(newValue)) === inputElement.value;
@@ -4366,6 +4366,15 @@ function reactive(raw) {
4366
4366
  // It's a getter - just return value, getter will track its own dependencies
4367
4367
  return value;
4368
4368
  }
4369
+ // Callable reactive values are data, not methods. Binding would drop
4370
+ // their identity and metadata used by g-model and the public APIs.
4371
+ if (isSignal(value) || isComputed(value)) {
4372
+ // Track the field as well as reads of its value so replacing the
4373
+ // signal/computed switches effects away from the old source.
4374
+ if (hasCurrentEffect())
4375
+ getFieldSignal(target, key, value).value;
4376
+ return value;
4377
+ }
4369
4378
  // function -> bind this = proxy
4370
4379
  if (typeof value === "function") {
4371
4380
  return value.bind(proxy);
@@ -6013,8 +6022,9 @@ function mountScopeInternal(el, definition) {
6013
6022
  if (typeof definition === 'object') {
6014
6023
  instance = makeReactive(definition);
6015
6024
  }
6016
- // Create component context (needs instance for $watch)
6017
- const context = createContext(el, instance);
6025
+ // Factories receive context before their reactive instance exists. Resolve it
6026
+ // when an observer is registered so captured context also works in onMount.
6027
+ const context = createContext(el, () => instance);
6018
6028
  // If function component, call it now with context
6019
6029
  if (typeof definition === 'function' && !instance) {
6020
6030
  const factoryResult = definition(context);
@@ -6071,7 +6081,7 @@ function mountScopeInternal(el, definition) {
6071
6081
  /**
6072
6082
  * Create component context
6073
6083
  */
6074
- function createContext(el, instance) {
6084
+ function createContext(el, getInstance) {
6075
6085
  const refs = {};
6076
6086
  const events = new Map();
6077
6087
  // Find all refs within this scope only
@@ -6119,6 +6129,7 @@ function createContext(el, instance) {
6119
6129
  },
6120
6130
  $watch: (key, handler, options = {}) => {
6121
6131
  // Watch a reactive property for changes (supports nested paths like 'xxx.count')
6132
+ const instance = getInstance();
6122
6133
  if (!instance) {
6123
6134
  DEBUG() && console.warn('[Component] $watch called before instance created');
6124
6135
  return () => { };
@@ -6185,6 +6196,7 @@ function createContext(el, instance) {
6185
6196
  },
6186
6197
  $effect: (fn) => {
6187
6198
  // Shorthand for effect with auto cleanup on unmount
6199
+ const instance = getInstance();
6188
6200
  if (!instance) {
6189
6201
  DEBUG() && console.warn('[Component] $effect called before instance created');
6190
6202
  return () => { };
@@ -8925,7 +8937,7 @@ const Gyos = {
8925
8937
  portalCreate,
8926
8938
  portalDestroy,
8927
8939
  setCspNonce,
8928
- version: '0.5.1'
8940
+ version: '0.5.3'
8929
8941
  };
8930
8942
 
8931
8943
  const standardExpressionRuntime = {