@xmachines/json-render-core 0.20.0-xm.2 → 0.20.0-xm.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/index.d.mts CHANGED
@@ -270,8 +270,10 @@ declare function resolveBindings(props: Record<string, unknown>, ctx: PropResolu
270
270
  declare function resolveActionParam(value: unknown, ctx: PropResolutionContext): unknown;
271
271
 
272
272
  /**
273
- * Emitted when an action begins executing. The same `id` will appear on a
274
- * matching {@link ActionSettleInfo} emitted when the action resolves or throws.
273
+ * Emitted when an action begins executing. The same `id` appears on the
274
+ * matching {@link ActionSettleInfo}. The provider emits that event when the
275
+ * action resolves, when the action throws, and when the user cancels a
276
+ * confirm gate.
275
277
  */
276
278
  interface ActionDispatchInfo {
277
279
  /** Stable dispatch id; paired with the matching `onSettle`. */
@@ -284,19 +286,33 @@ interface ActionDispatchInfo {
284
286
  at: number;
285
287
  }
286
288
  /**
287
- * Emitted after an action has resolved or thrown.
289
+ * Emitted after an action resolved, threw, or was cancelled at a confirm gate.
288
290
  */
289
291
  interface ActionSettleInfo {
290
292
  /** Matches the `id` of the corresponding `onDispatch`. */
291
293
  id: string;
292
294
  /** Resolved action name. */
293
295
  name: string;
294
- /** `true` if the handler resolved, `false` if it threw. */
296
+ /**
297
+ * `true` if the handler resolved. `false` if the handler threw, and `false`
298
+ * if the user cancelled a confirm gate. Read `cancelled` to tell the two
299
+ * apart.
300
+ */
295
301
  ok: boolean;
296
302
  /** Wall clock time (ms) at settle. */
297
303
  at: number;
298
- /** Elapsed time in milliseconds. */
304
+ /** Elapsed time from dispatch to settle, in milliseconds. */
299
305
  durationMs: number;
306
+ /**
307
+ * `true` if the user cancelled a confirm gate. The handler did not run, and
308
+ * the provider changed no state.
309
+ */
310
+ cancelled?: boolean;
311
+ /**
312
+ * Time (ms) that a confirm dialog stayed open. `durationMs` includes this
313
+ * time. Subtract it to get the time that the handler used.
314
+ */
315
+ confirmMs?: number;
300
316
  /** Return value from the handler, if any. */
301
317
  result?: unknown;
302
318
  /** Error if the handler threw. */
@@ -334,7 +350,8 @@ declare function registerActionObserver(observer: ActionObserver): () => void;
334
350
  declare function notifyActionDispatch(evt: ActionDispatchInfo): void;
335
351
  /**
336
352
  * Emit a settle event to all registered observers. Called by framework
337
- * ActionProviders after every action resolves or throws.
353
+ * ActionProviders after every action resolves, throws, or is cancelled at a
354
+ * confirm gate.
338
355
  */
339
356
  declare function notifyActionSettle(evt: ActionSettleInfo): void;
340
357
  declare function nextActionDispatchId(): string;
package/dist/index.d.ts CHANGED
@@ -270,8 +270,10 @@ declare function resolveBindings(props: Record<string, unknown>, ctx: PropResolu
270
270
  declare function resolveActionParam(value: unknown, ctx: PropResolutionContext): unknown;
271
271
 
272
272
  /**
273
- * Emitted when an action begins executing. The same `id` will appear on a
274
- * matching {@link ActionSettleInfo} emitted when the action resolves or throws.
273
+ * Emitted when an action begins executing. The same `id` appears on the
274
+ * matching {@link ActionSettleInfo}. The provider emits that event when the
275
+ * action resolves, when the action throws, and when the user cancels a
276
+ * confirm gate.
275
277
  */
276
278
  interface ActionDispatchInfo {
277
279
  /** Stable dispatch id; paired with the matching `onSettle`. */
@@ -284,19 +286,33 @@ interface ActionDispatchInfo {
284
286
  at: number;
285
287
  }
286
288
  /**
287
- * Emitted after an action has resolved or thrown.
289
+ * Emitted after an action resolved, threw, or was cancelled at a confirm gate.
288
290
  */
289
291
  interface ActionSettleInfo {
290
292
  /** Matches the `id` of the corresponding `onDispatch`. */
291
293
  id: string;
292
294
  /** Resolved action name. */
293
295
  name: string;
294
- /** `true` if the handler resolved, `false` if it threw. */
296
+ /**
297
+ * `true` if the handler resolved. `false` if the handler threw, and `false`
298
+ * if the user cancelled a confirm gate. Read `cancelled` to tell the two
299
+ * apart.
300
+ */
295
301
  ok: boolean;
296
302
  /** Wall clock time (ms) at settle. */
297
303
  at: number;
298
- /** Elapsed time in milliseconds. */
304
+ /** Elapsed time from dispatch to settle, in milliseconds. */
299
305
  durationMs: number;
306
+ /**
307
+ * `true` if the user cancelled a confirm gate. The handler did not run, and
308
+ * the provider changed no state.
309
+ */
310
+ cancelled?: boolean;
311
+ /**
312
+ * Time (ms) that a confirm dialog stayed open. `durationMs` includes this
313
+ * time. Subtract it to get the time that the handler used.
314
+ */
315
+ confirmMs?: number;
300
316
  /** Return value from the handler, if any. */
301
317
  result?: unknown;
302
318
  /** Error if the handler threw. */
@@ -334,7 +350,8 @@ declare function registerActionObserver(observer: ActionObserver): () => void;
334
350
  declare function notifyActionDispatch(evt: ActionDispatchInfo): void;
335
351
  /**
336
352
  * Emit a settle event to all registered observers. Called by framework
337
- * ActionProviders after every action resolves or throws.
353
+ * ActionProviders after every action resolves, throws, or is cancelled at a
354
+ * confirm gate.
338
355
  */
339
356
  declare function notifyActionSettle(evt: ActionSettleInfo): void;
340
357
  declare function nextActionDispatchId(): string;