@acryldev/blends-frame 0.2.1 → 0.2.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/lib/client.js CHANGED
@@ -48655,6 +48655,46 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
48655
48655
  ]
48656
48656
  });
48657
48657
  }
48658
+ const KEY = "acrylBlends.recoveredAt";
48659
+ const KNOWN = /rendered without an installed adapter/u;
48660
+ /** Whether an error is the known one a reload cures. */
48661
+ function isRecoverable(error) {
48662
+ const text = error instanceof Error ? `${error.name} ${error.message}` : String(error);
48663
+ return KNOWN.test(text);
48664
+ }
48665
+ /** Install the recovery; returns its disposer. */
48666
+ function installRecovery(target, now = Date.now) {
48667
+ const listener = (event) => {
48668
+ if (!isRecoverable(event.error ?? event.reason ?? event.message)) return;
48669
+ let last = 0;
48670
+ try {
48671
+ last = Number(target.sessionStorage.getItem(KEY) ?? 0);
48672
+ } catch {}
48673
+ if (now() - last < 15e3) return;
48674
+ try {
48675
+ target.sessionStorage.setItem(KEY, String(now()));
48676
+ } catch {}
48677
+ target.location.reload();
48678
+ };
48679
+ target.addEventListener("error", listener);
48680
+ target.addEventListener("unhandledrejection", listener);
48681
+ return () => {
48682
+ target.removeEventListener("error", listener);
48683
+ target.removeEventListener("unhandledrejection", listener);
48684
+ };
48685
+ }
48686
+ const INSTALLED = Symbol.for("acrylBlends.recovery");
48687
+ /**
48688
+ * Install the recovery once for the page, never removed. Not owned by the plugin's lifecycle on purpose: the race that blanks the page is DSH
48689
+ * replacing the slots service, which unloads the frame's client plugin (it injects `slots`), and an effect-owned listener was gone at exactly the
48690
+ * moment the error fired (seen on Windows with 0.2.2). A second call (the plugin applied again) finds the first listener and adds nothing.
48691
+ */
48692
+ function installRecoveryOnce(target, now = Date.now) {
48693
+ const marked = target;
48694
+ if (marked[INSTALLED]) return;
48695
+ marked[INSTALLED] = true;
48696
+ installRecovery(target, now);
48697
+ }
48658
48698
  // src/client/ShareAppSection.tsx
48659
48699
  /**
48660
48700
  * Settings > Share, in every app (window or browser tab): send the whole app, as it is now, to a GitHub repository of the person's own. The plan
@@ -48826,6 +48866,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
48826
48866
  })
48827
48867
  ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
48828
48868
  className: "acrylBlendsAppRow",
48869
+ "data-wide": "",
48829
48870
  onSubmit: review,
48830
48871
  children: [
48831
48872
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: "Share to GitHub" }),
@@ -49570,6 +49611,7 @@ button.acrylBlendsFrow:hover { background: var(--bf-surface-2); }
49570
49611
  .acrylBlendsAppRow small { grid-column: 1 / -1; color: var(--bf-dim); font-size: 11.5px; }
49571
49612
  .acrylBlendsAppControls { grid-row: 1; grid-column: 2; display: inline-flex; align-items: center; gap: 8px; }
49572
49613
  .acrylBlendsAppRow .acrylBlendsAppName { width: 220px; }
49614
+ .acrylBlendsAppRow[data-wide] .acrylBlendsAppControls { grid-row: 2; grid-column: 1 / -1; flex-wrap: wrap; }
49573
49615
  .acrylBlendsAppButton { padding: 4px 10px; border: 1px solid #34343a; border-radius: 6px; background: var(--bf-surface-2); color: #e8e8ea; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
49574
49616
  .acrylBlendsAppButton:hover:not(:disabled) { border-color: #4a4a52; color: #fff; }
49575
49617
  .acrylBlendsAppButton:disabled { opacity: .5; cursor: default; }
@@ -50162,6 +50204,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
50162
50204
  }
50163
50205
  }
50164
50206
  function apply(ctx) {
50207
+ installRecoveryOnce(window);
50165
50208
  const layout = new _acryldev_app_shell_client.DesktopLayoutState();
50166
50209
  const canvas = new AppCanvasState();
50167
50210
  const selection = new SelectionStore();