@linxin666/dsh-pet 0.4.10 → 0.4.12

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 (58) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +1 -1
  3. package/README.zh.md +4 -4
  4. package/lib/client.js +1137 -352
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +32 -0
  7. package/lib/types/client/PetPreview.d.ts +12 -0
  8. package/lib/types/client/PetPreview.d.ts.map +1 -0
  9. package/lib/types/client/PetPreview.js +32 -0
  10. package/lib/types/client/PetSettingsCard.d.ts +46 -3
  11. package/lib/types/client/PetSettingsCard.d.ts.map +1 -1
  12. package/lib/types/client/PetSettingsCard.js +96 -11
  13. package/lib/types/client/PluginSettingsCard.d.ts +131 -17
  14. package/lib/types/client/PluginSettingsCard.d.ts.map +1 -1
  15. package/lib/types/client/PluginSettingsCard.js +158 -37
  16. package/lib/types/client/RangeBubble.d.ts +47 -0
  17. package/lib/types/client/RangeBubble.d.ts.map +1 -0
  18. package/lib/types/client/RangeBubble.js +107 -0
  19. package/lib/types/client/SegmentGroup.d.ts +29 -0
  20. package/lib/types/client/SegmentGroup.d.ts.map +1 -0
  21. package/lib/types/client/SegmentGroup.js +81 -0
  22. package/lib/types/client/index.d.ts.map +1 -1
  23. package/lib/types/client/index.js +9 -28
  24. package/lib/types/client/locales.d.ts +36 -44
  25. package/lib/types/client/locales.d.ts.map +1 -1
  26. package/lib/types/client/locales.js +36 -44
  27. package/lib/types/client/settings-form.d.ts +79 -41
  28. package/lib/types/client/settings-form.d.ts.map +1 -1
  29. package/lib/types/client/settings-form.js +96 -36
  30. package/lib/types/client/settings-registration.d.ts +15 -0
  31. package/lib/types/client/settings-registration.d.ts.map +1 -0
  32. package/lib/types/client/settings-registration.js +24 -0
  33. package/lib/types/client/web-extension-contract.d.ts +32 -0
  34. package/lib/types/client/web-extension-contract.d.ts.map +1 -0
  35. package/lib/types/client/web-extension-contract.js +6 -0
  36. package/lib/types/client/web-extension-page.d.ts +51 -0
  37. package/lib/types/client/web-extension-page.d.ts.map +1 -0
  38. package/lib/types/client/web-extension-page.js +122 -0
  39. package/lib/types/registry.d.ts.map +1 -1
  40. package/lib/types/registry.js +35 -0
  41. package/package.json +1 -1
  42. package/src/client/PetPreview.tsx +51 -0
  43. package/src/client/PetSettingsCard.test.tsx +78 -22
  44. package/src/client/PetSettingsCard.tsx +252 -115
  45. package/src/client/PluginSettingsCard.tsx +369 -108
  46. package/src/client/RangeBubble.tsx +163 -0
  47. package/src/client/SegmentGroup.tsx +92 -0
  48. package/src/client/index.ts +9 -27
  49. package/src/client/locales.ts +36 -44
  50. package/src/client/settings-card.module.css +493 -91
  51. package/src/client/settings-form.ts +116 -49
  52. package/src/client/settings-registration.test.ts +79 -0
  53. package/src/client/settings-registration.ts +34 -0
  54. package/src/client/settings-section.module.css +182 -0
  55. package/src/client/web-extension-contract.ts +35 -0
  56. package/src/client/web-extension-page.ts +150 -0
  57. package/src/registry.test.ts +121 -1
  58. package/src/registry.ts +37 -0
