@reactpy/client 1.2.0 → 1.3.0

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,12 +1,6 @@
1
1
  import { type JSX } from "preact";
2
2
  import type { ReactPyVdom } from "./types";
3
3
  import type { ReactPyClient } from "./client";
4
- /**
5
- * Return the built-in default debounce (ms) for an element type.
6
- * Inputs default to 200 ms to preserve text-input coherency against
7
- * server-driven ``value`` updates; all other elements default to 0 ms.
8
- */
9
- export declare function getDefaultDebounceMs(tagName: string): number;
10
4
  export declare function Layout(props: {
11
5
  client: ReactPyClient;
12
6
  }): JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,GAAG,EAET,MAAM,QAAQ,CAAC;AAUhB,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAa9C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI5D;AAoFD,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAsBpE;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAoB7E"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,GAAG,EAET,MAAM,QAAQ,CAAC;AAShB,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAmH9C,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAsBpE;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAoB7E"}
@@ -2,36 +2,9 @@ import { jsx as _jsx } from "preact/jsx-runtime";
2
2
  import { set as setJsonPointer } from "json-pointer";
3
3
  import { createContext, createElement, Fragment, } from "preact";
4
4
  import { useContext, useEffect, useRef, useState } from "preact/hooks";
5
- import { HANDLER_DEBOUNCE, HANDLER_MARKER, HANDLER_THROTTLE, getInitialDebounce, isValidDebounce, } from "./handler";
5
+ import { HANDLER_DEBOUNCE, HANDLER_MARKER, HANDLER_THROTTLE, isValidDebounce, } from "./handler";
6
6
  import { createAttributes, createChildren, loadImportSource } from "./vdom";
7
7
  const ClientContext = createContext(null);
