@g9tm/aiassistant-lynx 1.4.0 → 1.4.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.
Files changed (2) hide show
  1. package/dist/pages.jsx +7 -4
  2. package/package.json +2 -2
package/dist/pages.jsx CHANGED
@@ -146,12 +146,13 @@ function HistoryBody(props) {
146
146
  const change = (call) => { void call.then(load, () => load().then(() => setFailed(true))); };
147
147
  const tabs = historyTabs(rows ?? [], new Date(timer(ui.assistant.host).now()), search);
148
148
  const counts = tabCounts(tabs);
149
- const shown = tabs[tab];
149
+ const shown = new Map(Object.entries(tabs)).get(tab) ?? [];
150
+ const countOf = (k) => new Map(Object.entries(counts)).get(k) ?? 0;
150
151
  const open = async (id) => { await ui.assistant.open(id); props.onOpen?.(id); };
151
152
  return (<Frame failed={failed} flow={props.flow}>
152
153
  <input style={{ ...field(ui), marginBottom: "8px" }} placeholder={t("history.search")} accessibility-label={t("history.search")} bindinput={(e) => setSearch(e.detail.value)}/>
153
154
  <view className="g9a-history-tabs" style={{ ...rowOf(ui, "6px"), flexWrap: "wrap", marginBottom: "8px" }}>
154
- {HISTORY_TABS.map((k) => <Tab key={k} label={t("history." + k)} count={counts[k]} on={tab === k} onTap={() => setTab(k)}/>)}
155
+ {HISTORY_TABS.map((k) => <Tab key={k} label={t("history." + k)} count={countOf(k)} on={tab === k} onTap={() => setTab(k)}/>)}
155
156
  </view>
156
157
  {rows !== null && shown.length === 0 ? <Empty words={t("history.empty")}/> : shown.map((c) => (<HistoryRow key={c.id} row={c} onOpen={() => void open(c.id)} onPin={() => change(pageCalls.pin(api, c.id, !c.pinned))} onDelete={() => setDoomed(c)}/>))}
157
158
  <Dialog open={doomed !== null} label={t("history.delete_confirm")} onClose={() => setDoomed(null)}>
@@ -175,10 +176,12 @@ export const SlotPicker = swappable("SlotPicker", (props) => {
175
176
  const [failed, setFailed] = useState(false);
176
177
  const wait = useRef(null);
177
178
  const asked = useRef(0);
179
+ const [query, setQuery] = useState("");
178
180
  const find = (q) => {
179
181
  const n = ++asked.current;
180
182
  pageCalls.pick(ui.assistant.api, props.slot.kind, q).then((r) => { if (n === asked.current) {
181
183
  setItems(readPicks(r));
184
+ setQuery(q.trim());
182
185
  setFailed(false);
183
186
  } }, () => { if (n === asked.current) {
184
187
  setItems([]);
@@ -199,7 +202,7 @@ export const SlotPicker = swappable("SlotPicker", (props) => {
199
202
  <view className="g9a-slot-picker">
200
203
  <input style={{ ...field(ui), marginBottom: "8px" }} placeholder={t("history.search")} accessibility-label={t("history.search")} bindinput={(e) => typed(e.detail.value)}/>
201
204
  {failed ? <text style={{ color: tok(ui, "danger", "#b42318") }} text-maxline="2">{t("error.network")}</text> : null}
202
- {items !== null && items.length === 0 && !failed ? <Empty words={t("routine.none_found")}/> : (items ?? []).map((p) => <Button key={p.id} label={p.label} onTap={() => props.onPick(p)}/>)}
205
+ {items !== null && items.length === 0 && !failed ? <Empty words={t(query.length === 0 ? "routine.type_to_search" : "routine.none_found")}/> : (items ?? []).map((p) => <Button key={p.id} label={p.label} onTap={() => props.onPick(p)}/>)}
203
206
  </view>
204
207
  </Dialog>);
205
208
  });
@@ -298,7 +301,7 @@ function RoutineForm(props) {
298
301
  {s.field === "pick" ? (<view style={rowOf(ui, "8px")}>
299
302
  <view style={grow}><text text-maxline="1">{picked.get(s.name)?.label ?? "—"}</text></view>
300
303
  <Button label={t("routine.choose")} onTap={() => setPicking(s)}/>
301
- </view>) : (<input style={{ ...field(ui) }} type="text" placeholder={s.name} accessibility-label={s.name} bindinput={(e) => edit(s.name, e.detail.value)}/>)}
304
+ </view>) : (<input style={{ ...field(ui) }} type="text" placeholder={slotLabel(t, s.name)} accessibility-label={slotLabel(t, s.name)} bindinput={(e) => edit(s.name, e.detail.value)}/>)}
302
305
  {flag ? <text className="g9a-routine-flag" style={{ fontSize: "12px", color: danger }} text-maxline="1">{t(flag)}</text> : null}
303
306
  </view>);
304
307
  })}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@g9tm/aiassistant-lynx",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "ReactLynx components for the G9 AI assistant, fully customisable (layouts, tokens, per-part classes, overrides, parts).",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -29,7 +29,7 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@g9tm/aiassistant": "1.4.0"
32
+ "@g9tm/aiassistant": "1.4.2"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@lynx-js/react": "0.129.2",