octane 0.2.0 → 0.2.2

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.
@@ -10296,12 +10296,12 @@ function reportListenerError(err) {
10296
10296
  console.error(err);
10297
10297
  }
10298
10298
  function maybeFlushDiscrete(type) {
10299
- if (_dispatchDepth === 0 && DISCRETE_EVENTS.has(type)) {
10299
+ if (_dispatchDepth === 0 && DISCRETE_EVENTS.has(type) && pendingRestores.length > 0) {
10300
10300
  if (hasPendingWork()) {
10301
10301
  if (VIEW_TRANSITION_DRIVER?.queueAllTransition() === true) flush();
10302
10302
  else flushSync(noop);
10303
10303
  }
10304
- if (pendingRestores.length > 0) restoreControlledStates();
10304
+ restoreControlledStates();
10305
10305
  }
10306
10306
  if (type === "click") activationCheckable = null;
10307
10307
  }
@@ -10320,9 +10320,7 @@ function finishCaptureDispatch(event) {
10320
10320
  maybeFlushDiscrete(type);
10321
10321
  }
10322
10322
  };
10323
- const target = event.target;
10324
- const checkableChange = type === "change" && target?.localName === "input" && (target.type === "checkbox" || target.type === "radio");
10325
- if (checkableChange) setTimeout(fallback, 0);
10323
+ if (event.isTrusted) setTimeout(fallback, 0);
10326
10324
  else queueMicrotask(fallback);
10327
10325
  }
10328
10326
  function dispatchDelegated(event) {
@@ -10833,9 +10831,8 @@ function setValue(el, value) {
10833
10831
  const prev = ctrl.v;
10834
10832
  ctrl.v = value;
10835
10833
  if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
10834
+ if (!(ctrl.composing && Object.is(prev, value)) && valueNeedsWrite(input, value)) input.value = s;
10836
10835
  if (input.defaultValue !== s) input.defaultValue = s;
10837
- if (ctrl.composing && Object.is(prev, value)) return;
10838
- if (valueNeedsWrite(input, value)) input.value = s;
10839
10836
  }
10840
10837
  function setCheckedState(input, value, ctrl) {
10841
10838
  const first = !ctrl.sawC;
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  version: () => version
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const version = "0.2.0";
24
+ const version = "0.2.2";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  version
package/dist/runtime.d.ts CHANGED
@@ -602,8 +602,9 @@ export declare function setIsOctaneActEnvironment(value: boolean): void;
602
602
  * React-DOM parity. Runs `fn` and synchronously drains any renders/effects it scheduled
603
603
  * before returning. Bypasses the microtask-batched flush — used by the benchmark
604
604
  * timing rig to measure operation wall-clock without microtask coalescing. Also the
605
- * discrete-event commit path: maybeFlushDiscrete flushes through here so
606
- * click/keydown/input handlers commit before the browser regains control.
605
+ * controlled-restore commit path: maybeFlushDiscrete flushes through here at the
606
+ * outermost boundary of a discrete event that armed a controlled `value`/`checked`
607
+ * restore, so the restore compares the DOM against freshly committed state.
607
608
  */
608
609
  export declare function flushSync<T>(fn: () => T): T;
609
610
  /**
package/dist/runtime.js CHANGED
@@ -10130,12 +10130,12 @@ function reportListenerError(err) {
10130
10130
  console.error(err);
10131
10131
  }
10132
10132
  function maybeFlushDiscrete(type) {
10133
- if (_dispatchDepth === 0 && DISCRETE_EVENTS.has(type)) {
10133
+ if (_dispatchDepth === 0 && DISCRETE_EVENTS.has(type) && pendingRestores.length > 0) {
10134
10134
  if (hasPendingWork()) {
10135
10135
  if (VIEW_TRANSITION_DRIVER?.queueAllTransition() === true) flush();
10136
10136
  else flushSync(noop);
10137
10137
  }
10138
- if (pendingRestores.length > 0) restoreControlledStates();
10138
+ restoreControlledStates();
10139
10139
  }
10140
10140
  if (type === "click") activationCheckable = null;
10141
10141
  }
@@ -10154,9 +10154,7 @@ function finishCaptureDispatch(event) {
10154
10154
  maybeFlushDiscrete(type);
10155
10155
  }
10156
10156
  };
10157
- const target = event.target;
10158
- const checkableChange = type === "change" && target?.localName === "input" && (target.type === "checkbox" || target.type === "radio");
10159
- if (checkableChange) setTimeout(fallback, 0);
10157
+ if (event.isTrusted) setTimeout(fallback, 0);
10160
10158
  else queueMicrotask(fallback);
10161
10159
  }
10162
10160
  function dispatchDelegated(event) {
@@ -10667,9 +10665,8 @@ function setValue(el, value) {
10667
10665
  const prev = ctrl.v;
10668
10666
  ctrl.v = value;
10669
10667
  if (process.env.NODE_ENV !== "production") queueDevFormDiagnostic(el, CURRENT_SCOPE ?? void 0);
10668
+ if (!(ctrl.composing && Object.is(prev, value)) && valueNeedsWrite(input, value)) input.value = s;
10670
10669
  if (input.defaultValue !== s) input.defaultValue = s;
10671
- if (ctrl.composing && Object.is(prev, value)) return;
10672
- if (valueNeedsWrite(input, value)) input.value = s;
10673
10670
  }
10674
10671
  function setCheckedState(input, value, ctrl) {
10675
10672
  const first = !ctrl.sawC;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = "0.2.0";
1
+ const version = "0.2.2";
2
2
  export {
3
3
  version
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octane",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": [