@syntrologie/runtime-sdk 2.8.0-canary.82 → 2.8.0-canary.84

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.
@@ -353,8 +353,8 @@ export interface ActionEngine {
353
353
  validate: (action: ActionStep) => ValidationResult;
354
354
  /** Get all currently active actions */
355
355
  getActive: () => ActiveAction[];
356
- /** Clean up all active actions and resources */
357
- destroy: () => void;
356
+ /** Clean up all active actions and resources. Awaits async cleanup (animated reverts). */
357
+ destroy: () => Promise<void>;
358
358
  }
359
359
  /** Renderable content types for surfaces */
360
360
  export type RenderableContent = {
@@ -11,6 +11,7 @@ export interface AnchorResolverOptions {
11
11
  export interface AnchorResolver {
12
12
  resolve(selector: string): HTMLElement | null;
13
13
  waitFor(selector: string, timeoutMs?: number): Promise<HTMLElement>;
14
+ /** One-shot: fires callback once when element appears, then auto-removes the watcher. */
14
15
  onAppear(selector: string, cb: (el: HTMLElement) => void): () => void;
15
16
  pendingCount(): number;
16
17
  destroy(): void;
@@ -3456,7 +3456,7 @@ function getAntiFlickerSnippet(config = {}) {
3456
3456
  }
3457
3457
 
3458
3458
  // src/version.ts
3459
- var SDK_VERSION = "2.8.0-canary.82";
3459
+ var SDK_VERSION = "2.8.0-canary.84";
3460
3460
 
3461
3461
  // src/types.ts
3462
3462
  var SDK_SCHEMA_VERSION = "2.0";
@@ -6496,21 +6496,9 @@ function SmartCanvasAppInner({
6496
6496
  const updateUrl = () => setLocalUrl(window.location.href);
6497
6497
  window.addEventListener("popstate", updateUrl);
6498
6498
  window.addEventListener("hashchange", updateUrl);
6499
- const originalPushState = history.pushState;
6500
- const originalReplaceState = history.replaceState;
6501
- history.pushState = function(...args) {
6502
- originalPushState.apply(this, args);
6503
- queueMicrotask(updateUrl);
6504
- };
6505
- history.replaceState = function(...args) {
6506
- originalReplaceState.apply(this, args);
6507
- queueMicrotask(updateUrl);
6508
- };
6509
6499
  return () => {
6510
6500
  window.removeEventListener("popstate", updateUrl);
6511
6501
  window.removeEventListener("hashchange", updateUrl);
6512
- history.pushState = originalPushState;
6513
- history.replaceState = originalReplaceState;
6514
6502
  };
6515
6503
  }, [runtime3]);
6516
6504
  const derivedFetcher = useMemo7(() => {
@@ -6552,7 +6540,11 @@ function SmartCanvasAppInner({
6552
6540
  const stale = () => version !== runVersionRef.current;
6553
6541
  const run = async () => {
6554
6542
  if (pendingRevertRef.current) {
6555
- await pendingRevertRef.current;
6543
+ try {
6544
+ await pendingRevertRef.current;
6545
+ } catch (err) {
6546
+ console.error("[SmartCanvasApp] Pending revert failed:", err);
6547
+ }
6556
6548
  pendingRevertRef.current = null;
6557
6549
  }
6558
6550
  if (batchHandleRef.current) {
@@ -9256,7 +9248,7 @@ function createActionEngine(options) {
9256
9248
  state: entry.state
9257
9249
  }));
9258
9250
  }
9259
- function destroy() {
9251
+ async function destroy() {
9260
9252
  for (const unsubs of conditionalUnsubs.values()) {
9261
9253
  for (const unsub of unsubs) {
9262
9254
  try {
@@ -9266,16 +9258,27 @@ function createActionEngine(options) {
9266
9258
  }
9267
9259
  }
9268
9260
  conditionalUnsubs.clear();
9261
+ const cleanupPromises = [];
9269
9262
  for (const entry of activeActions.values()) {
9270
9263
  if (entry.state === "applied") {
9271
9264
  try {
9272
- entry.cleanup();
9265
+ const result = entry.cleanup();
9266
+ if (result && typeof result.then === "function") {
9267
+ cleanupPromises.push(
9268
+ result.catch((error2) => {
9269
+ console.error(`[ActionEngine] Error during async cleanup:`, error2);
9270
+ })
9271
+ );
9272
+ }
9273
9273
  } catch (error2) {
9274
9274
  console.error(`[ActionEngine] Error during cleanup:`, error2);
9275
9275
  }
9276
9276
  }
9277
9277
  }
9278
9278
  activeActions.clear();
9279
+ if (cleanupPromises.length > 0) {
9280
+ await Promise.all(cleanupPromises);
9281
+ }
9279
9282
  }
9280
9283
  return {
9281
9284
  apply,
@@ -12467,4 +12470,4 @@ export {
12467
12470
  encodeToken,
12468
12471
  Syntro
12469
12472
  };
12470
- //# sourceMappingURL=chunk-ECTAAEQD.js.map
12473
+ //# sourceMappingURL=chunk-SCKAFNWP.js.map