@@ -0,0 +1,107 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Coarse adjustment for a bounded number: resting the pointer on the control
4
+ * (or moving focus into it) raises a small bubble holding a slider across the
5
+ * field's whole range, so a large change is one drag instead of many presses
6
+ * or a retyped value. The control itself stays the precise entry.
7
+ *
8
+ * The bubble belongs to the anchor's subtree, so moving from the control onto
9
+ * the bubble never counts as leaving. It opens after a short rest and closes a
10
+ * moment after the pointer and focus have both gone, so crossing the control
11
+ * on the way elsewhere does not flash it. While a drag is in progress the
12
+ * bubble stays put even if the pointer strays off it.
13
+ *
14
+ * Dragging reports each value through `onInput`, so the field shows it live;
15
+ * releasing the thumb, or a key press on it, reports `onCommit` once. The
16
+ * bubble opens on the side of the control that has room inside the nearest
17
+ * scrolling ancestor, so a row near the top of a settings page does not hang
18
+ * its bubble under the page edge.
19
+ */
20
+ import { useEffect, useRef, useState } from 'react';
21
+ import css from './settings-card.module.css';
22
+ /** Rest on the control before the bubble opens. */
23
+ const OPEN_DELAY_MS = 220;
24
+ /** Grace after pointer and focus have left before the bubble closes. */
25
+ const CLOSE_DELAY_MS = 200;
26
+ /** Room the bubble needs between the control and the scroller's edge. */
27
+ const BUBBLE_ROOM_PX = 64;
28
+ /** The nearest ancestor that scrolls vertically, or the viewport's root. */
29
+ function scroller(node) {
30
+ for (let parent = node.parentElement; parent !== null; parent = parent.parentElement) {
31
+ const overflow = getComputedStyle(parent).overflowY;
32
+ if (overflow === 'auto' || overflow === 'scroll')
33
+ return parent;
34
+ }
35
+ return node.ownerDocument.documentElement;
36
+ }
37
+ /**
38
+ * Render the control with its coarse-adjustment bubble.
39
+ * @param props - the range, the value and the two report callbacks.
40
+ * @returns the anchor holding the control and the bubble.
41
+ */
42
+ export function RangeBubble(props) {
43
+ const { min, max, step, disabled = false } = props;
44
+ const [open, setOpen] = useState(false);
45
+ const [side, setSide] = useState('above');
46
+ const [live, setLive] = useState(null);
47
+ const anchorRef = useRef(null);
48
+ const timer = useRef(undefined);
49
+ const hovered = useRef(false);
50
+ const focused = useRef(false);
51
+ const dragging = useRef(false);
52
+ useEffect(() => () => { clearTimeout(timer.current); }, []);
53
+ useEffect(() => {
54
+ if (disabled) {
55
+ clearTimeout(timer.current);
56
+ setOpen(false);
57
+ }
58
+ }, [disabled]);
59
+ const show = () => {
60
+ const anchor = anchorRef.current;
61
+ if (anchor !== null) {
62
+ const room = anchor.getBoundingClientRect().top - scroller(anchor).getBoundingClientRect().top;
63
+ setSide(room >= BUBBLE_ROOM_PX ? 'above' : 'below');
64
+ }
65
+ setOpen(true);
66
+ };
67
+ const schedule = () => {
68
+ clearTimeout(timer.current);
69
+ if (disabled)
70
+ return;
71
+ if (hovered.current || focused.current || dragging.current) {
72
+ if (!open)
73
+ timer.current = setTimeout(show, focused.current ? 0 : OPEN_DELAY_MS);
74
+ return;
75
+ }
76
+ timer.current = setTimeout(() => { setOpen(false); }, CLOSE_DELAY_MS);
77
+ };
78
+ const commit = (value) => {
79
+ dragging.current = false;
80
+ setLive(null);
81
+ props.onCommit(value);
82
+ schedule();
83
+ };
84
+ const onChange = (event) => {
85
+ const value = Number(event.target.value);
86
+ setLive(value);
87
+ props.onInput(value);
88
+ };
89
+ const onKeyUp = (event) => {
90
+ if (live !== null)
91
+ commit(live);
92
+ if (event.key === 'Escape') {
93
+ clearTimeout(timer.current);
94
+ setOpen(false);
95
+ }
96
+ };
97
+ const shown = live ?? Math.min(max, Math.max(min, props.value));
98
+ return (_jsxs("div", { ref: anchorRef, className: css.rangeAnchor, onPointerEnter: () => { hovered.current = true; schedule(); }, onPointerLeave: () => { hovered.current = false; schedule(); }, onFocus: () => { focused.current = true; schedule(); }, onBlur: (event) => {
99
+ if (event.currentTarget.contains(event.relatedTarget))
100
+ return;
101
+ focused.current = false;
102
+ if (live !== null)
103
+ commit(live);
104
+ else
105
+ schedule();
106
+ }, children: [props.children, _jsxs("div", { className: css.rangeBubble, "data-open": open ? '' : undefined, "data-side": side, children: [_jsx("input", { type: "range", className: css.rangeSlider, min: min, max: max, step: step, value: shown, "aria-label": props.label, tabIndex: open ? 0 : -1, disabled: disabled, style: { '--range-fill': `${((shown - min) / (max - min)) * 100}%` }, onPointerDown: () => { dragging.current = true; }, onPointerUp: (event) => { commit(Number(event.currentTarget.value)); }, onPointerCancel: (event) => { commit(Number(event.currentTarget.value)); }, onChange: onChange, onKeyUp: onKeyUp }), _jsxs("span", { className: css.rangeEnds, "aria-hidden": "true", children: [_jsx("span", { children: min }), _jsx("span", { children: max })] })] })] }));
107
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The family's segmented control: a quiet track whose options share one
3
+ * highlight that slides to the pressed option, instead of each option fading
4
+ * its own background out and the next one in. The settings fields' small
5
+ * choices and the Web Extensions TAB strip both render through it, so the two
6
+ * read as one control.
7
+ *
8
+ * The caller builds the option buttons and marks the pressed one with
9
+ * `data-active`; the group measures that button after every render and writes
10
+ * its box as four custom properties, and the stylesheet draws the highlight
11
+ * there (`.segmentGroup[data-pill]::before`). Attribute and first placement
12
+ * land in the same task, so the highlight appears in place and only later
13
+ * changes slide. A ResizeObserver re-measures when the group or an option
14
+ * changes size: a longer locale, a font arriving, a container growing, a
15
+ * strip wrapping onto a second line.
16
+ */
17
+ import { type HTMLAttributes, type ReactNode } from 'react';
18
+ /** Props of {@link SegmentGroup}: the track's own attributes and the option buttons. */
19
+ export interface SegmentGroupProps extends HTMLAttributes<HTMLDivElement> {
20
+ /** The option buttons; the pressed one carries `data-active`. */
21
+ children: ReactNode;
22
+ }
23
+ /**
24
+ * Render a segmented track around the caller's option buttons.
25
+ * @param props - the track's attributes (role, accessible name, key handler) and its options.
26
+ * @returns the track.
27
+ */
28
+ export declare function SegmentGroup(props: SegmentGroupProps): ReactNode;
29
+ //# sourceMappingURL=SegmentGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentGroup.d.ts","sourceRoot":"","sources":["../../../src/client/SegmentGroup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAqC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAS9F,wFAAwF;AACxF,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACvE,iEAAiE;IACjE,QAAQ,EAAE,SAAS,CAAA;CACpB;AA+BD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAyBhE"}
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * The family's segmented control: a quiet track whose options share one
4
+ * highlight that slides to the pressed option, instead of each option fading
5
+ * its own background out and the next one in. The settings fields' small
6
+ * choices and the Web Extensions TAB strip both render through it, so the two
7
+ * read as one control.
8
+ *
9
+ * The caller builds the option buttons and marks the pressed one with
10
+ * `data-active`; the group measures that button after every render and writes
11
+ * its box as four custom properties, and the stylesheet draws the highlight
12
+ * there (`.segmentGroup[data-pill]::before`). Attribute and first placement
13
+ * land in the same task, so the highlight appears in place and only later
14
+ * changes slide. A ResizeObserver re-measures when the group or an option
15
+ * changes size: a longer locale, a font arriving, a container growing, a
16
+ * strip wrapping onto a second line.
17
+ */
18
+ import { Children, useLayoutEffect, useRef } from 'react';
19
+ import css from './settings-card.module.css';
20
+ /** The attribute marking a group whose highlight has been placed. */
21
+ const PILL_ATTR = 'data-pill';
22
+ /** The pressed option, relative to the group. */
23
+ const ACTIVE_SELECTOR = ':scope > [data-active]';
24
+ const PILL_PROPERTIES = ['--segment-pill-x', '--segment-pill-y', '--segment-pill-w', '--segment-pill-h'];
25
+ /**
26
+ * Write the highlight's box from the pressed option's box, or take the
27
+ * highlight off when nothing is pressed or the group has no layout yet.
28
+ * The two boxes are read in viewport pixels and turned back into the group's
29
+ * own CSS pixels, so a dialog that opens through a scale transform still
30
+ * lands the highlight on its option.
31
+ */
32
+ function placePill(group) {
33
+ const item = group.querySelector(ACTIVE_SELECTOR);
34
+ const box = group.getBoundingClientRect();
35
+ if (item === null || group.offsetWidth === 0 || box.width === 0) {
36
+ group.removeAttribute(PILL_ATTR);
37
+ for (const property of PILL_PROPERTIES)
38
+ group.style.removeProperty(property);
39
+ return;
40
+ }
41
+ const scale = box.width / group.offsetWidth;
42
+ const itemBox = item.getBoundingClientRect();
43
+ const values = [
44
+ (itemBox.left - box.left) / scale - group.clientLeft,
45
+ (itemBox.top - box.top) / scale - group.clientTop,
46
+ itemBox.width / scale,
47
+ itemBox.height / scale,
48
+ ];
49
+ values.forEach((value, index) => {
50
+ group.style.setProperty(PILL_PROPERTIES[index], `${Math.round(value * 100) / 100}px`);
51
+ });
52
+ if (!group.hasAttribute(PILL_ATTR))
53
+ group.setAttribute(PILL_ATTR, '');
54
+ }
55
+ /**
56
+ * Render a segmented track around the caller's option buttons.
57
+ * @param props - the track's attributes (role, accessible name, key handler) and its options.
58
+ * @returns the track.
59
+ */
60
+ export function SegmentGroup(props) {
61
+ const { children, className, ...rest } = props;
62
+ const group = useRef(null);
63
+ const count = Children.count(children);
64
+ // Placed before the frame is painted, after every render: a press moves the
65
+ // pressed mark and the highlight follows it in the same frame.
66
+ useLayoutEffect(() => {
67
+ if (group.current !== null)
68
+ placePill(group.current);
69
+ });
70
+ useLayoutEffect(() => {
71
+ const element = group.current;
72
+ if (element === null || typeof ResizeObserver === 'undefined')
73
+ return undefined;
74
+ const observer = new ResizeObserver(() => { placePill(element); });
75
+ observer.observe(element);
76
+ for (const item of Array.from(element.children))
77
+ observer.observe(item);
78
+ return () => { observer.disconnect(); };
79
+ }, [count]);
80
+ return (_jsx("div", { ...rest, ref: group, className: className === undefined ? css.segmentGroup : `${css.segmentGroup} ${className}`, children: children }));
81
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,4CAA4C,CAAA;AAuFhG,wEAAwE;AACxE,eAAO,MAAM,MAAM,UAAwF,CAAA;AAE3G,qEAAqE;AACrE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACxE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7D,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACtF,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf;;;;WAIG;QACH,aAAa,CAAC,EAAE;YACd,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE;gBAAE,SAAS,EAAE,MAAM,CAAC;gBAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,CAAC,GAAG,SAAS,CAAA;aAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;SAClG,CAAA;KACF;CACF;AAUD,mFAAmF;AACnF,eAAO,MAAM,eAAe,MAAM,CAAA;AA2NlC,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA2W9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,4CAA4C,CAAA;AAwFhG,wEAAwE;AACxE,eAAO,MAAM,MAAM,UAAwF,CAAA;AAE3G,qEAAqE;AACrE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACxE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7D,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACtF,YAAY,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf;;;;WAIG;QACH,aAAa,CAAC,EAAE;YACd,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE;gBAAE,SAAS,EAAE,MAAM,CAAC;gBAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,CAAC,GAAG,SAAS,CAAA;aAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;SAClG,CAAA;KACF;CACF;AAUD,mFAAmF;AACnF,eAAO,MAAM,eAAe,MAAM,CAAA;AA2NlC,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAwV9C"}
@@ -21,7 +21,8 @@ import { defaultPetRendererRegistry } from "./renderers/registry.js";
21
21
  import { live2dRenderer } from "./renderers/live2d.js";
22
22
  import { frames2dRenderer } from "./renderers/frames2d.js";
23
23
  import { registerPetUiTeardown, takeoverPetUiTeardown } from "./ui-teardown.js";
24
- import { PetSettingsSection, PetSettingsCardController } from "./PetSettingsCard.js";
24
+ import { PetSettingsCardController } from "./PetSettingsCard.js";
25
+ import { installPetSettingsRegistration } from "./settings-registration.js";
25
26
  import { NS, en, zh } from "./locales.js";
26
27
  import { mainViewSessionId } from "./main-session.js";
27
28
  import { reportDailyHeartbeat } from "./telemetry.js";
@@ -306,34 +307,14 @@ export function apply(ctx) {
306
307
  ? snapshot.value?.enabled ?? true
307
308
  : snapshot.status === 'unavailable';
308
309
  };
309
- // First-level settings section: one staged form over the 'pet' profile
310
- // entry's configuration, registered as a top-level settings page. The
311
- // controller loads the petId choices from the registry endpoint itself — the
312
- // registry lists the available pets (built-in assets plus user dirs), so the
313
- // section only ever shows installed pets. Installing new pets happens in the
314
- // Workshop store.
310
+ // One staged form follows the pet page between Web Extensions and the
311
+ // standalone first-level section. Seat migration does not reset drafts.
315
312
  const petSettings = new PetSettingsCardController(settingsForm);
316
- // The section entry owns the controller: unregistering it (fiber disposal,
317
- // hot reload) releases the form subscription through petSettings.dispose.
318
- ctx.slots.inject('settings.section', () => {
319
- try {
320
- const unregister = ctx.slots.register({
321
- name: 'settings.section',
322
- id: 'pet',
323
- order: 130,
324
- label: () => ctx.locale.bind('pet')('settings.title'),
325
- locale: 'pet',
326
- inject: () => petSettings.inject(),
327
- }, PetSettingsSection);
328
- return () => {
329
- unregister();
330
- petSettings.dispose();
331
- };
332
- }
333
- catch {
334
- return () => { };
335
- }
336
- });
313
+ const disposeSettingsRegistration = installPetSettingsRegistration(ctx, petSettings);
314
+ ctx.effect(() => () => {
315
+ disposeSettingsRegistration();
316
+ petSettings.dispose();
317
+ }, 'pet: settings page');
337
318
  // The global pet entry, its store, and the poll loop live while the plugin
338
319
  // is enabled; toggling the setting off hides the pet and stops polling.
339
320
  // 'uiDead' marks a terminal teardown (takeover by a later bundle instance
@@ -53,40 +53,36 @@ export declare const zh: {
53
53
  readonly 'pet.moreSessions': "展开其余 {n} 个会话的气泡";
54
54
  readonly 'pet.collapseSessions': "收起会话气泡";
55
55
  readonly 'settings.title': "宠物";
56
- readonly 'settings.description': "选择宠物并调整它的显示布局。";
56
+ readonly 'settings.description': "选一只宠物,摆在页面的角落里。";
57
57
  readonly 'settings.pet': "宠物";
58
- readonly 'settings.petHint': "选择显示哪只宠物;每只宠物独立命名,可在宠物悬浮面板改名。";
59
- readonly 'settings.enabled': "启用宠物";
60
- readonly 'settings.enabledHint': "关闭后隐藏宠物并停止轮询,可在设置里重新启用。";
58
+ readonly 'settings.petHint': "名字跟着宠物走,在宠物面板里改。";
59
+ readonly 'settings.displayGroup': "显示";
60
+ readonly 'settings.bubbleGroup': "气泡";
61
61
  readonly 'settings.decoration': "状态装饰";
62
- readonly 'settings.decorationHint': "在宠物状态气泡里显示喷水鲸鱼等状态装饰;关闭后气泡只剩文字。";
62
+ readonly 'settings.decorationHint': "气泡里带上喷水鲸鱼这类装饰。";
63
63
  readonly 'settings.statusBubbles': "状态气泡";
64
- readonly 'settings.statusBubblesHint': "宠物自带的会话/状态气泡(正在思考、正在使用 xxx)。关掉后只剩第三方插件通过公告契约推送的气泡与互动反馈气泡;默认开启。";
64
+ readonly 'settings.statusBubblesHint': "宠物报告正在思考、正在用哪个工具。";
65
65
  readonly 'settings.visible': "显示宠物";
66
- readonly 'settings.visibleHint': "关闭后宠物隐藏,可从聊天输入区重新召唤。";
66
+ readonly 'settings.visibleHint': "藏起来后可在输入区召唤回来。";
67
67
  readonly 'settings.size': "大小(px)";
68
- readonly 'settings.sizeHint': "精灵单元高度,范围 32–1024。";
69
- readonly 'settings.bubbleScale': "气泡字号倍率";
70
- readonly 'settings.bubbleScaleHint': "状态、碎碎念与用量气泡的字号会随宠物大小自动缩放;这一项是在此基础上再乘一个倍率(0.5–2,默认 1)。字号本身不小于 10px、不大于 24px。";
68
+ readonly 'settings.sizeHint': "宠物的高度。";
69
+ readonly 'settings.bubbleScale': "气泡字号";
70
+ readonly 'settings.bubbleScaleHint': "字号随宠物缩放,再乘上这个倍数。";
71
71
  readonly 'settings.right': "距右侧(px)";
72
- readonly 'settings.rightHint': "距视口右边缘的水平内缩距离。";
72
+ readonly 'settings.rightHint': "离窗口右边的距离。";
73
73
  readonly 'settings.bottom': "距底部(px)";
74
- readonly 'settings.bottomHint': "距视口底边的垂直内缩距离。";
75
- readonly 'settings.inherit': "继承";
74
+ readonly 'settings.bottomHint': "离窗口底边的距离。";
75
+ readonly 'settings.inherit': "默认";
76
76
  readonly 'settings.on': "开";
77
77
  readonly 'settings.off': "关";
78
- readonly 'settings.overridden': "已覆盖";
78
+ readonly 'settings.overridden': "已修改";
79
79
  readonly 'settings.reset': "恢复默认";
80
- readonly 'settings.notExposed': "当前 DSH 版本未向设置页暴露本插件的配置命名空间,表单不可用。可编辑 $DSH_HOME/settings.yaml 直接配置,或确认提供该命名空间的插件已挂载其设置域并重启。";
81
- readonly 'settings.readOnly': "当前部署的设置只读。";
80
+ readonly 'settings.notExposed': "这个版本的 DSH 没有开放宠物的设置,可直接编辑 $DSH_HOME/settings.yaml。";
81
+ readonly 'settings.readOnly': "设置只读。";
82
82
  readonly 'settings.expand': "展开设置";
83
83
  readonly 'settings.collapse': "收起设置";
84
- readonly 'settings.save': "保存";
85
- readonly 'settings.saving': "保存中…";
86
- readonly 'settings.discard': "放弃";
87
- readonly 'settings.unsaved': "未保存";
88
- readonly 'settings.saveFailed': "部署未接受这些值,已保留供你修改。";
89
- readonly 'settings.invalidNumber': "请输入数字,留空则使用默认值。";
84
+ readonly 'settings.saveFailed': "没有保存成功,输入的值还留着。";
85
+ readonly 'settings.invalidNumber': "填一个数字,留空用默认值。";
90
86
  };
91
87
  /** English copy. */
92
88
  export declare const en: {
@@ -137,40 +133,36 @@ export declare const en: {
137
133
  readonly 'pet.moreSessions': "Expand {n} more session bubbles";
138
134
  readonly 'pet.collapseSessions': "Collapse session bubbles";
139
135
  readonly 'settings.title': "Pet";
140
- readonly 'settings.description': "Pick a pet and tune its display layout.";
136
+ readonly 'settings.description': "Pick a pet to sit in a corner of the page.";
141
137
  readonly 'settings.pet': "Pet";
142
- readonly 'settings.petHint': "Choose which pet shows. Names are stored per pet; rename from the pet hover panel.";
143
- readonly 'settings.enabled': "Enable the pet";
144
- readonly 'settings.enabledHint': "When off, the pet hides and polling stops; re-enable it here.";
138
+ readonly 'settings.petHint': "Each pet keeps its own name; rename it from the pet panel.";
139
+ readonly 'settings.displayGroup': "Display";
140
+ readonly 'settings.bubbleGroup': "Bubbles";
145
141
  readonly 'settings.decoration': "Status decoration";
146
- readonly 'settings.decorationHint': "Show ornaments like the spouting whale inside the pet status bubbles; when off, bubbles stay text-only.";
142
+ readonly 'settings.decorationHint': "Bubbles carry ornaments like the spouting whale.";
147
143
  readonly 'settings.statusBubbles': "Status bubbles";
148
- readonly 'settings.statusBubblesHint': "The pet's own session/status bubbles (thinking, using ...). Turning them off leaves only bubbles a third-party plugin pushes through the announcement contract, plus the interaction feedback bubble; on by default.";
144
+ readonly 'settings.statusBubblesHint': "The pet reports when it is thinking and which tool it is using.";
149
145
  readonly 'settings.visible': "Show the pet";
150
- readonly 'settings.visibleHint': "When off, the pet hides; summon it again from the input row.";
146
+ readonly 'settings.visibleHint': "A hidden pet comes back from the input row.";
151
147
  readonly 'settings.size': "Size (px)";
152
- readonly 'settings.sizeHint': "Sprite cell height, 32–1024.";
153
- readonly 'settings.bubbleScale': "Bubble text multiplier";
154
- readonly 'settings.bubbleScaleHint': "Status, whisper, and usage bubbles scale with the pet automatically; this multiplies that result (0.5–2, default 1). The rendered text stays between 10px and 24px.";
148
+ readonly 'settings.sizeHint': "How tall the pet stands.";
149
+ readonly 'settings.bubbleScale': "Bubble text";
150
+ readonly 'settings.bubbleScaleHint': "Text follows the pet size, times this factor.";
155
151
  readonly 'settings.right': "Right inset (px)";
156
- readonly 'settings.rightHint': "Horizontal inset from the viewport right edge.";
152
+ readonly 'settings.rightHint': "Distance from the right edge of the window.";
157
153
  readonly 'settings.bottom': "Bottom inset (px)";
158
- readonly 'settings.bottomHint': "Vertical inset from the viewport bottom edge.";
159
- readonly 'settings.inherit': "Inherit";
154
+ readonly 'settings.bottomHint': "Distance from the bottom edge of the window.";
155
+ readonly 'settings.inherit': "Default";
160
156
  readonly 'settings.on': "On";
161
157
  readonly 'settings.off': "Off";
162
- readonly 'settings.overridden': "Overridden";
158
+ readonly 'settings.overridden': "Changed";
163
159
  readonly 'settings.reset': "Reset to default";
164
- readonly 'settings.notExposed': "This DSH version does not expose this plugin's settings namespace to the configuration page, so the form is unavailable. Edit $DSH_HOME/settings.yaml directly, or confirm that the plugin owning the namespace is mounted with its settings domain and restart.";
165
- readonly 'settings.readOnly': "This deployment stores settings read-only.";
160
+ readonly 'settings.notExposed': "This DSH version does not open the pet settings here; edit $DSH_HOME/settings.yaml instead.";
161
+ readonly 'settings.readOnly': "Settings are read-only.";
166
162
  readonly 'settings.expand': "Show settings";
167
163
  readonly 'settings.collapse': "Hide settings";
168
- readonly 'settings.save': "Save";
169
- readonly 'settings.saving': "Saving…";
170
- readonly 'settings.discard': "Discard";
171
- readonly 'settings.unsaved': "Unsaved";
172
- readonly 'settings.saveFailed': "The deployment did not accept these values; they were left for you to correct.";
173
- readonly 'settings.invalidNumber': "Enter a number, or leave blank to use the default.";
164
+ readonly 'settings.saveFailed': "Not saved; what you typed is still there.";
165
+ readonly 'settings.invalidNumber': "Enter a number, or leave it empty for the default.";
174
166
  };
175
167
  /** Key union for this namespace. */
176
168
  export type PetKey = keyof typeof zh;
@@ -1 +1 @@
1
- {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mDAAmD;AACnD,eAAO,MAAM,EAAE,QAAQ,CAAA;AAEvB,oBAAoB;AACpB,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFL,CAAA;AAEV,oBAAoB;AACpB,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFL,CAAA;AAEV,oCAAoC;AACpC,MAAM,MAAM,MAAM,GAAG,MAAM,OAAO,EAAE,CAAA;AAEpC,qDAAqD;AACrD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAA;AAEpC;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGnD;AAED;;;;;;;GAOG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQvE;AAED,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,uBAAuB;QACvB,GAAG,EAAE,MAAM,CAAA;KACZ;CACF"}
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mDAAmD;AACnD,eAAO,MAAM,EAAE,QAAQ,CAAA;AAEvB,oBAAoB;AACpB,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFL,CAAA;AAEV,oBAAoB;AACpB,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFL,CAAA;AAEV,oCAAoC;AACpC,MAAM,MAAM,MAAM,GAAG,MAAM,OAAO,EAAE,CAAA;AAEpC,qDAAqD;AACrD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAA;AAEpC;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGnD;AAED;;;;;;;GAOG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQvE;AAED,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,uBAAuB;QACvB,GAAG,EAAE,MAAM,CAAA;KACZ;CACF"}
@@ -55,40 +55,36 @@ export const zh = {
55
55
  'pet.collapseSessions': '收起会话气泡',
56
56
  // 一级设置页(settings.section 席位)。
57
57
  'settings.title': '宠物',
58
- 'settings.description': '选择宠物并调整它的显示布局。',
58
+ 'settings.description': '选一只宠物,摆在页面的角落里。',
59
59
  'settings.pet': '宠物',
60
- 'settings.petHint': '选择显示哪只宠物;每只宠物独立命名,可在宠物悬浮面板改名。',
61
- 'settings.enabled': '启用宠物',
62
- 'settings.enabledHint': '关闭后隐藏宠物并停止轮询,可在设置里重新启用。',
60
+ 'settings.petHint': '名字跟着宠物走,在宠物面板里改。',
61
+ 'settings.displayGroup': '显示',
62
+ 'settings.bubbleGroup': '气泡',
63
63
  'settings.decoration': '状态装饰',
64
- 'settings.decorationHint': '在宠物状态气泡里显示喷水鲸鱼等状态装饰;关闭后气泡只剩文字。',
64
+ 'settings.decorationHint': '气泡里带上喷水鲸鱼这类装饰。',
65
65
  'settings.statusBubbles': '状态气泡',
66
- 'settings.statusBubblesHint': '宠物自带的会话/状态气泡(正在思考、正在使用 xxx)。关掉后只剩第三方插件通过公告契约推送的气泡与互动反馈气泡;默认开启。',
66
+ 'settings.statusBubblesHint': '宠物报告正在思考、正在用哪个工具。',
67
67
  'settings.visible': '显示宠物',
68
- 'settings.visibleHint': '关闭后宠物隐藏,可从聊天输入区重新召唤。',
68
+ 'settings.visibleHint': '藏起来后可在输入区召唤回来。',
69
69
  'settings.size': '大小(px)',
70
- 'settings.sizeHint': '精灵单元高度,范围 32–1024。',
71
- 'settings.bubbleScale': '气泡字号倍率',
72
- 'settings.bubbleScaleHint': '状态、碎碎念与用量气泡的字号会随宠物大小自动缩放;这一项是在此基础上再乘一个倍率(0.5–2,默认 1)。字号本身不小于 10px、不大于 24px。',
70
+ 'settings.sizeHint': '宠物的高度。',
71
+ 'settings.bubbleScale': '气泡字号',
72
+ 'settings.bubbleScaleHint': '字号随宠物缩放,再乘上这个倍数。',
73
73
  'settings.right': '距右侧(px)',
74
- 'settings.rightHint': '距视口右边缘的水平内缩距离。',
74
+ 'settings.rightHint': '离窗口右边的距离。',
75
75
  'settings.bottom': '距底部(px)',
76
- 'settings.bottomHint': '距视口底边的垂直内缩距离。',
77
- 'settings.inherit': '继承',
76
+ 'settings.bottomHint': '离窗口底边的距离。',
77
+ 'settings.inherit': '默认',
78
78
  'settings.on': '开',
79
79
  'settings.off': '关',
80
- 'settings.overridden': '已覆盖',
80
+ 'settings.overridden': '已修改',
81
81
  'settings.reset': '恢复默认',
82
- 'settings.notExposed': '当前 DSH 版本未向设置页暴露本插件的配置命名空间,表单不可用。可编辑 $DSH_HOME/settings.yaml 直接配置,或确认提供该命名空间的插件已挂载其设置域并重启。',
83
- 'settings.readOnly': '当前部署的设置只读。',
82
+ 'settings.notExposed': '这个版本的 DSH 没有开放宠物的设置,可直接编辑 $DSH_HOME/settings.yaml。',
83
+ 'settings.readOnly': '设置只读。',
84
84
  'settings.expand': '展开设置',
85
85
  'settings.collapse': '收起设置',
86
- 'settings.save': '保存',
87
- 'settings.saving': '保存中…',
88
- 'settings.discard': '放弃',
89
- 'settings.unsaved': '未保存',
90
- 'settings.saveFailed': '部署未接受这些值,已保留供你修改。',
91
- 'settings.invalidNumber': '请输入数字,留空则使用默认值。',
86
+ 'settings.saveFailed': '没有保存成功,输入的值还留着。',
87
+ 'settings.invalidNumber': '填一个数字,留空用默认值。',
92
88
  };
93
89
  /** English copy. */
94
90
  export const en = {
@@ -141,40 +137,36 @@ export const en = {
141
137
  'pet.collapseSessions': 'Collapse session bubbles',
142
138
  // First-level settings section (the `settings.section` seat).
143
139
  'settings.title': 'Pet',
144
- 'settings.description': 'Pick a pet and tune its display layout.',
140
+ 'settings.description': 'Pick a pet to sit in a corner of the page.',
145
141
  'settings.pet': 'Pet',
146
- 'settings.petHint': 'Choose which pet shows. Names are stored per pet; rename from the pet hover panel.',
147
- 'settings.enabled': 'Enable the pet',
148
- 'settings.enabledHint': 'When off, the pet hides and polling stops; re-enable it here.',
142
+ 'settings.petHint': 'Each pet keeps its own name; rename it from the pet panel.',
143
+ 'settings.displayGroup': 'Display',
144
+ 'settings.bubbleGroup': 'Bubbles',
149
145
  'settings.decoration': 'Status decoration',
150
- 'settings.decorationHint': 'Show ornaments like the spouting whale inside the pet status bubbles; when off, bubbles stay text-only.',
146
+ 'settings.decorationHint': 'Bubbles carry ornaments like the spouting whale.',
151
147
  'settings.statusBubbles': 'Status bubbles',
152
- 'settings.statusBubblesHint': 'The pet\'s own session/status bubbles (thinking, using ...). Turning them off leaves only bubbles a third-party plugin pushes through the announcement contract, plus the interaction feedback bubble; on by default.',
148
+ 'settings.statusBubblesHint': 'The pet reports when it is thinking and which tool it is using.',
153
149
  'settings.visible': 'Show the pet',
154
- 'settings.visibleHint': 'When off, the pet hides; summon it again from the input row.',
150
+ 'settings.visibleHint': 'A hidden pet comes back from the input row.',
155
151
  'settings.size': 'Size (px)',
156
- 'settings.sizeHint': 'Sprite cell height, 32\u20131024.',
157
- 'settings.bubbleScale': 'Bubble text multiplier',
158
- 'settings.bubbleScaleHint': 'Status, whisper, and usage bubbles scale with the pet automatically; this multiplies that result (0.5\u20132, default 1). The rendered text stays between 10px and 24px.',
152
+ 'settings.sizeHint': 'How tall the pet stands.',
153
+ 'settings.bubbleScale': 'Bubble text',
154
+ 'settings.bubbleScaleHint': 'Text follows the pet size, times this factor.',
159
155
  'settings.right': 'Right inset (px)',
160
- 'settings.rightHint': 'Horizontal inset from the viewport right edge.',
156
+ 'settings.rightHint': 'Distance from the right edge of the window.',
161
157
  'settings.bottom': 'Bottom inset (px)',
162
- 'settings.bottomHint': 'Vertical inset from the viewport bottom edge.',
163
- 'settings.inherit': 'Inherit',
158
+ 'settings.bottomHint': 'Distance from the bottom edge of the window.',
159
+ 'settings.inherit': 'Default',
164
160
  'settings.on': 'On',
165
161
  'settings.off': 'Off',
166
- 'settings.overridden': 'Overridden',
162
+ 'settings.overridden': 'Changed',
167
163
  'settings.reset': 'Reset to default',
168
- 'settings.notExposed': 'This DSH version does not expose this plugin\'s settings namespace to the configuration page, so the form is unavailable. Edit $DSH_HOME/settings.yaml directly, or confirm that the plugin owning the namespace is mounted with its settings domain and restart.',
169
- 'settings.readOnly': 'This deployment stores settings read-only.',
164
+ 'settings.notExposed': 'This DSH version does not open the pet settings here; edit $DSH_HOME/settings.yaml instead.',
165
+ 'settings.readOnly': 'Settings are read-only.',
170
166
  'settings.expand': 'Show settings',
171
167
  'settings.collapse': 'Hide settings',
172
- 'settings.save': 'Save',
173
- 'settings.saving': 'Saving\u2026',
174
- 'settings.discard': 'Discard',
175
- 'settings.unsaved': 'Unsaved',
176
- 'settings.saveFailed': 'The deployment did not accept these values; they were left for you to correct.',
177
- 'settings.invalidNumber': 'Enter a number, or leave blank to use the default.',
168
+ 'settings.saveFailed': 'Not saved; what you typed is still there.',
169
+ 'settings.invalidNumber': 'Enter a number, or leave it empty for the default.',
178
170
  };
179
171
  /**
180
172
  * Active dictionary, picked by the document language at call time. The pet