@g9tm/aiassistant-svelte 1.1.0 → 1.3.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.
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// All the library's styling is here, under .g9a-styled, from theme tokens; unstyled leaves structure and classes only.
|
|
4
4
|
import type { Snippet } from "svelte";
|
|
5
5
|
import type { Assistant, PartStyles } from "@g9tm/aiassistant";
|
|
6
|
+
import { loadHostTexts, withHostTexts } from "@g9tm/aiassistant/pages";
|
|
6
7
|
import { provideUi, type Overrides } from "./context.js";
|
|
7
8
|
import { themeVars } from "./theme.js";
|
|
8
9
|
|
|
@@ -10,10 +11,14 @@
|
|
|
10
11
|
assistant: Assistant; styles?: PartStyles; unstyled?: boolean; components?: Overrides; children: Snippet;
|
|
11
12
|
} = $props();
|
|
12
13
|
|
|
14
|
+
// The host's server words (its AssistantSetup.Texts), read once: a host key the client does not know shows in words.
|
|
15
|
+
let own = $state<Readonly<Record<string, string>>>({});
|
|
16
|
+
$effect(() => { void loadHostTexts(assistant).then((o) => { own = o; }); });
|
|
17
|
+
|
|
13
18
|
// Getters, not copies: a host that switches unstyled, styles or a replaced component sees it at once.
|
|
14
19
|
provideUi({
|
|
15
20
|
get assistant() { return assistant; },
|
|
16
|
-
get texts() { return assistant.texts; },
|
|
21
|
+
get texts() { return withHostTexts(assistant.texts, () => own); },
|
|
17
22
|
get styles() { return styles; },
|
|
18
23
|
get unstyled() { return unstyled; },
|
|
19
24
|
get components() { return components; },
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// (click, PinPad, code), the taint warning. Confirming always goes through the core, bound to the plan's hash.
|
|
4
4
|
import type { PlanView } from "@g9tm/aiassistant";
|
|
5
5
|
import { needsCode } from "@g9tm/aiassistant";
|
|
6
|
+
import { pageTexts } from "@g9tm/aiassistant/pages";
|
|
6
7
|
import { cls, override, useUi } from "../context.js";
|
|
7
8
|
import PinPad from "../slots/PinPad.svelte";
|
|
8
9
|
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
<Pin bind:value={code} label={t("card.code")} />
|
|
46
47
|
{/if}
|
|
47
48
|
{#if plan.failCode === "confirm.waiting"}<p class="g9a-note" role="status">{t("card.waiting")}</p>
|
|
48
|
-
{:else if plan.failCode}<p class="g9a-note" role="alert">{plan.failCode}{#if plan.triesLeft !== null} · {t("card.tries_left", { count: plan.triesLeft })}{/if}</p>{/if}
|
|
49
|
+
{:else if plan.failCode}<p class="g9a-note" role="alert">{pageTexts(ui.texts).t(plan.failCode)}{#if plan.triesLeft !== null} · {t("card.tries_left", { count: plan.triesLeft })}{/if}</p>{/if}
|
|
49
50
|
<div class="g9a-row">
|
|
50
51
|
<button type="button" class={cls(ui, "card.approval.confirm")} disabled={busy || (needsCode(plan.method) && code.length === 0)} onclick={confirm}>{t("card.confirm")}</button>
|
|
51
52
|
<button type="button" class={cls(ui, "card.approval.refuse")} disabled={busy} onclick={() => ui.assistant.refuse(plan.id)}>{t("card.refuse")}</button>
|
package/dist/pages/texts.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
2
|
+
* The words of the person's pages now live in the core's "/pages" entry (with the history.*, routine.* keys the pages
|
|
3
|
+
* use), so every renderer shares one catalogue: the host's texts and the core's win, then the pages' own.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
/** The pages' texts over the assistant's: a key the host or the core knows keeps its text. */
|
|
7
|
-
export declare function pageTexts(texts: Texts): Texts;
|
|
8
|
-
/** Every key the pages add (for hosts that translate to another language). */
|
|
9
|
-
export declare function pageKeys(): string[];
|
|
5
|
+
export { pageKeys, pageTexts } from "@g9tm/aiassistant/pages";
|
package/dist/pages/texts.js
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
2
|
+
* The words of the person's pages now live in the core's "/pages" entry (with the history.*, routine.* keys the pages
|
|
3
|
+
* use), so every renderer shares one catalogue: the host's texts and the core's win, then the pages' own.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
const FA = {
|
|
7
|
-
"history.tabs": "گفتوگوها",
|
|
8
|
-
"history.empty": "چیزی اینجا نیست",
|
|
9
|
-
"history.untitled": "بینام",
|
|
10
|
-
"routine.list": "روالها",
|
|
11
|
-
"routine.empty": "هنوز روالی نیست",
|
|
12
|
-
"routine.search": "جستوجو…",
|
|
13
|
-
"routine.none_found": "چیزی پیدا نشد",
|
|
14
|
-
"routine.change": "تغییر",
|
|
15
|
-
"routine.failed": "اجرا نشد",
|
|
16
|
-
};
|
|
17
|
-
const EN = {
|
|
18
|
-
"history.tabs": "Conversations",
|
|
19
|
-
"history.empty": "Nothing here",
|
|
20
|
-
"history.untitled": "Untitled",
|
|
21
|
-
"routine.list": "Routines",
|
|
22
|
-
"routine.empty": "No routines yet",
|
|
23
|
-
"routine.search": "Search…",
|
|
24
|
-
"routine.none_found": "Nothing found",
|
|
25
|
-
"routine.change": "Change",
|
|
26
|
-
"routine.failed": "It did not run",
|
|
27
|
-
};
|
|
28
|
-
/** The pages' texts over the assistant's: a key the host or the core knows keeps its text. */
|
|
29
|
-
export function pageTexts(texts) {
|
|
30
|
-
const own = createTexts(texts.locale, texts.locale === "fa" ? FA : EN);
|
|
31
|
-
return {
|
|
32
|
-
locale: texts.locale,
|
|
33
|
-
t(key, args) {
|
|
34
|
-
const v = texts.t(key, args);
|
|
35
|
-
return v !== key ? v : own.t(key, args);
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/** Every key the pages add (for hosts that translate to another language). */
|
|
40
|
-
export function pageKeys() {
|
|
41
|
-
return Object.keys(EN).sort();
|
|
42
|
-
}
|
|
5
|
+
export { pageKeys, pageTexts } from "@g9tm/aiassistant/pages";
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
async function attach(): Promise<void> {
|
|
20
|
-
|
|
21
|
-
if (f) await ui.assistant.attach(f.name, f.bytes);
|
|
20
|
+
await ui.assistant.attachFromDevice();
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
async function dictate(): Promise<void> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@g9tm/aiassistant-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Svelte 5 components for the G9 AI assistant, fully customisable (layouts, tokens, per-part classes, overrides, parts).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@g9tm/aiassistant": "1.
|
|
34
|
+
"@g9tm/aiassistant": "1.3.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@sveltejs/package": "2.5.8",
|