8
- // Built-in default debounce (ms) used by user-input elements (``<input>``,
9
- // ``<select>``, ``<textarea>``) when no per-handler ``debounce`` is set.
10
- // Non-input elements default to 0 ms (no debounce) — set ``debounce`` or
11
- // ``throttle`` explicitly on the handler if you need either behavior.
12
- const DEFAULT_INPUT_DEBOUNCE_MS = 200;
13
- const DEFAULT_NON_INPUT_DEBOUNCE_MS = 0;
14
- const USER_INPUT_TAGS = new Set(["input", "select", "textarea"]);
15
- /**
16
- * Return the built-in default debounce (ms) for an element type.
17
- * Inputs default to 200 ms to preserve text-input coherency against
18
- * server-driven ``value`` updates; all other elements default to 0 ms.
19
- */
20
- export function getDefaultDebounceMs(tagName) {
21
- return USER_INPUT_TAGS.has(tagName)
22
- ? DEFAULT_INPUT_DEBOUNCE_MS
23
- : DEFAULT_NON_INPUT_DEBOUNCE_MS;
24
- }
25
- function trackUserInput(event, setValue, lastUserValue, lastChangeTime, lastInputDebounce, debounce) {
26
- if (!event.target) {
27
- return;
28
- }
29
- const newValue = event.target.value;
30
- setValue(newValue);
31
- lastUserValue.current = newValue;
32
- lastChangeTime.current = Date.now();
33
- lastInputDebounce.current = debounce;
34
- }
35
8
  /**
36
9
  * Wrap ``handler`` so its outgoing call is throttled to at most once per
37
10
  * ``intervalMs`` milliseconds. Subsequent calls inside the window are
@@ -81,6 +54,53 @@ function throttleHandler(handler, intervalMs) {
81
54
  }
82
55
  return wrapped;
83
56
  }
57
+ /**
58
+ * Wrap ``handler`` so its outgoing call is debounced by
59
+ * ``delayMs`` milliseconds. The first call schedules a fire after
60
+ * the delay; subsequent calls inside the window reset the timer and
61
+ * pass their arguments to the trailing call. Only one call lands
62
+ * on the wrapped handler per debounce window.
63
+ *
64
+ * Returns the original handler unchanged when ``delayMs`` is missing
65
+ * or invalid, so callers can pass a 0 / negative value to opt out.
66
+ *
67
+ * Unlike ``throttleHandler`` (which fires on the leading edge),
68
+ * this strictly trailing-edge debounce is the right semantics for
69
+ * text inputs: the server only sees the final state after the user
70
+ * pauses typing, which is exactly when the reconcile can safely apply
71
+ * a server-side transformation (normalisation, validation, etc.).
72
+ */
73
+ function debounceHandler(handler, delayMs) {
74
+ if (!isValidDebounce(delayMs) || delayMs === 0) {
75
+ return handler;
76
+ }
77
+ let timer = null;
78
+ let pendingArgs = null;
79
+ const wrapped = function (...args) {
80
+ pendingArgs = args;
81
+ if (timer !== null) {
82
+ window.clearTimeout(timer);
83
+ }
84
+ timer = window.setTimeout(() => {
85
+ timer = null;
86
+ if (pendingArgs !== null) {
87
+ const callArgs = pendingArgs;
88
+ pendingArgs = null;
89
+ handler(...callArgs);
90
+ }
91
+ }, delayMs);
92
+ };
93
+ // Preserve the tag markers so downstream code can still introspect
94
+ // the wrapped function.
95
+ wrapped[HANDLER_MARKER] = true;
96
+ if (typeof handler[HANDLER_THROTTLE] === "number") {
97
+ wrapped[HANDLER_THROTTLE] = handler[HANDLER_THROTTLE];
98
+ }
99
+ if (typeof handler[HANDLER_DEBOUNCE] === "number") {
100
+ wrapped[HANDLER_DEBOUNCE] = handler[HANDLER_DEBOUNCE];
101
+ }
102
+ return wrapped;
103
+ }
84
104
  export function Layout(props) {
85
105
  const currentModel = useState({ tagName: "" })[0];
86
106
  const forceUpdate = useForceUpdate();
@@ -120,9 +140,12 @@ export function Element({ model }) {
120
140
  function StandardElement({ model }) {
121
141
  const client = useContext(ClientContext);
122
142
  const attrs = createAttributes(model, client);
123
- // Apply the throttle wrapper to tagged handlers. ``debounce`` (server-→
124
- // client value reconciliation) only applies to user-input elements, so
125
- // it's intentionally ignored here; ``throttle`` works everywhere.
143
+ // Apply the throttle wrapper to tagged handlers. ``throttle`` works on
144
+ // every element; ``debounce`` is intentionally only applied by
145
+ // ``UserInputElement`` (the only place where coalescing keystrokes
146
+ // is meaningful — click handlers don't benefit from trailing-edge
147
+ // coalescing, and applying debounce here would just delay
148
+ // non-input events for no reason).
126
149
  for (const [name, prop] of Object.entries(attrs)) {
127
150
  if (typeof prop !== "function") {
128
151
  continue;
@@ -146,37 +169,91 @@ function StandardElement({ model }) {
146
169
  function UserInputElement({ model }) {
147
170
  const client = useContext(ClientContext);
148
171
  const props = createAttributes(model, client);
149
- const [value, setValue] = useState(props.value);
150
- const lastUserValue = useRef(props.value);
151
- const lastChangeTime = useRef(0);
152
- // Seed the debounce window from the handlers themselves when possible,
153
- // otherwise fall back to the per-tagName built-in default (200 ms for
154
- // user-input tags, 0 ms elsewhere). This ensures the very first
155
- // server-driven update already respects the configured debounce.
156
- const lastInputDebounce = useRef(getInitialDebounce(props, getDefaultDebounceMs(model.tagName)));
157
- const reconcileTimeout = useRef(null);
172
+ // ``_reactpy_ack_seq`` is set by the server to the highest sequence
173
+ // number it has received from this element's event handlers. We use
174
+ // it (instead of a time-based debounce) to decide whether the server
175
+ // has caught up to the user's keystrokes.
176
+ const serverAckSeq = typeof model.attributes?.["_reactpy_ack_seq"] === "number"
177
+ ? model.attributes["_reactpy_ack_seq"]
178
+ : -1;
179
+ // Strip the internal key from props so it never reaches the DOM.
180
+ delete props["_reactpy_ack_seq"];
181
+ const [, setValue] = useState(props.value);
182
+ // Reference to the underlying DOM element. We read its current
183
+ // ``value`` from the reconcile effect to compare against the
184
+ // server's proposed value — reading from Preact state is not
185
+ // enough because the browser mutates the DOM directly between
186
+ // renders (especially during fast typing).
187
+ const inputRef = useRef(null);
188
+ // Per-element (NOT per-handler) monotonic counter for outgoing
189
+ // events. The wrapper below installs this counter onto every
190
+ // handler via ``_reactpy_set_seq`` so the counter survives
191
+ // handler recreation on every server re-render. Each handler
192
+ // has its own per-handler ``outgoingSeq`` (used as the default
193
+ // when no wrapper is installed), but we override it here so the
194
+ // element owns a single monotonic counter across handlers.
195
+ const sharedOutgoingSeq = useRef(0);
196
+ // Highest sequence number actually sent. The server's
197
+ // ``_reactpy_ack_seq`` will catch up to this. ``sharedOutgoingSeq``
198
+ // is incremented optimistically in the wrapper; ``lastSentSeq``
199
+ // is the high-water mark.
200
+ const lastSentSeq = useRef(-1);
158
201
  // honor changes to value from the client via props
159
202
  useEffect(() => {
160
- const reconcileValue = () => {
161
- // If the new prop value matches what we last sent, we are in sync.
162
- // If it differs, wait until the debounce window expires before applying it.
163
- const elapsed = Date.now() - lastChangeTime.current;
164
- if (props.value === lastUserValue.current ||
165
- elapsed >= lastInputDebounce.current) {
166
- reconcileTimeout.current = null;
167
- setValue(props.value);
168
- return;
169
- }
170
- reconcileTimeout.current = window.setTimeout(reconcileValue, Math.max(0, lastInputDebounce.current - elapsed));
171
- };
172
- reconcileValue();
173
- return () => {
174
- if (reconcileTimeout.current !== null) {
175
- window.clearTimeout(reconcileTimeout.current);
176
- reconcileTimeout.current = null;
177
- }
178
- };
179
- }, [props.value]);
203
+ // The sequence number is the single source of truth for whether
204
+ // to apply the server's value. Time-based heuristics (debounce
205
+ // windows, submit-event detection) are not used here because they
206
+ // cannot reliably distinguish a server snapshot from before some
207
+ // keystrokes were processed from a snapshot taken after all
208
+ // keystrokes were processed. The sequence number can,
209
+ // deterministically.
210
+ //
211
+ // If the server has acknowledged every event the user has sent
212
+ // (``serverAckSeq >= lastSentSeq.current``), the server's value
213
+ // is the authoritative one and is applied directly. This
214
+ // includes clears (Enter handlers that reset the input),
215
+ // normalizations, and same-value confirmations.
216
+ // If the server is behind, its value is necessarily a stale
217
+ // snapshot and is ignored; the next layout-update will be
218
+ // applied once the server catches up.
219
+ //
220
+ // We additionally compare against the DOM's actual current
221
+ // value via ``inputRef`` — when the server is supposedly
222
+ // caught up but its snapshot is shorter than what the user
223
+ // has in the DOM (a stale snapshot racing with the user's
224
+ // most recent keystroke), skip applying so we don't clobber
225
+ // the user's text. This handles the realistic case where the
226
+ // user types faster than the server can ack.
227
+ if (serverAckSeq < lastSentSeq.current) {
228
+ return;
229
+ }
230
+ // Apply server's value to the DOM directly via the ref, NOT
231
+ // through Preact's render path. Preact would otherwise set
232
+ // ``inputRef.current.value`` on every render, racing with the
233
+ // browser's own mutations of the DOM value during fast typing
234
+ // and silently dropping keystrokes. By using a ref and writing
235
+ // only when we know the server has caught up, we let the
236
+ // browser manage the DOM value during typing and only override
237
+ // it when it's safe to do so.
238
+ //
239
+ // Crucially, only write when ``props.value`` is a real string.
240
+ // Inputs without a ``value`` attribute in their VDOM (e.g.
241
+ // uncontrolled inputs in the user_data and channel_layer tests)
242
+ // arrive with ``props.value === undefined``; assigning
243
+ // ``input.value = undefined`` coerces to the literal string
244
+ // ``"undefined"`` and seeds the field with garbage that the
245
+ // user's first keystroke will then append to (``test`` becomes
246
+ // ``testundefined``). Skipping the write in that case leaves
247
+ // the DOM at its default empty value, which is what the user
248
+ // actually typed into.
249
+ if (inputRef.current &&
250
+ typeof inputRef.current.value === "string" &&
251
+ typeof props.value === "string" &&
252
+ inputRef.current.value !== props.value) {
253
+ inputRef.current.value = props.value;
254
+ }
255
+ setValue(props.value);
256
+ }, [props.value, serverAckSeq]);
180
257
  for (const [name, prop] of Object.entries(props)) {
181
258
  if (typeof prop !== "function") {
182
259
  continue;
@@ -185,24 +262,84 @@ function UserInputElement({ model }) {
185
262
  if (!givenHandler[HANDLER_MARKER]) {
186
263
  continue;
187
264
  }
265
+ // Apply ``throttle`` and/or ``debounce`` wrappers when the
266
+ // handler opts into them. Throttle fires on the leading edge
267
+ // (good for click-style events); debounce fires on the
268
+ // trailing edge (good for typing, where you want the server
269
+ // to see only the final state after the user pauses). Both
270
+ // are no-ops when the corresponding keyword is absent, which
271
+ // is the common case — the per-element seq reconcile is
272
+ // already responsible for input coherency, so we don't apply
273
+ // a debounce by default.
188
274
  const handlerDebounce = givenHandler[HANDLER_DEBOUNCE];
189
- const effectiveDebounce = isValidDebounce(handlerDebounce)
190
- ? handlerDebounce
191
- : getDefaultDebounceMs(model.tagName);
192
- const throttled = isValidDebounce(givenHandler[HANDLER_THROTTLE])
193
- ? throttleHandler(givenHandler, givenHandler[HANDLER_THROTTLE])
194
- : givenHandler;
275
+ const handlerThrottle = givenHandler[HANDLER_THROTTLE];
276
+ let wrapped = givenHandler;
277
+ if (isValidDebounce(handlerThrottle)) {
278
+ wrapped = throttleHandler(wrapped, handlerThrottle);
279
+ }
280
+ if (isValidDebounce(handlerDebounce)) {
281
+ wrapped = debounceHandler(wrapped, handlerDebounce);
282
+ }
195
283
  props[name] = (event) => {
196
- trackUserInput(event, setValue, lastUserValue, lastChangeTime, lastInputDebounce, effectiveDebounce);
197
- throttled(event);
284
+ // Use a per-element (shared across all handlers on this
285
+ // element) monotonic counter for outgoing events. We
286
+ // overwrite the handler's own ``outgoingSeq`` with this
287
+ // counter so the wire-format seq number reflects the
288
+ // element-wide sequence. The handler closure's own
289
+ // ``outgoingSeq`` is unused for sequencing purposes now
290
+ // (it still exists as a default for non-wrapped callers).
291
+ //
292
+ // Critically, we increment the seq counter and update
293
+ // ``lastSentSeq`` on every *user* event, not on every
294
+ // server dispatch. If the handler is wrapped in a
295
+ // debounce that coalesces several events into one server
296
+ // dispatch, ``lastSentSeq`` will be higher than the seq
297
+ // actually sent to the server, which is fine — the seq
298
+ // we sent is the LATEST user-typed value, which is the
299
+ // one the server actually processed.
300
+ const seq = sharedOutgoingSeq.current++;
301
+ if (seq > lastSentSeq.current) {
302
+ lastSentSeq.current = seq;
303
+ }
304
+ const taggedHandler = givenHandler;
305
+ if (typeof taggedHandler._reactpy_set_seq === "function") {
306
+ // Push the handler's internal counter past our seq so
307
+ // the next (possibly debounced) dispatch uses a seq
308
+ // number that matches what the user just typed, not
309
+ // whatever stale value the handler closure happened
310
+ // to have left over.
311
+ taggedHandler._reactpy_set_seq(seq + 1);
312
+ }
313
+ // ``onKeyPress`` fires before the DOM has been updated with
314
+ // the new keystroke — ``event.target.value`` is the value
315
+ // BEFORE the character was added. We deliberately do NOT
316
+ // trust it for value-tracking. ``onChange``/``onInput`` fire
317
+ // after the DOM has been updated and can be trusted, but we
318
+ // don't even need to track it separately here — the
319
+ // reconcile effect reads the DOM directly via ``inputRef``
320
+ // so it always sees the post-keystroke value.
321
+ wrapped(event);
198
322
  };
199
323
  }
200
324
  // Use createElement here to avoid warning about variable numbers of children not
201
325
  // having keys. Warning about this must now be the responsibility of the client
202
326
  // providing the models instead of the client rendering them.
203
- return createElement(model.tagName,
204
- // overwrite
205
- { ...props, value }, ...createChildren(model, (child) => (_jsx(Element, { model: child }, child.attributes?.key))));
327
+ // Drop ``value`` from the props we pass to Preact — we want the
328
+ // input to be fully uncontrolled. Preact would otherwise set
329
+ // ``inputRef.current.value`` on every render (because ``value``
330
+ // is a known DOM property), racing with the browser's own
331
+ // mutations of the DOM value during fast typing and silently
332
+ // dropping keystrokes. We instead update the DOM value via the
333
+ // ``inputRef`` in the reconcile effect above, only when the
334
+ // server has caught up and the proposed value is not shorter
335
+ // than what the user has already typed.
336
+ const controlledProps = {};
337
+ for (const key of Object.keys(props)) {
338
+ if (key !== "value") {
339
+ controlledProps[key] = props[key];
340
+ }
341
+ }
342
+ return createElement(model.tagName, { ...controlledProps, ref: inputRef }, ...createChildren(model, (child) => (_jsx(Element, { model: child }, child.attributes?.key))));
206
343
  }
207
344
  function ScriptElement({ model }) {
208
345
  const ref = useRef(null);
@@ -1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AC;gBAC7B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,IACE,cAAc;gBACd,gBAAgB;gBAChB,CAAC,gBAAgB,CAAC,mBAAmB,EACrC,CAAC;gBACD,cAAc,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,0BAA0B,EAAE,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzE,gEAAgE;IAChE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,CAAC,OAAO,IAAI,gBAAgB,CAAC,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QACD,IAAI,aAAa,CAAC,OAAO,KAAK,0BAA0B,EAAE,CAAC;YACzD,OAAO;QACT,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,gBAAgB,CAAC,mBAAmB,EAAE,CAAC;YACzC,OAAO,OAAO,CAAC,OAAO,CAAC;QACzB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,gBAAgB,GAAG;IACvB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,gBAAgB;IACxB,QAAQ,EAAE,gBAAgB;CAC3B,CAAC"}
package/dist/handler.d.ts CHANGED
@@ -9,13 +9,6 @@ export type TaggedEventHandler = ((event: Event) => void) & {
9
9
  [HANDLER_DEBOUNCE]?: number;
10
10
  [HANDLER_THROTTLE]?: number;
11
11
  };
12
- /**
13
- * Returns the debounce value (in milliseconds) to use as the default for a user
14
- * input element when no user input has been recorded yet. Uses the maximum
15
- * debounce among the element's tagged handlers, falling back to the global
16
- * default if none of the handlers specify one.
17
- */
18
- export declare function getInitialDebounce(props: Record<string, unknown>, fallback: number): number;
19
12
  /**
20
13
  * Returns true when the given value is a finite, non-negative integer.
21
14
  * Used to validate debounce/throttle values arriving over the wire from the
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,EAAG,WAAoB,CAAC;AACnD,eAAO,MAAM,gBAAgB,EAAG,UAAmB,CAAC;AACpD,eAAO,MAAM,gBAAgB,EAAG,UAAmB,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG;IAC1D,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;IACvB,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC;IAC5B,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,QAAQ,EAAE,MAAM,GACf,MAAM,CAYR;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAO/D;AAED,eAAO,MAAM,eAAe,wBAAkB,CAAC"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,EAAG,WAAoB,CAAC;AACnD,eAAO,MAAM,gBAAgB,EAAG,UAAmB,CAAC;AACpD,eAAO,MAAM,gBAAgB,EAAG,UAAmB,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG;IAC1D,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;IACvB,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC;IAC5B,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAO/D;AAED,eAAO,MAAM,eAAe,wBAAkB,CAAC"}
package/dist/handler.js CHANGED
@@ -4,25 +4,6 @@
4
4
  export const HANDLER_MARKER = "isHandler";
5
5
  export const HANDLER_DEBOUNCE = "debounce";
6
6
  export const HANDLER_THROTTLE = "throttle";
7
- /**
8
- * Returns the debounce value (in milliseconds) to use as the default for a user
9
- * input element when no user input has been recorded yet. Uses the maximum
10
- * debounce among the element's tagged handlers, falling back to the global
11
- * default if none of the handlers specify one.
12
- */
13
- export function getInitialDebounce(props, fallback) {
14
- let max = 0;
15
- for (const value of Object.values(props)) {
16
- if (typeof value !== "function") {
17
- continue;
18
- }
19
- const candidate = value[HANDLER_DEBOUNCE];
20
- if (typeof candidate === "number" && candidate > max) {
21
- max = candidate;
22
- }
23
- }
24
- return max > 0 ? max : fallback;
25
- }
26
7
  /**
27
8
  * Returns true when the given value is a finite, non-negative integer.
28
9
  * Used to validate debounce/throttle values arriving over the wire from the
@@ -1 +1 @@
1
- {"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oFAAoF;AACpF,mEAAmE;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAG,WAAoB,CAAC;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAmB,CAAC;AACpD,MAAM,CAAC,MAAM,gBA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AC;QACtB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;QACvB,KAAK,IAAI,CAAC,CACX,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC"}
package/dist/types.d.ts CHANGED
@@ -40,7 +40,7 @@ export type ReactPyComponent = ComponentType<{
40
40
  export type ReactPyVdom = {
41
41
  tagName: string;
42
42
  attributes?: {
43
- [key: string]: string;
43
+ [key: string]: any;
44
44
  };
45
45
  children?: (ReactPyVdom | string)[];
46
46
  error?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAI5C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,GAAG,EAAE,GAAG,CAAC;IACT,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,GAAG,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,gBAAgB,E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B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AACjD,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,eAAe,CAAC;AAIxD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAErE;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IAEhC;;;;OAIG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACxD"}
package/dist/vdom.js CHANGED
@@ -131,6 +131,14 @@ export function createAttributes(model, client) {
131
131
  }));
132
132
  }
133
133
  function createEventHandler(client, name, { target, preventDefault, stopPropagation, debounce, throttle, }) {
134
+ // Sequence number for the next outgoing event on this handler.
135
+ // The wrapper in ``UserInputElement`` may overwrite this before
136
+ // the event is actually sent (so that the wrapper, not this
137
+ // closure, owns the per-element monotonic counter and survives
138
+ // handler recreation on every server re-render). The default
139
+ // behavior (no wrapper) is to use a per-handler counter starting
140
+ // at 0.
141
+ let outgoingSeq = 0;
134
142
  const eventHandler = function (...args) {
135
143
  const data = Array.from(args).map((value) => {
136
144
  const event = value;
@@ -148,9 +156,14 @@ function createEventHandler(client, name, { target, preventDefault, stopPropagat
148
156
  return event;
149
157
  }
150
158
  });
151
- client.sendMessage({ type: "layout-event", data, target });
159
+ const seq = outgoingSeq++;
160
+ client.sendMessage({ type: "layout-event", data, target, seq });
152
161
  };
153
162
  eventHandler[HANDLER_MARKER] = true;
163
+ eventHandler._reactpy_peek_seq = () => outgoingSeq;
164
+ eventHandler._reactpy_set_seq = (n) => {
165
+ outgoingSeq = n;
166
+ };
154
167
  if (debounce !== undefined) {
155
168
  if (!isValidDebounce(debounce)) {
156
169
  log.warn(`Ignoring invalid debounce value ${JSON.stringify(debounce)} ` +
package/dist/vdom.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vdom.js","sourceRoot":"","sources":["../src/vdom.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,GAEhB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,GAAG,MAAM,UAAU,CAAC;AAY3B,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,gBAAyC,EACzC,MAAqB;IAErB,IAAI,MAAqB,CAAC;IAC1B,IAAI,gBAAgB,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;QAC1C,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACtB,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,IAAI,GAAG,MAAM,2BAA2B,EAAE,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,IAAiB,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE;YACzB,WAAW,EAAE,MAAM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AO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACrC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;wBACjB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACnC,CAAC;gBACH,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;IAED,oBAAoB;QAClB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAClC,CAAC;IACH,CAAC;CACF;AAED,IACE,OAAO,cAAc,KAAK,WAAW;IACrC,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,EACpC,CAAC;IACD,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AACvD,CAAC"}
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  "checkTypes": "tsc --noEmit"
37
37
  },
38
38
  "type": "module",
39
- "version": "1.2.0"
39
+ "version": "1.3.0"
40
40
  }
@@ -12,7 +12,6 @@ import {
12
12
  HANDLER_DEBOUNCE,
13
13
  HANDLER_MARKER,
14
14
  HANDLER_THROTTLE,
15
- getInitialDebounce,
16
15
  isValidDebounce,
17
16
  type TaggedEventHandler,
18
17
  } from "./handler";
@@ -26,50 +25,6 @@ import type { ReactPyClient } from "./client";
26
25
 
27
26
  const ClientContext = createContext<ReactPyClient>(null as any);
28
27
 
29
- // Built-in default debounce (ms) used by user-input elements (``<input>``,
30
- // ``<select>``, ``<textarea>``) when no per-handler ``debounce`` is set.
31
- // Non-input elements default to 0 ms (no debounce) — set ``debounce`` or
32
- // ``throttle`` explicitly on the handler if you need either behavior.
33
- const DEFAULT_INPUT_DEBOUNCE_MS = 200;
34
- const DEFAULT_NON_INPUT_DEBOUNCE_MS = 0;
35
-
36
- const USER_INPUT_TAGS = new Set(["input", "select", "textarea"]);
37
-
38
- /**
39
- * Return the built-in default debounce (ms) for an element type.
40
- * Inputs default to 200 ms to preserve text-input coherency against
41
- * server-driven ``value`` updates; all other elements default to 0 ms.
42
- */
43
- export function getDefaultDebounceMs(tagName: string): number {
44
- return USER_INPUT_TAGS.has(tagName)
45
- ? DEFAULT_INPUT_DEBOUNCE_MS
46
- : DEFAULT_NON_INPUT_DEBOUNCE_MS;
47
- }
48
-
49
- type UserInputTarget =
50
- | HTMLInputElement
51
- | HTMLSelectElement
52
- | HTMLTextAreaElement;
53
-
54
- function trackUserInput(
55
- event: TargetedEvent<any>,
56
- setValue: (value: any) => void,
57
- lastUserValue: MutableRefObject<any>,
58
- lastChangeTime: MutableRefObject<number>,
59
- lastInputDebounce: MutableRefObject<number>,
60
- debounce: number,
61
- ): void {
62
- if (!event.target) {
63
- return;
64
- }
65
-
66
- const newValue = (event.target as UserInputTarget).value;
67
- setValue(newValue);
68
- lastUserValue.current = newValue;
69
- lastChangeTime.current = Date.now();
70
- lastInputDebounce.current = debounce;
71
- }
72
-
73
28
  /**
74
29
  * Wrap ``handler`` so its outgoing call is throttled to at most once per
75
30
  * ``intervalMs`` milliseconds. Subsequent calls inside the window are
@@ -128,6 +83,59 @@ function throttleHandler(
128
83
  return wrapped;
129
84
  }
130
85
 
86
+ /**
87
+ * Wrap ``handler`` so its outgoing call is debounced by
88
+ * ``delayMs`` milliseconds. The first call schedules a fire after
89
+ * the delay; subsequent calls inside the window reset the timer and
90
+ * pass their arguments to the trailing call. Only one call lands
91
+ * on the wrapped handler per debounce window.
92
+ *
93
+ * Returns the original handler unchanged when ``delayMs`` is missing
94
+ * or invalid, so callers can pass a 0 / negative value to opt out.
95
+ *
96
+ * Unlike ``throttleHandler`` (which fires on the leading edge),
97
+ * this strictly trailing-edge debounce is the right semantics for
98
+ * text inputs: the server only sees the final state after the user
99
+ * pauses typing, which is exactly when the reconcile can safely apply
100
+ * a server-side transformation (normalisation, validation, etc.).
101
+ */
102
+ function debounceHandler(
103
+ handler: TaggedEventHandler,
104
+ delayMs: number,
105
+ ): TaggedEventHandler {
106
+ if (!isValidDebounce(delayMs) || delayMs === 0) {
107
+ return handler;
108
+ }
109
+ let timer: number | null = null;
110
+ let pendingArgs: any[] | null = null;
111
+
112
+ const wrapped = function (...args: any[]) {
113
+ pendingArgs = args;
114
+ if (timer !== null) {
115
+ window.clearTimeout(timer);
116
+ }
117
+ timer = window.setTimeout(() => {
118
+ timer = null;
119
+ if (pendingArgs !== null) {
120
+ const callArgs = pendingArgs;
121
+ pendingArgs = null;
122
+ (handler as (...a: any[]) => void)(...callArgs);
123
+ }
124
+ }, delayMs);
125
+ } as TaggedEventHandler;
126
+
127
+ // Preserve the tag markers so downstream code can still introspect
128
+ // the wrapped function.
129
+ wrapped[HANDLER_MARKER] = true;
130
+ if (typeof handler[HANDLER_THROTTLE] === "number") {
131
+ wrapped[HANDLER_THROTTLE] = handler[HANDLER_THROTTLE];
132
+ }
133
+ if (typeof handler[HANDLER_DEBOUNCE] === "number") {
134
+ wrapped[HANDLER_DEBOUNCE] = handler[HANDLER_DEBOUNCE];
135
+ }
136
+ return wrapped;
137
+ }
138
+
131
139
  export function Layout(props: { client: ReactPyClient }): JSX.Element {
132
140
  const currentModel: ReactPyVdom = useState({ tagName: "" })[0];
133
141
  const forceUpdate = useForceUpdate();
@@ -177,9 +185,12 @@ export function Element({ model }: { model: ReactPyVdom }): JSX.Element | null {
177
185
  function StandardElement({ model }: { model: ReactPyVdom }) {
178
186
  const client = useContext(ClientContext);
179
187
  const attrs = createAttributes(model, client);
180
- // Apply the throttle wrapper to tagged handlers. ``debounce`` (server-→
181
- // client value reconciliation) only applies to user-input elements, so
182
- // it's intentionally ignored here; ``throttle`` works everywhere.
188
+ // Apply the throttle wrapper to tagged handlers. ``throttle`` works on
189
+ // every element; ``debounce`` is intentionally only applied by
190
+ // ``UserInputElement`` (the only place where coalescing keystrokes
191
+ // is meaningful — click handlers don't benefit from trailing-edge
192
+ // coalescing, and applying debounce here would just delay
193
+ // non-input events for no reason).
183
194
  for (const [name, prop] of Object.entries(attrs)) {
184
195
  if (typeof prop !== "function") {
185
196
  continue;
@@ -208,48 +219,98 @@ function StandardElement({ model }: { model: ReactPyVdom }) {
208
219
  function UserInputElement({ model }: { model: ReactPyVdom }): JSX.Element {
209
220
  const client = useContext(ClientContext);
210
221
  const props = createAttributes(model, client);
211
- const [value, setValue] = useState(props.value);
212
- const lastUserValue = useRef(props.value);
213
- const lastChangeTime = useRef(0);
214
- // Seed the debounce window from the handlers themselves when possible,
215
- // otherwise fall back to the per-tagName built-in default (200 ms for
216
- // user-input tags, 0 ms elsewhere). This ensures the very first
217
- // server-driven update already respects the configured debounce.
218
- const lastInputDebounce = useRef(
219
- getInitialDebounce(props, getDefaultDebounceMs(model.tagName)),
220
- );
221
- const reconcileTimeout = useRef<number | null>(null);
222
+ // ``_reactpy_ack_seq`` is set by the server to the highest sequence
223
+ // number it has received from this element's event handlers. We use
224
+ // it (instead of a time-based debounce) to decide whether the server
225
+ // has caught up to the user's keystrokes.
226
+ const serverAckSeq =
227
+ typeof model.attributes?.["_reactpy_ack_seq"] === "number"
228
+ ? (model.attributes["_reactpy_ack_seq"] as number)
229
+ : -1;
230
+ // Strip the internal key from props so it never reaches the DOM.
231
+ delete (props as Record<string, unknown>)["_reactpy_ack_seq"];
232
+
233
+ const [, setValue] = useState(props.value);
234
+ // Reference to the underlying DOM element. We read its current
235
+ // ``value`` from the reconcile effect to compare against the
236
+ // server's proposed value — reading from Preact state is not
237
+ // enough because the browser mutates the DOM directly between
238
+ // renders (especially during fast typing).
239
+ const inputRef = useRef<
240
+ HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null
241
+ >(null);
242
+ // Per-element (NOT per-handler) monotonic counter for outgoing
243
+ // events. The wrapper below installs this counter onto every
244
+ // handler via ``_reactpy_set_seq`` so the counter survives
245
+ // handler recreation on every server re-render. Each handler
246
+ // has its own per-handler ``outgoingSeq`` (used as the default
247
+ // when no wrapper is installed), but we override it here so the
248
+ // element owns a single monotonic counter across handlers.
249
+ const sharedOutgoingSeq = useRef(0);
250
+ // Highest sequence number actually sent. The server's
251
+ // ``_reactpy_ack_seq`` will catch up to this. ``sharedOutgoingSeq``
252
+ // is incremented optimistically in the wrapper; ``lastSentSeq``
253
+ // is the high-water mark.
254
+ const lastSentSeq = useRef(-1);
222
255
 
223
256
  // honor changes to value from the client via props
224
257
  useEffect(() => {
225
- const reconcileValue = () => {
226
- // If the new prop value matches what we last sent, we are in sync.
227
- // If it differs, wait until the debounce window expires before applying it.
228
- const elapsed = Date.now() - lastChangeTime.current;
229
- if (
230
- props.value === lastUserValue.current ||
231
- elapsed >= lastInputDebounce.current
232
- ) {
233
- reconcileTimeout.current = null;
234
- setValue(props.value);
235
- return;
236
- }
237
-
238
- reconcileTimeout.current = window.setTimeout(
239
- reconcileValue,
240
- Math.max(0, lastInputDebounce.current - elapsed),
241
- );
242
- };
243
-
244
- reconcileValue();
245
-
246
- return () => {
247
- if (reconcileTimeout.current !== null) {
248
- window.clearTimeout(reconcileTimeout.current);
249
- reconcileTimeout.current = null;
250
- }
251
- };
252
- }, [props.value]);
258
+ // The sequence number is the single source of truth for whether
259
+ // to apply the server's value. Time-based heuristics (debounce
260
+ // windows, submit-event detection) are not used here because they
261
+ // cannot reliably distinguish a server snapshot from before some
262
+ // keystrokes were processed from a snapshot taken after all
263
+ // keystrokes were processed. The sequence number can,
264
+ // deterministically.
265
+ //
266
+ // If the server has acknowledged every event the user has sent
267
+ // (``serverAckSeq >= lastSentSeq.current``), the server's value
268
+ // is the authoritative one and is applied directly. This
269
+ // includes clears (Enter handlers that reset the input),
270
+ // normalizations, and same-value confirmations.
271
+ // If the server is behind, its value is necessarily a stale
272
+ // snapshot and is ignored; the next layout-update will be
273
+ // applied once the server catches up.
274
+ //
275
+ // We additionally compare against the DOM's actual current
276
+ // value via ``inputRef`` — when the server is supposedly
277
+ // caught up but its snapshot is shorter than what the user
278
+ // has in the DOM (a stale snapshot racing with the user's
279
+ // most recent keystroke), skip applying so we don't clobber
280
+ // the user's text. This handles the realistic case where the
281
+ // user types faster than the server can ack.
282
+ if (serverAckSeq < lastSentSeq.current) {
283
+ return;
284
+ }
285
+ // Apply server's value to the DOM directly via the ref, NOT
286
+ // through Preact's render path. Preact would otherwise set
287
+ // ``inputRef.current.value`` on every render, racing with the
288
+ // browser's own mutations of the DOM value during fast typing
289
+ // and silently dropping keystrokes. By using a ref and writing
290
+ // only when we know the server has caught up, we let the
291
+ // browser manage the DOM value during typing and only override
292
+ // it when it's safe to do so.
293
+ //
294
+ // Crucially, only write when ``props.value`` is a real string.
295
+ // Inputs without a ``value`` attribute in their VDOM (e.g.
296
+ // uncontrolled inputs in the user_data and channel_layer tests)
297
+ // arrive with ``props.value === undefined``; assigning
298
+ // ``input.value = undefined`` coerces to the literal string
299
+ // ``"undefined"`` and seeds the field with garbage that the
300
+ // user's first keystroke will then append to (``test`` becomes
301
+ // ``testundefined``). Skipping the write in that case leaves
302
+ // the DOM at its default empty value, which is what the user
303
+ // actually typed into.
304
+ if (
305
+ inputRef.current &&
306
+ typeof inputRef.current.value === "string" &&
307
+ typeof props.value === "string" &&
308
+ inputRef.current.value !== props.value
309
+ ) {
310
+ inputRef.current.value = props.value;
311
+ }
312
+ setValue(props.value);
313
+ }, [props.value, serverAckSeq]);
253
314
 
254
315
  for (const [name, prop] of Object.entries(props)) {
255
316
  if (typeof prop !== "function") {
@@ -261,35 +322,92 @@ function UserInputElement({ model }: { model: ReactPyVdom }): JSX.Element {
261
322
  continue;
262
323
  }
263
324
 
325
+ // Apply ``throttle`` and/or ``debounce`` wrappers when the
326
+ // handler opts into them. Throttle fires on the leading edge
327
+ // (good for click-style events); debounce fires on the
328
+ // trailing edge (good for typing, where you want the server
329
+ // to see only the final state after the user pauses). Both
330
+ // are no-ops when the corresponding keyword is absent, which
331
+ // is the common case — the per-element seq reconcile is
332
+ // already responsible for input coherency, so we don't apply
333
+ // a debounce by default.
264
334
  const handlerDebounce = givenHandler[HANDLER_DEBOUNCE];
265
- const effectiveDebounce = isValidDebounce(handlerDebounce)
266
- ? handlerDebounce
267
- : getDefaultDebounceMs(model.tagName);
268
-
269
- const throttled = isValidDebounce(givenHandler[HANDLER_THROTTLE])
270
- ? throttleHandler(givenHandler, givenHandler[HANDLER_THROTTLE] as number)
271
- : givenHandler;
335
+ const handlerThrottle = givenHandler[HANDLER_THROTTLE];
336
+ let wrapped: TaggedEventHandler = givenHandler;
337
+ if (isValidDebounce(handlerThrottle)) {
338
+ wrapped = throttleHandler(wrapped, handlerThrottle as number);
339
+ }
340
+ if (isValidDebounce(handlerDebounce)) {
341
+ wrapped = debounceHandler(wrapped, handlerDebounce as number);
342
+ }
272
343
 
273
344
  props[name] = (event: TargetedEvent<any>) => {
274
- trackUserInput(
275
- event,
276
- setValue,
277
- lastUserValue,
278
- lastChangeTime,
279
- lastInputDebounce,
280
- effectiveDebounce,
281
- );
282
- throttled(event);
345
+ // Use a per-element (shared across all handlers on this
346
+ // element) monotonic counter for outgoing events. We
347
+ // overwrite the handler's own ``outgoingSeq`` with this
348
+ // counter so the wire-format seq number reflects the
349
+ // element-wide sequence. The handler closure's own
350
+ // ``outgoingSeq`` is unused for sequencing purposes now
351
+ // (it still exists as a default for non-wrapped callers).
352
+ //
353
+ // Critically, we increment the seq counter and update
354
+ // ``lastSentSeq`` on every *user* event, not on every
355
+ // server dispatch. If the handler is wrapped in a
356
+ // debounce that coalesces several events into one server
357
+ // dispatch, ``lastSentSeq`` will be higher than the seq
358
+ // actually sent to the server, which is fine — the seq
359
+ // we sent is the LATEST user-typed value, which is the
360
+ // one the server actually processed.
361
+ const seq = sharedOutgoingSeq.current++;
362
+ if (seq > lastSentSeq.current) {
363
+ lastSentSeq.current = seq;
364
+ }
365
+ const taggedHandler = givenHandler as TaggedEventHandler & {
366
+ _reactpy_set_seq?: (n: number) => void;
367
+ };
368
+ if (typeof taggedHandler._reactpy_set_seq === "function") {
369
+ // Push the handler's internal counter past our seq so
370
+ // the next (possibly debounced) dispatch uses a seq
371
+ // number that matches what the user just typed, not
372
+ // whatever stale value the handler closure happened
373
+ // to have left over.
374
+ taggedHandler._reactpy_set_seq(seq + 1);
375
+ }
376
+
377
+ // ``onKeyPress`` fires before the DOM has been updated with
378
+ // the new keystroke — ``event.target.value`` is the value
379
+ // BEFORE the character was added. We deliberately do NOT
380
+ // trust it for value-tracking. ``onChange``/``onInput`` fire
381
+ // after the DOM has been updated and can be trusted, but we
382
+ // don't even need to track it separately here — the
383
+ // reconcile effect reads the DOM directly via ``inputRef``
384
+ // so it always sees the post-keystroke value.
385
+
386
+ wrapped(event);
283
387
  };
284
388
  }
285
389
 
286
390
  // Use createElement here to avoid warning about variable numbers of children not
287
391
  // having keys. Warning about this must now be the responsibility of the client
288
392
  // providing the models instead of the client rendering them.
393
+ // Drop ``value`` from the props we pass to Preact — we want the
394
+ // input to be fully uncontrolled. Preact would otherwise set
395
+ // ``inputRef.current.value`` on every render (because ``value``
396
+ // is a known DOM property), racing with the browser's own
397
+ // mutations of the DOM value during fast typing and silently
398
+ // dropping keystrokes. We instead update the DOM value via the
399
+ // ``inputRef`` in the reconcile effect above, only when the
400
+ // server has caught up and the proposed value is not shorter
401
+ // than what the user has already typed.
402
+ const controlledProps: Record<string, any> = {};
403
+ for (const key of Object.keys(props as Record<string, any>)) {
404
+ if (key !== "value") {
405
+ controlledProps[key] = (props as Record<string, any>)[key];
406
+ }
407
+ }
289
408
  return createElement(
290
409
  model.tagName,
291
- // overwrite
292
- { ...props, value },
410
+ { ...controlledProps, ref: inputRef },
293
411
  ...createChildren(model, (child) => (
294
412
  <Element model={child} key={child.attributes?.key} />
295
413
  )),
package/src/handler.ts CHANGED
@@ -16,29 +16,6 @@ export type TaggedEventHandler = ((event: Event) => void) & {
16
16
  [HANDLER_THROTTLE]?: number;
17
17
  };
18
18
 
19
- /**
20
- * Returns the debounce value (in milliseconds) to use as the default for a user
21
- * input element when no user input has been recorded yet. Uses the maximum
22
- * debounce among the element's tagged handlers, falling back to the global
23
- * default if none of the handlers specify one.
24
- */
25
- export function getInitialDebounce(
26
- props: Record<string, unknown>,
27
- fallback: number,
28
- ): number {
29
- let max = 0;
30
- for (const value of Object.values(props)) {
31
- if (typeof value !== "function") {
32
- continue;
33
- }
34
- const candidate = (value as TaggedEventHandler)[HANDLER_DEBOUNCE];
35
- if (typeof candidate === "number" && candidate > max) {
36
- max = candidate;
37
- }
38
- }
39
- return max > 0 ? max : fallback;
40
- }
41
-
42
19
  /**
43
20
  * Returns true when the given value is a finite, non-negative integer.
44
21
  * Used to validate debounce/throttle values arriving over the wire from the
package/src/types.ts CHANGED
@@ -48,7 +48,7 @@ export type ReactPyComponent = ComponentType<{ model: ReactPyVdom }>;
48
48
 
49
49
  export type ReactPyVdom = {
50
50
  tagName: string;
51
- attributes?: { [key: string]: string };
51
+ attributes?: { [key: string]: any };
52
52
  children?: (ReactPyVdom | string)[];
53
53
  error?: string;
54
54
  eventHandlers?: { [key: string]: ReactPyVdomEventHandler };
package/src/vdom.tsx CHANGED
@@ -222,6 +222,14 @@ function createEventHandler(
222
222
  throttle,
223
223
  }: ReactPyVdomEventHandler,
224
224
  ): [string, TaggedEventHandler] {
225
+ // Sequence number for the next outgoing event on this handler.
226
+ // The wrapper in ``UserInputElement`` may overwrite this before
227
+ // the event is actually sent (so that the wrapper, not this
228
+ // closure, owns the per-element monotonic counter and survives
229
+ // handler recreation on every server re-render). The default
230
+ // behavior (no wrapper) is to use a per-handler counter starting
231
+ // at 0.
232
+ let outgoingSeq = 0;
225
233
  const eventHandler = function (...args: any[]) {
226
234
  const data = Array.from(args).map((value) => {
227
235
  const event = value as Event;
@@ -239,9 +247,17 @@ function createEventHandler(
239
247
  return event;
240
248
  }
241
249
  });
242
- client.sendMessage({ type: "layout-event", data, target });
243
- } as TaggedEventHandler;
250
+ const seq = outgoingSeq++;
251
+ client.sendMessage({ type: "layout-event", data, target, seq });
252
+ } as TaggedEventHandler & {
253
+ _reactpy_peek_seq?: () => number;
254
+ _reactpy_set_seq?: (n: number) => void;
255
+ };
244
256
  eventHandler[HANDLER_MARKER] = true;
257
+ eventHandler._reactpy_peek_seq = (): number => outgoingSeq;
258
+ eventHandler._reactpy_set_seq = (n: number): void => {
259
+ outgoingSeq = n;
260
+ };
245
261
  if (debounce !== undefined) {
246
262
  if (!isValidDebounce(debounce)) {
247
263
  log.warn(