@lapis-notes/app-profile 0.2.8 → 0.3.1
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/CHANGELOG.md +24 -0
- package/dist/browser-presentation/host-appearance.d.ts +3 -0
- package/dist/browser-presentation/host-appearance.js +19 -0
- package/dist/browser-presentation/host-theme-color.d.ts +3 -0
- package/dist/browser-presentation/host-theme-color.js +61 -0
- package/dist/browser-presentation/index.d.ts +4 -0
- package/dist/browser-presentation/index.js +4 -0
- package/dist/browser-presentation/pwa-host-document.d.ts +2 -0
- package/dist/browser-presentation/pwa-host-document.js +53 -0
- package/dist/browser-presentation/pwa-window-controls-core.d.ts +28 -0
- package/dist/browser-presentation/pwa-window-controls-core.js +73 -0
- package/dist/browser-presentation/pwa-window-controls.d.ts +9 -0
- package/dist/browser-presentation/pwa-window-controls.js +73 -0
- package/dist/workspace-session/lifecycle.js +1 -0
- package/package.json +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @lapis-notes/app-profile
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#201](https://github.com/lapismd/lapis-notes/pull/201)
|
|
8
|
+
[`343ca74`](https://github.com/lapismd/lapis-notes/commit/343ca7461506aa49552e8633879051a8e310d656)
|
|
9
|
+
Thanks [@stevejuma](https://github.com/stevejuma)! - Add typed headless plugin
|
|
10
|
+
job declarations, an App-owned native observation port and shared settings for
|
|
11
|
+
opt-in schedules, scoped grants, history and runner handoff.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
[[`343ca74`](https://github.com/lapismd/lapis-notes/commit/343ca7461506aa49552e8633879051a8e310d656)]:
|
|
14
|
+
- @lapis-notes/api@0.6.15
|
|
15
|
+
- @lapis-notes/workspace@0.4.11
|
|
16
|
+
|
|
17
|
+
## 0.3.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [#193](https://github.com/lapismd/lapis-notes/pull/193)
|
|
22
|
+
[`a97e934`](https://github.com/lapismd/lapis-notes/commit/a97e93408ab4ee076c8aeb45c225f6adb1a85c50)
|
|
23
|
+
Thanks [@stevejuma](https://github.com/stevejuma)! - Expose shared Lapis
|
|
24
|
+
browser appearance and installed window controls for standalone and hosted
|
|
25
|
+
clients.
|
|
26
|
+
|
|
3
27
|
## 0.2.8
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BootstrapAppearanceMode } from "@lapis-notes/api";
|
|
2
|
+
export declare function applyWebHostAppearance(mode: BootstrapAppearanceMode, source?: Document): void;
|
|
3
|
+
export declare function observeWebHostAppearance(mode: BootstrapAppearanceMode, source?: Document): () => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function applyWebHostAppearance(mode, source = document) {
|
|
2
|
+
const dark = mode === "dark" ||
|
|
3
|
+
(mode === "system" &&
|
|
4
|
+
source.defaultView?.matchMedia?.("(prefers-color-scheme: dark)")
|
|
5
|
+
.matches === true);
|
|
6
|
+
const root = source.documentElement;
|
|
7
|
+
root.classList.toggle("dark", dark);
|
|
8
|
+
root.classList.toggle("light", !dark);
|
|
9
|
+
root.classList.toggle("theme-dark", dark);
|
|
10
|
+
root.classList.toggle("theme-light", !dark);
|
|
11
|
+
root.dataset.uiTheme = "lapis";
|
|
12
|
+
}
|
|
13
|
+
export function observeWebHostAppearance(mode, source = document) {
|
|
14
|
+
const media = source.defaultView?.matchMedia?.("(prefers-color-scheme: dark)");
|
|
15
|
+
const sync = () => applyWebHostAppearance(mode, source);
|
|
16
|
+
sync();
|
|
17
|
+
media?.addEventListener("change", sync);
|
|
18
|
+
return () => media?.removeEventListener("change", sync);
|
|
19
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const HOST_THEME_COLOR_ATTRIBUTE = "data-lapis-host-theme-color";
|
|
2
|
+
const BOOTSTRAP_THEME_COLOR_ATTRIBUTE = "data-lapis-bootstrap-theme-color";
|
|
3
|
+
const THEME_COLOR_VARIABLES = [
|
|
4
|
+
"--ui-workspace-tab-container-background",
|
|
5
|
+
"--ui-workspace-panel",
|
|
6
|
+
"--workspace-chrome-background",
|
|
7
|
+
"--tab-container-background",
|
|
8
|
+
"--sidebar",
|
|
9
|
+
"--titlebar-background",
|
|
10
|
+
"--background-secondary",
|
|
11
|
+
"--background-primary",
|
|
12
|
+
];
|
|
13
|
+
function resolveCssColor(source, value) {
|
|
14
|
+
const probe = source.createElement("span");
|
|
15
|
+
probe.style.cssText = `position:fixed;pointer-events:none;visibility:hidden;background-color:${value}`;
|
|
16
|
+
(source.body ?? source.documentElement).appendChild(probe);
|
|
17
|
+
const color = source.defaultView?.getComputedStyle(probe).backgroundColor.trim() ?? "";
|
|
18
|
+
probe.remove();
|
|
19
|
+
return !color || color === "rgba(0, 0, 0, 0)" || color === "transparent"
|
|
20
|
+
? null
|
|
21
|
+
: color;
|
|
22
|
+
}
|
|
23
|
+
export function resolveDocumentThemeColor(source = document) {
|
|
24
|
+
for (const variableName of THEME_COLOR_VARIABLES) {
|
|
25
|
+
const color = resolveCssColor(source, `var(${variableName})`);
|
|
26
|
+
if (color)
|
|
27
|
+
return color;
|
|
28
|
+
}
|
|
29
|
+
const bodyColor = source.body
|
|
30
|
+
? source.defaultView?.getComputedStyle(source.body).backgroundColor.trim()
|
|
31
|
+
: "";
|
|
32
|
+
return bodyColor && bodyColor !== "rgba(0, 0, 0, 0)" ? bodyColor : "#ffffff";
|
|
33
|
+
}
|
|
34
|
+
export function syncHostThemeColor(source = document) {
|
|
35
|
+
source.head
|
|
36
|
+
.querySelectorAll(`meta[name='theme-color'][${BOOTSTRAP_THEME_COLOR_ATTRIBUTE}='true']`)
|
|
37
|
+
.forEach((meta) => meta.remove());
|
|
38
|
+
let themeColor = source.head.querySelector(`meta[name='theme-color'][${HOST_THEME_COLOR_ATTRIBUTE}='true']`);
|
|
39
|
+
if (!themeColor) {
|
|
40
|
+
themeColor = source.createElement("meta");
|
|
41
|
+
themeColor.name = "theme-color";
|
|
42
|
+
themeColor.setAttribute(HOST_THEME_COLOR_ATTRIBUTE, "true");
|
|
43
|
+
source.head.appendChild(themeColor);
|
|
44
|
+
}
|
|
45
|
+
themeColor.content = resolveDocumentThemeColor(source);
|
|
46
|
+
}
|
|
47
|
+
export function observeHostThemeColor(source = document) {
|
|
48
|
+
const sync = () => syncHostThemeColor(source);
|
|
49
|
+
sync();
|
|
50
|
+
const observer = new MutationObserver(sync);
|
|
51
|
+
observer.observe(source.documentElement, {
|
|
52
|
+
attributes: true,
|
|
53
|
+
attributeFilter: ["class"],
|
|
54
|
+
});
|
|
55
|
+
const colorScheme = source.defaultView?.matchMedia("(prefers-color-scheme: dark)");
|
|
56
|
+
colorScheme?.addEventListener("change", sync);
|
|
57
|
+
return () => {
|
|
58
|
+
observer.disconnect();
|
|
59
|
+
colorScheme?.removeEventListener("change", sync);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { applyWebHostAppearance, observeWebHostAppearance, } from "./host-appearance";
|
|
2
|
+
export { observeHostThemeColor } from "./host-theme-color";
|
|
3
|
+
export { initializePwaHostDocument, isInstalledPwaHost, } from "./pwa-host-document";
|
|
4
|
+
export { registerPwaWindowControlsOverlay } from "./pwa-window-controls";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { applyWebHostAppearance, observeWebHostAppearance, } from "./host-appearance";
|
|
2
|
+
export { observeHostThemeColor } from "./host-theme-color";
|
|
3
|
+
export { initializePwaHostDocument, isInstalledPwaHost, } from "./pwa-host-document";
|
|
4
|
+
export { registerPwaWindowControlsOverlay } from "./pwa-window-controls";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function detectEngine() {
|
|
2
|
+
const userAgent = navigator.userAgent;
|
|
3
|
+
if (/Firefox\//u.test(userAgent))
|
|
4
|
+
return "gecko";
|
|
5
|
+
if (/AppleWebKit/u.test(userAgent) &&
|
|
6
|
+
!/(Chrome|Chromium|CriOS|Edg|OPR)/u.test(userAgent)) {
|
|
7
|
+
return "webkit";
|
|
8
|
+
}
|
|
9
|
+
if (/(Chrome|Chromium|CriOS|Edg|OPR)/u.test(userAgent))
|
|
10
|
+
return "blink";
|
|
11
|
+
return "unknown";
|
|
12
|
+
}
|
|
13
|
+
function detectOs(navigatorObject) {
|
|
14
|
+
const platform = [
|
|
15
|
+
navigatorObject.userAgentData?.platform,
|
|
16
|
+
navigatorObject.platform,
|
|
17
|
+
navigatorObject.userAgent,
|
|
18
|
+
]
|
|
19
|
+
.filter((value) => Boolean(value))
|
|
20
|
+
.join(" ")
|
|
21
|
+
.toLowerCase();
|
|
22
|
+
if (/iphone|ipad|ipod|ios/u.test(platform))
|
|
23
|
+
return "ios";
|
|
24
|
+
if (/android/u.test(platform))
|
|
25
|
+
return "android";
|
|
26
|
+
if (/mac/u.test(platform))
|
|
27
|
+
return "macos";
|
|
28
|
+
if (/win/u.test(platform))
|
|
29
|
+
return "windows";
|
|
30
|
+
if (/linux|x11/u.test(platform))
|
|
31
|
+
return "linux";
|
|
32
|
+
return "unknown";
|
|
33
|
+
}
|
|
34
|
+
export function isInstalledPwaHost() {
|
|
35
|
+
if (typeof globalThis.matchMedia !== "function")
|
|
36
|
+
return false;
|
|
37
|
+
return (globalThis.matchMedia("(display-mode: standalone)").matches ||
|
|
38
|
+
globalThis.matchMedia("(display-mode: window-controls-overlay)").matches ||
|
|
39
|
+
globalThis.matchMedia("(display-mode: minimal-ui)").matches ||
|
|
40
|
+
navigator.standalone === true);
|
|
41
|
+
}
|
|
42
|
+
export function initializePwaHostDocument(runtime) {
|
|
43
|
+
if (typeof document === "undefined" || typeof navigator === "undefined")
|
|
44
|
+
return;
|
|
45
|
+
const root = document.documentElement;
|
|
46
|
+
root.dataset.pwaHost = "true";
|
|
47
|
+
root.dataset.runtime = runtime;
|
|
48
|
+
root.dataset.pwaTitlebarHidden = "false";
|
|
49
|
+
root.dataset.engine = detectEngine();
|
|
50
|
+
root.dataset.os = detectOs(navigator);
|
|
51
|
+
if (isInstalledPwaHost())
|
|
52
|
+
root.dataset.pwaInstalled = "true";
|
|
53
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const DEFAULT_WCO_INSETS: Record<string, {
|
|
2
|
+
top: number;
|
|
3
|
+
left: number;
|
|
4
|
+
right: number;
|
|
5
|
+
}>;
|
|
6
|
+
export type TitlebarAreaRect = Pick<DOMRectReadOnly, "height" | "width" | "x" | "y">;
|
|
7
|
+
export declare function resolveDefaultInsets(os: string): {
|
|
8
|
+
top: number;
|
|
9
|
+
left: number;
|
|
10
|
+
right: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function resolveTitlebarTop(rect: TitlebarAreaRect, os: string): number;
|
|
13
|
+
export declare function resolveControlInsets(options: {
|
|
14
|
+
os: string;
|
|
15
|
+
rect: TitlebarAreaRect;
|
|
16
|
+
viewportWidth: number;
|
|
17
|
+
}): {
|
|
18
|
+
top: number;
|
|
19
|
+
left: number;
|
|
20
|
+
right: number;
|
|
21
|
+
};
|
|
22
|
+
export declare const PWA_TITLEBAR_GEOMETRY_CSS_PROPERTIES: readonly ["--ui-workspace-window-controls-overlay-height", "--ui-workspace-window-controls-overlay-inline-start", "--ui-workspace-window-controls-overlay-inline-end", "--pwa-titlebar-area-height", "--pwa-titlebar-area-width", "--pwa-titlebar-area-x", "--pwa-titlebar-area-y", "--pwa-titlebar-safe-area-top", "--pwa-titlebar-safe-area-left", "--pwa-titlebar-safe-area-right", "--workspace-safe-area-top", "--workspace-safe-area-left", "--workspace-safe-area-right"];
|
|
23
|
+
export declare function applyTitlebarAreaGeometry(root: HTMLElement, rect: DOMRectReadOnly, viewportWidth: number): {
|
|
24
|
+
top: number;
|
|
25
|
+
left: number;
|
|
26
|
+
right: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function clearPwaSafeAreas(root: HTMLElement): void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export const DEFAULT_WCO_INSETS = {
|
|
2
|
+
macos: { top: 38, left: 78, right: 0 },
|
|
3
|
+
windows: { top: 32, left: 0, right: 138 },
|
|
4
|
+
linux: { top: 32, left: 0, right: 138 },
|
|
5
|
+
unknown: { top: 32, left: 0, right: 0 },
|
|
6
|
+
};
|
|
7
|
+
export function resolveDefaultInsets(os) {
|
|
8
|
+
return DEFAULT_WCO_INSETS[os] ?? DEFAULT_WCO_INSETS.unknown;
|
|
9
|
+
}
|
|
10
|
+
export function resolveTitlebarTop(rect, os) {
|
|
11
|
+
if (rect.height > 0)
|
|
12
|
+
return Math.round(rect.height);
|
|
13
|
+
if (rect.width === 0 && rect.x === 0 && rect.y === 0) {
|
|
14
|
+
return resolveDefaultInsets(os).top;
|
|
15
|
+
}
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
export function resolveControlInsets(options) {
|
|
19
|
+
const { os, rect, viewportWidth } = options;
|
|
20
|
+
const defaults = resolveDefaultInsets(os);
|
|
21
|
+
if (rect.height === 0 && rect.width === 0 && rect.x === 0 && rect.y === 0)
|
|
22
|
+
return { ...defaults };
|
|
23
|
+
const top = resolveTitlebarTop(rect, os);
|
|
24
|
+
const rightGap = Math.max(0, Math.round(viewportWidth - rect.x - rect.width));
|
|
25
|
+
const left = rect.x > 0 ? Math.round(rect.x) : os === "macos" ? defaults.left : 0;
|
|
26
|
+
const right = rightGap > 0
|
|
27
|
+
? rightGap
|
|
28
|
+
: (os === "windows" || os === "linux") && rect.x === 0
|
|
29
|
+
? defaults.right
|
|
30
|
+
: 0;
|
|
31
|
+
return { top, left, right };
|
|
32
|
+
}
|
|
33
|
+
export const PWA_TITLEBAR_GEOMETRY_CSS_PROPERTIES = [
|
|
34
|
+
"--ui-workspace-window-controls-overlay-height",
|
|
35
|
+
"--ui-workspace-window-controls-overlay-inline-start",
|
|
36
|
+
"--ui-workspace-window-controls-overlay-inline-end",
|
|
37
|
+
"--pwa-titlebar-area-height",
|
|
38
|
+
"--pwa-titlebar-area-width",
|
|
39
|
+
"--pwa-titlebar-area-x",
|
|
40
|
+
"--pwa-titlebar-area-y",
|
|
41
|
+
"--pwa-titlebar-safe-area-top",
|
|
42
|
+
"--pwa-titlebar-safe-area-left",
|
|
43
|
+
"--pwa-titlebar-safe-area-right",
|
|
44
|
+
"--workspace-safe-area-top",
|
|
45
|
+
"--workspace-safe-area-left",
|
|
46
|
+
"--workspace-safe-area-right",
|
|
47
|
+
];
|
|
48
|
+
export function applyTitlebarAreaGeometry(root, rect, viewportWidth) {
|
|
49
|
+
root.style.setProperty("--pwa-titlebar-area-height", `${Math.round(rect.height)}px`);
|
|
50
|
+
root.style.setProperty("--pwa-titlebar-area-width", `${Math.round(rect.width)}px`);
|
|
51
|
+
root.style.setProperty("--pwa-titlebar-area-x", `${Math.round(rect.x)}px`);
|
|
52
|
+
root.style.setProperty("--pwa-titlebar-area-y", `${Math.round(rect.y)}px`);
|
|
53
|
+
const insets = resolveControlInsets({
|
|
54
|
+
os: root.dataset.os ?? "unknown",
|
|
55
|
+
rect,
|
|
56
|
+
viewportWidth,
|
|
57
|
+
});
|
|
58
|
+
root.style.setProperty("--pwa-titlebar-safe-area-top", `${insets.top}px`);
|
|
59
|
+
root.style.setProperty("--pwa-titlebar-safe-area-left", `${insets.left}px`);
|
|
60
|
+
root.style.setProperty("--pwa-titlebar-safe-area-right", `${insets.right}px`);
|
|
61
|
+
root.style.setProperty("--workspace-safe-area-top", `${insets.top}px`);
|
|
62
|
+
root.style.setProperty("--workspace-safe-area-left", `${insets.left}px`);
|
|
63
|
+
root.style.setProperty("--workspace-safe-area-right", `${insets.right}px`);
|
|
64
|
+
root.style.setProperty("--ui-workspace-window-controls-overlay-height", `${insets.top}px`);
|
|
65
|
+
root.style.setProperty("--ui-workspace-window-controls-overlay-inline-start", `${insets.left}px`);
|
|
66
|
+
root.style.setProperty("--ui-workspace-window-controls-overlay-inline-end", `${insets.right}px`);
|
|
67
|
+
return insets;
|
|
68
|
+
}
|
|
69
|
+
export function clearPwaSafeAreas(root) {
|
|
70
|
+
for (const property of PWA_TITLEBAR_GEOMETRY_CSS_PROPERTIES) {
|
|
71
|
+
root.style.removeProperty(property);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type WindowControlsOverlay = {
|
|
2
|
+
getTitlebarAreaRect(): DOMRectReadOnly;
|
|
3
|
+
addEventListener(type: "geometrychange", listener: EventListener): void;
|
|
4
|
+
removeEventListener(type: "geometrychange", listener: EventListener): void;
|
|
5
|
+
};
|
|
6
|
+
export declare function syncPwaTitlebarHidden(root: HTMLElement, wcoDisplayMode: boolean): void;
|
|
7
|
+
export declare function syncTitlebarAreaGeometry(overlay: WindowControlsOverlay | undefined): void;
|
|
8
|
+
export declare function registerPwaWindowControlsOverlay(): () => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { applyTitlebarAreaGeometry, clearPwaSafeAreas, } from "./pwa-window-controls-core";
|
|
2
|
+
const DISPLAY_MODE_QUERIES = [
|
|
3
|
+
"(display-mode: window-controls-overlay)",
|
|
4
|
+
"(display-mode: standalone)",
|
|
5
|
+
"(display-mode: minimal-ui)",
|
|
6
|
+
];
|
|
7
|
+
function isWindowControlsOverlayDisplayMode() {
|
|
8
|
+
return (typeof globalThis.matchMedia === "function" &&
|
|
9
|
+
globalThis.matchMedia(DISPLAY_MODE_QUERIES[0]).matches);
|
|
10
|
+
}
|
|
11
|
+
function resolvePwaDisplayMode() {
|
|
12
|
+
if (typeof globalThis.matchMedia !== "function")
|
|
13
|
+
return undefined;
|
|
14
|
+
if (isWindowControlsOverlayDisplayMode())
|
|
15
|
+
return "window-controls-overlay";
|
|
16
|
+
if (globalThis.matchMedia(DISPLAY_MODE_QUERIES[1]).matches)
|
|
17
|
+
return "standalone";
|
|
18
|
+
if (globalThis.matchMedia(DISPLAY_MODE_QUERIES[2]).matches)
|
|
19
|
+
return "minimal-ui";
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
export function syncPwaTitlebarHidden(root, wcoDisplayMode) {
|
|
23
|
+
if (root.dataset.pwaHost !== "true") {
|
|
24
|
+
delete root.dataset.pwaTitlebarHidden;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
root.dataset.pwaTitlebarHidden = wcoDisplayMode ? "true" : "false";
|
|
28
|
+
}
|
|
29
|
+
export function syncTitlebarAreaGeometry(overlay) {
|
|
30
|
+
const root = document.documentElement;
|
|
31
|
+
const wcoDisplayMode = isWindowControlsOverlayDisplayMode();
|
|
32
|
+
const displayMode = resolvePwaDisplayMode();
|
|
33
|
+
if (displayMode)
|
|
34
|
+
root.dataset.pwaDisplayMode = displayMode;
|
|
35
|
+
else
|
|
36
|
+
delete root.dataset.pwaDisplayMode;
|
|
37
|
+
syncPwaTitlebarHidden(root, wcoDisplayMode);
|
|
38
|
+
if (!wcoDisplayMode) {
|
|
39
|
+
clearPwaSafeAreas(root);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const rect = overlay?.getTitlebarAreaRect() ?? new DOMRect(0, 0, 0, 0);
|
|
43
|
+
applyTitlebarAreaGeometry(root, rect, window.innerWidth);
|
|
44
|
+
}
|
|
45
|
+
export function registerPwaWindowControlsOverlay() {
|
|
46
|
+
const overlay = navigator
|
|
47
|
+
.windowControlsOverlay;
|
|
48
|
+
let timeoutId = null;
|
|
49
|
+
const sync = () => syncTitlebarAreaGeometry(overlay);
|
|
50
|
+
const scheduleSync = () => {
|
|
51
|
+
if (timeoutId)
|
|
52
|
+
clearTimeout(timeoutId);
|
|
53
|
+
timeoutId = setTimeout(sync, 100);
|
|
54
|
+
};
|
|
55
|
+
sync();
|
|
56
|
+
requestAnimationFrame(sync);
|
|
57
|
+
window.addEventListener("resize", scheduleSync);
|
|
58
|
+
overlay?.addEventListener("geometrychange", scheduleSync);
|
|
59
|
+
const mediaCleanups = DISPLAY_MODE_QUERIES.map((query) => {
|
|
60
|
+
const media = globalThis.matchMedia?.(query);
|
|
61
|
+
media?.addEventListener("change", sync);
|
|
62
|
+
return () => media?.removeEventListener("change", sync);
|
|
63
|
+
});
|
|
64
|
+
const cleanup = () => {
|
|
65
|
+
if (timeoutId)
|
|
66
|
+
clearTimeout(timeoutId);
|
|
67
|
+
window.removeEventListener("resize", scheduleSync);
|
|
68
|
+
overlay?.removeEventListener("geometrychange", scheduleSync);
|
|
69
|
+
mediaCleanups.forEach((dispose) => dispose());
|
|
70
|
+
};
|
|
71
|
+
window.addEventListener("pagehide", cleanup, { once: true });
|
|
72
|
+
return cleanup;
|
|
73
|
+
}
|
|
@@ -69,6 +69,7 @@ export function createNotesSessionLifecycle(options) {
|
|
|
69
69
|
await persistLayout();
|
|
70
70
|
disposed = true;
|
|
71
71
|
await attempt(() => app.nativeTasks?.detach());
|
|
72
|
+
await attempt(() => app.backgroundJobs?.detach());
|
|
72
73
|
await attempt(() => prepareNativeChatLeave(app, "detach"));
|
|
73
74
|
options.fence();
|
|
74
75
|
await attempt(() => app.workspace.disposeWorkspaceHost());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lapis-notes/app-profile",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"import": "./dist/plugin-host-build.js",
|
|
16
16
|
"default": "./dist/plugin-host-build.js"
|
|
17
17
|
},
|
|
18
|
+
"./browser-presentation": {
|
|
19
|
+
"types": "./dist/browser-presentation/index.d.ts",
|
|
20
|
+
"svelte": "./dist/browser-presentation/index.js",
|
|
21
|
+
"import": "./dist/browser-presentation/index.js",
|
|
22
|
+
"default": "./dist/browser-presentation/index.js"
|
|
23
|
+
},
|
|
18
24
|
"./native-chat": {
|
|
19
25
|
"types": "./dist/native-chat/index.d.ts",
|
|
20
26
|
"svelte": "./dist/native-chat/index.js",
|
|
@@ -35,28 +41,29 @@
|
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
"dependencies": {
|
|
38
|
-
"@lapis-notes/api": "^0.6.
|
|
44
|
+
"@lapis-notes/api": "^0.6.15",
|
|
39
45
|
"@lapis-notes/file-explorer": "^0.2.8",
|
|
46
|
+
"@lapis-notes/history": "^0.5.1",
|
|
40
47
|
"@lapis-notes/markdown": "^0.3.3",
|
|
41
48
|
"@lapis-notes/search": "^0.1.13",
|
|
42
49
|
"@lapis-notes/source-editor": "^0.1.12",
|
|
43
|
-
"@lapis-notes/workspace": "^0.4.
|
|
50
|
+
"@lapis-notes/workspace": "^0.4.11",
|
|
44
51
|
"@lapismd/agent-ui": "^0.2.8",
|
|
45
52
|
"@lapismd/design-core": "^0.13.7",
|
|
46
|
-
"@lapis-notes/history": "^0.5.1",
|
|
47
53
|
"@lapismd/jj-history": "^0.1.0"
|
|
48
54
|
},
|
|
49
55
|
"devDependencies": {
|
|
50
56
|
"@sveltejs/package": "^2.5.8",
|
|
51
57
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
52
58
|
"@tsconfig/svelte": "^5.0.5",
|
|
59
|
+
"@types/node": "^26.1.2",
|
|
60
|
+
"jsdom": "^26.1.0",
|
|
53
61
|
"publint": "^0.3.12",
|
|
54
62
|
"svelte": "5.56.10",
|
|
55
63
|
"svelte-check": "^4.3.1",
|
|
56
64
|
"typescript": "~5.8.3",
|
|
57
65
|
"vite": "^7.3.7",
|
|
58
|
-
"vitest": "^4.1.10"
|
|
59
|
-
"@types/node": "^26.1.2"
|
|
66
|
+
"vitest": "^4.1.10"
|
|
60
67
|
},
|
|
61
68
|
"license": "Apache-2.0",
|
|
62
69
|
"files": [
|