@acryldev/blends-frame 0.2.1 → 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.
- package/lib/client.js +31 -0
- package/lib/client.js.map +1 -1
- package/lib/types/client/recover.d.ts +27 -0
- package/package.json +4 -4
package/lib/client.js
CHANGED
|
@@ -48655,6 +48655,34 @@ 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
|
+
}
|
|
48658
48686
|
// src/client/ShareAppSection.tsx
|
|
48659
48687
|
/**
|
|
48660
48688
|
* 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 +48854,7 @@ body[data-bf-settings-full] { --bf-pane-h: calc(100vh - 24px); }
|
|
|
48826
48854
|
})
|
|
48827
48855
|
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
48828
48856
|
className: "acrylBlendsAppRow",
|
|
48857
|
+
"data-wide": "",
|
|
48829
48858
|
onSubmit: review,
|
|
48830
48859
|
children: [
|
|
48831
48860
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: "Share to GitHub" }),
|
|
@@ -49570,6 +49599,7 @@ button.acrylBlendsFrow:hover { background: var(--bf-surface-2); }
|
|
|
49570
49599
|
.acrylBlendsAppRow small { grid-column: 1 / -1; color: var(--bf-dim); font-size: 11.5px; }
|
|
49571
49600
|
.acrylBlendsAppControls { grid-row: 1; grid-column: 2; display: inline-flex; align-items: center; gap: 8px; }
|
|
49572
49601
|
.acrylBlendsAppRow .acrylBlendsAppName { width: 220px; }
|
|
49602
|
+
.acrylBlendsAppRow[data-wide] .acrylBlendsAppControls { grid-row: 2; grid-column: 1 / -1; flex-wrap: wrap; }
|
|
49573
49603
|
.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
49604
|
.acrylBlendsAppButton:hover:not(:disabled) { border-color: #4a4a52; color: #fff; }
|
|
49575
49605
|
.acrylBlendsAppButton:disabled { opacity: .5; cursor: default; }
|
|
@@ -50162,6 +50192,7 @@ body[data-bf-settings-full] [data-shortcut-modal="settings"] { width: calc(100vw
|
|
|
50162
50192
|
}
|
|
50163
50193
|
}
|
|
50164
50194
|
function apply(ctx) {
|
|
50195
|
+
ctx.effect(() => installRecovery(window), "@acryldev/blends-frame: recover a blank page");
|
|
50165
50196
|
const layout = new _acryldev_app_shell_client.DesktopLayoutState();
|
|
50166
50197
|
const canvas = new AppCanvasState();
|
|
50167
50198
|
const selection = new SelectionStore();
|