@k2b/cloud 0.22.0 → 0.23.0
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/package.json +4 -3
- package/scripts/README.md +1 -1
- package/scripts/build-canvas-workers.ts +58 -0
- package/scripts/build.ts +4 -5
- package/src/_internal/canvas-worker.ts +24 -0
- package/src/_internal/define-app.ts +81 -7
- package/src/_internal/page-responses.ts +19 -3
- package/src/_internal/registry-validation.ts +6 -0
- package/src/_internal/runtime-context.ts +1 -0
- package/src/_internal/static-assets.ts +18 -3
- package/src/access/ResourceApiKeys.tsx +30 -30
- package/src/ai/capability-execution.ts +5 -0
- package/src/ai/client/controller.ts +17 -3
- package/src/ai/client/transport.ts +47 -3
- package/src/ai/live-routes.ts +2 -2
- package/src/ai/pdf-render.ts +2 -22
- package/src/ai/routes.ts +5 -4
- package/src/ai/stream.ts +89 -65
- package/src/api/app-approval.ts +5 -1
- package/src/api/index.ts +3 -0
- package/src/api/me.ts +19 -5
- package/src/api/pwa-phone.ts +161 -0
- package/src/api/pwa.ts +179 -0
- package/src/browser/app-session.ts +69 -0
- package/src/browser/live-connection.ts +211 -0
- package/src/browser/live-websocket.ts +31 -11
- package/src/browser/live.ts +2 -0
- package/src/contracts/app.ts +10 -0
- package/src/contracts/index.ts +1 -0
- package/src/contracts/pwa-paths.ts +6 -0
- package/src/contracts/pwa.ts +156 -0
- package/src/contracts/registry.ts +7 -0
- package/src/contracts/shared.ts +7 -1
- package/src/events/index.ts +2 -0
- package/src/events/live-engine.ts +826 -0
- package/src/events/live-protocol.ts +31 -0
- package/src/events/live.ts +298 -0
- package/src/server/actor.ts +7 -0
- package/src/server/api-client.ts +23 -2
- package/src/server/index.ts +3 -1
- package/src/server/middleware/auth.ts +80 -8
- package/src/server/middleware/openapi.ts +2 -1
- package/src/server/services/access.ts +49 -0
- package/src/server/services/index.ts +1 -0
- package/src/services/app-approval.ts +6 -25
- package/src/services/audit/index.ts +2 -0
- package/src/services/branding/app-icon-source.ts +40 -0
- package/src/services/branding/app-icons.ts +112 -0
- package/src/services/branding/icon-render-worker.ts +69 -0
- package/src/services/branding/icon-svg.ts +22 -0
- package/src/services/identity/invocation-actor.ts +8 -5
- package/src/services/identity/invocation-authority.ts +1 -0
- package/src/services/identity/invocation-token.ts +6 -0
- package/src/services/index.ts +1 -0
- package/src/services/outbox.ts +150 -30
- package/src/services/pairing-secret.ts +16 -0
- package/src/services/pwa-devices.ts +574 -0
- package/src/services/session/index.ts +212 -57
- package/src/services/session/recent.ts +42 -0
- package/src/services/session/user.ts +15 -5
- package/src/shared/index.ts +1 -0
- package/src/{browser → shared}/locale-preference.ts +1 -1
- package/src/shared/markdown/extensions/info-blocks.ts +18 -47
- package/src/shared/markdown/index.ts +5 -14
- package/src/ssr/AppLaunchpad.island.tsx +8 -1
- package/src/ssr/AppLaunchpadPanel.tsx +1 -1
- package/src/ssr/GlobalAnnouncements.island.tsx +1 -1
- package/src/ssr/Layout.tsx +10 -12
- package/src/ssr/LayoutHeader.tsx +14 -2
- package/src/ssr/LayoutHelp.tsx +2 -4
- package/src/ssr/LayoutRail.tsx +13 -4
- package/src/ssr/MinimalLayoutPreferences.island.tsx +1 -1
- package/src/ssr/MobileProfileActions.tsx +19 -13
- package/src/ssr/PageError.tsx +23 -1
- package/src/ssr/ProfilePreferences.island.tsx +9 -1
- package/src/ssr/PwaLayout.tsx +69 -0
- package/src/ssr/PwaRuntime.island.tsx +105 -0
- package/src/ssr/TimezoneCookie.island.tsx +7 -1
- package/src/ssr/app-navigation.ts +25 -10
- package/src/ssr/index.ts +8 -1
- package/src/ssr/layout-context.ts +1 -1
- package/src/ssr/preference-controller.ts +2 -2
- package/src/ssr/profile-actions.ts +3 -1
- package/src/ssr/profile-preferences-messages.ts +2 -0
- package/src/ssr/pwa-messages.ts +24 -0
- package/src/styles/global.css +6 -0
- package/src/styles/utilities-feedback.css +2 -2
- package/scripts/build-pdf-renderer.ts +0 -39
|
@@ -9,6 +9,7 @@ export const profilePreferencesMessages = i18n.define({
|
|
|
9
9
|
language: "Language",
|
|
10
10
|
legalLinks: "Legal",
|
|
11
11
|
profileSettings: "Profile settings",
|
|
12
|
+
app: "App",
|
|
12
13
|
signOut: "Sign out",
|
|
13
14
|
signOutFailed: "Sign out failed. Please try again.",
|
|
14
15
|
switchToDark: "Dark mode",
|
|
@@ -22,6 +23,7 @@ export const profilePreferencesMessages = i18n.define({
|
|
|
22
23
|
language: "Sprache",
|
|
23
24
|
legalLinks: "Rechtliches",
|
|
24
25
|
profileSettings: "Profileinstellungen",
|
|
26
|
+
app: "App",
|
|
25
27
|
signOut: "Abmelden",
|
|
26
28
|
signOutFailed: "Abmelden fehlgeschlagen. Bitte versuche es erneut.",
|
|
27
29
|
switchToDark: "Dunkler Modus",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { i18n } from "@k2b/stdlib";
|
|
2
|
+
|
|
3
|
+
/** Strings of the mobile app's frame: the tab bar, the offline notice and the account notice. */
|
|
4
|
+
export const pwaMessages = i18n.define({
|
|
5
|
+
baseLocale: "en",
|
|
6
|
+
messages: {
|
|
7
|
+
en: {
|
|
8
|
+
tabs: "App",
|
|
9
|
+
start: "Start",
|
|
10
|
+
offline: "You're offline",
|
|
11
|
+
otherAccount: ({ cloud, name }: { cloud: string; name: string }) =>
|
|
12
|
+
`Chrome on this phone is signed in to ${cloud} as ${name}. Changes in the app may be saved to that account. Sign out of ${cloud} in Chrome.`,
|
|
13
|
+
errorAction: "Back to Start",
|
|
14
|
+
},
|
|
15
|
+
de: {
|
|
16
|
+
tabs: "App",
|
|
17
|
+
start: "Start",
|
|
18
|
+
offline: "Du bist offline",
|
|
19
|
+
otherAccount: ({ cloud, name }: { cloud: string; name: string }) =>
|
|
20
|
+
`Chrome auf diesem Telefon ist bei ${cloud} als ${name} angemeldet. Änderungen in der App werden womöglich in diesem Konto gespeichert. Melde dich in Chrome von ${cloud} ab.`,
|
|
21
|
+
errorAction: "Zurück zum Start",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
package/src/styles/global.css
CHANGED
|
@@ -239,6 +239,12 @@ body {
|
|
|
239
239
|
color: rgb(244 244 245); /* zinc-100 */
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
/* Pages of the mobile app paint the shell canvas, which their theme-color and
|
|
243
|
+
html background repeat for the status bar. */
|
|
244
|
+
html:has(.k2b-mobile-shell) body {
|
|
245
|
+
background-color: var(--k2b-surface-canvas);
|
|
246
|
+
}
|
|
247
|
+
|
|
242
248
|
.dark {
|
|
243
249
|
color-scheme: dark;
|
|
244
250
|
--color-selection-bg: rgb(59 130 246 / 0.5);
|
|
@@ -237,8 +237,8 @@
|
|
|
237
237
|
}
|
|
238
238
|
.k2b-ui .cloud-announcement > .k2b-icon-button {
|
|
239
239
|
position: absolute;
|
|
240
|
-
top: 0.
|
|
241
|
-
right: 0.
|
|
240
|
+
top: 0.875rem;
|
|
241
|
+
right: 0.875rem;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/* Approval prose follows the surrounding review fields, not document typography. */
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { cp, mkdir } from "node:fs/promises";
|
|
2
|
-
import { dirname, resolve } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
/** Package the decoder and native assets only for bundles importing PDF vision. */
|
|
7
|
-
export async function buildPdfRenderer(dist: string) {
|
|
8
|
-
const framework = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
9
|
-
const out = resolve(dist, "pdf-render");
|
|
10
|
-
await mkdir(out, { recursive: true });
|
|
11
|
-
const worker = await Bun.build({
|
|
12
|
-
entrypoints: [resolve(framework, "src/ai/pdf-render-worker.ts")],
|
|
13
|
-
target: "bun",
|
|
14
|
-
outdir: out,
|
|
15
|
-
naming: "worker.js",
|
|
16
|
-
external: ["pdfjs-dist", "@napi-rs/canvas"],
|
|
17
|
-
});
|
|
18
|
-
if (!worker.success) throw new Error(`PDF decoder build failed: ${worker.logs.join("\n")}`);
|
|
19
|
-
for (const name of ["pdfjs-dist", "@napi-rs/canvas"]) {
|
|
20
|
-
const source = dirname(Bun.resolveSync(`${name}/package.json`, framework));
|
|
21
|
-
await cp(source, resolve(out, "node_modules", name), { recursive: true, dereference: true });
|
|
22
|
-
if (name !== "@napi-rs/canvas") continue;
|
|
23
|
-
const manifest = z
|
|
24
|
-
.object({ optionalDependencies: z.record(z.string(), z.string()) })
|
|
25
|
-
.parse(await Bun.file(resolve(source, "package.json")).json());
|
|
26
|
-
let nativePackages = 0;
|
|
27
|
-
for (const dependency of Object.keys(manifest.optionalDependencies)) {
|
|
28
|
-
let location: string;
|
|
29
|
-
try {
|
|
30
|
-
location = dirname(Bun.resolveSync(`${dependency}/package.json`, source));
|
|
31
|
-
} catch {
|
|
32
|
-
continue;
|
|
33
|
-
} // Only the installed target-platform binary is needed.
|
|
34
|
-
await cp(location, resolve(out, "node_modules", dependency), { recursive: true, dereference: true });
|
|
35
|
-
nativePackages++;
|
|
36
|
-
}
|
|
37
|
-
if (!nativePackages) throw new Error("PDF decoder needs an installed native canvas binary for the build platform.");
|
|
38
|
-
}
|
|
39
|
-
}
|